sdk: const correctness
[sdk] / ecere / src / gui / controls / StatusBar.ec
index b3e355d..3f9c990 100644 (file)
@@ -53,7 +53,7 @@ public:
 private:
    StatusBar()
    {
-      fields.offset = (uint)&((StatusField)0).prev;
+      fields.offset = (uint)(uintptr)&((StatusField)0).prev;
    }
 
    ~StatusBar()
@@ -61,6 +61,8 @@ private:
       Clear();
    }
 
+   FontResource boldFont { font.faceName, font.size, true, window = this };
+
    bool OnLoadGraphics()
    {
       StatusField field;
@@ -106,9 +108,15 @@ private:
          }
          if(field.text)
          {
-            Box clip { x, 2, x + field.width - 1, statusBarHeight-1 };
+            Box clip { x, 2, x + field.width - 1, statusBarHeight-3 };
             int tw;
             surface.Clip(clip);
+            if(field.backColor)
+            {
+               surface.SetBackground(field.backColor);
+               surface.Clear(colorBuffer);
+            }
+            surface.font = field.bold ? boldFont.font : fontObject;
             surface.TextExtent(field.text, strlen(field.text), &tw, null);
             surface.WriteTextf(x + (field.width - tw) / 2, 2, field.text);
             surface.Clip(null);
@@ -134,7 +142,7 @@ private:
       Update(null);
    };
 
-   char * text;
+   const char * text;
    OldList fields;
    int width;
 };
@@ -170,8 +178,28 @@ public:
          }
       }
    }
+   property ColorAlpha backColor
+   {
+      set
+      {
+         if(this)
+         {
+            backColor = value;
+            colorSet = true;
+            if(_statusBar)
+               _statusBar.Update(null);
+         }
+      }
+   }
+   property bool bold
+   {
+      set
+      {
+         if(this) this.bold = value;
+      }
+   }
 
-   property char * text
+   property const char * text
    {
       set
       {
@@ -207,7 +235,7 @@ public:
       }
    }
 
-   void SetTextf(char * format, ...)
+   void SetTextf(const char * format, ...)
    {
       if(this)
       {
@@ -237,6 +265,8 @@ private:
    char * text;
    int width;
    Color color;
+   ColorAlpha backColor;
    StatusBar _statusBar;
    bool colorSet;
+   bool bold;
 };