compiler/libec; eda, extras: const fixes for DB apps
[sdk] / extras / gui / skins / SimSkin.ec
index 3034e8b..6aa383f 100644 (file)
@@ -44,12 +44,12 @@ ColorKey skinGradient[3] =
 {
    { Color { 40,40,40 }, 0.0f },
    { darkGray, 0.5f },
-   { Color { 40,40,40 }, 1.0f },
+   { Color { 40,40,40 }, 1.0f }
 };
 
 class SimSkin_Window : Window
 {
-   void ShowDecorations(Font captionFont, Surface surface, char * name, bool active, bool moving)
+   void ShowDecorations(Font captionFont, Surface surface, const char * name, bool active, bool moving)
    {
       bool isNormal = (state == normal || state == maximized);
       int top = 0, border = 0, bottom = 0;
@@ -87,7 +87,7 @@ class SimSkin_Window : Window
             deepBottom = (((BorderBits)borderStyle).sizable && isNormal) ? bottom : border;
          }
 
-         surface.Bevel(((BorderBits)borderStyle).bevel ? false : true, deepBorder, deepTop, 
+         surface.Bevel(((BorderBits)borderStyle).bevel ? false : true, deepBorder, deepTop,
             size.w - deepBorder - deepBorder, size.h - deepBottom - deepTop);
       }
 
@@ -101,7 +101,7 @@ class SimSkin_Window : Window
             surface.SetForeground(activeBorder);
             surface.Rectangle(2, 2, size.w-3, size.h-3);
 
-            // Resizeable frame is 1 pixel thicker 
+            // Resizeable frame is 1 pixel thicker
             if(((BorderBits)borderStyle).sizable && isNormal)
                surface.Rectangle(3, 3, size.w - 4, size.h - 4);
          }
@@ -111,7 +111,7 @@ class SimSkin_Window : Window
             surface.Gradient(gradient, sizeof(gradient) / sizeof(ColorKey), GRADIENT_SMOOTHNESS, GRADIENT_DIRECTION,
                border, top, size.w - border - 1, top + CAPTION - 2);
          else
-            surface.Gradient(gradientInactive, sizeof(gradientInactive) / sizeof(ColorKey), 
+            surface.Gradient(gradientInactive, sizeof(gradientInactive) / sizeof(ColorKey),
             GRADIENT_SMOOTHNESS, GRADIENT_DIRECTION,
                border, top, size.w - border - 1, top + CAPTION - 2);
 
@@ -137,8 +137,8 @@ class SimSkin_Window : Window
          {
             int buttonsSize = border +
                ((hasMaximize || hasMinimize) ? 52 : 18);
-            surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET, 
-               size.w - (buttonsSize + border + 4), name, strlen(name));
+            surface.WriteTextDots(left, border + NAME_OFFSETX, top + NAME_OFFSET,
+               size.w - (buttonsSize + border + 4), name, (int)strlen(name));
          }
       }
       if(((BorderBits)borderStyle).contour && !((BorderBits)borderStyle).fixed)
@@ -265,7 +265,7 @@ class SimSkin_Window : Window
 
    void SetWindowMinimum(MinMaxValue * mw, MinMaxValue * mh)
    {
-      bool isNormal = (state == normal || state == maximized);
+      //bool isNormal = (state == normal || state == maximized);
       if(nativeDecorations && rootWindow == this) return;
       if(((BorderBits)borderStyle).fixed && (state != maximized || !parent.menuBar))
       {
@@ -519,14 +519,14 @@ static void Button::Close_OnRedraw(Surface surface)
    }
 }*/
 
-#define PUREVTBL(c)     ((int (**)())*(void **)((byte *)class(c).data + 4))
+#define PUREVTBL(c)     ((int (**)())*(void **)((byte *)class(c).data + sizeof(void *)))
 
 extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics;
 extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw;
 
-static void Dummy()
+__attribute__((unused)) static void Dummy()
 {
-   Window a;
+   Window a = null;
    a.OnApplyGraphics();
    a.OnRedraw(null);
 }
@@ -543,7 +543,7 @@ class SimSkin_Button : Button
    void OnRedraw(Surface surface)
    {
       int isDefault = (int)this.isDefault;
-      PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw](this, surface);
+      ((void (*)(Window, Surface))(void *)PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw])(this, surface);
       if(bevel || (bevelOver && (buttonState == down || buttonState == over || checked)))
       {
          Color c = steelBlue;
@@ -561,12 +561,12 @@ class SimSkin_Button : Button
             surface.SetForeground(Color { Min((int)c.r * 16/10, 255), Min((int)c.g * 16/10, 255), Min((int)c.b * 16/10,255) });
             surface.HLine(0 + isDefault, clientSize.w-2 - isDefault,  isDefault);
             surface.VLine(1 + isDefault, clientSize.h-2 - isDefault,  isDefault);
-            
-            
+
+
             surface.SetForeground(skinMainColor);
             surface.HLine(1 + isDefault, clientSize.w-2 - isDefault, clientSize.h-2 - isDefault);
             surface.VLine(1 + isDefault, clientSize.h-3 - isDefault, clientSize.w-2 - isDefault);
-            
+
             if(bevel)
             {
                //surface.SetForeground(skinForeground);
@@ -629,16 +629,16 @@ class SimSkin_Button : Button
    {
       if(isRadio)
       {
-         PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw](this, surface);
+         ((void (*)(Window, Surface))(void *)PUREVTBL(Button)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw])(this, surface);
          return;
       }
       // if(bevel)
       {
          ButtonState state = this.buttonState;
          Bitmap buttonBitmap = bitmap ? bitmap.bitmap : null;
-         char * text = this.text;
+         const char * text = this.text;
          int offset = (state == down && this.offset) ? 1 : 0;
-         Color backColor = background;
+         //Color backColor = background;
          int isDefault = this.isDefault;
          Font font;
 
@@ -731,13 +731,13 @@ class SimSkin_Button : Button
                   x, y,
                   0,0,buttonBitmap.width,buttonBitmap.height);
             }
-            else 
+            else
             {
                // Push Buttons
                if(scaleBitmap)
                {
                   if(bevel || offset)
-                     surface.Stretch(buttonBitmap, 
+                     surface.Stretch(buttonBitmap,
                         1 + offset, 1 + offset,0,0,
                         clientSize.w-3,clientSize.h-3,buttonBitmap.width,buttonBitmap.height);
                   else
@@ -797,21 +797,21 @@ class SimSkin_Button : Button
          if(text)
          {
             int tw, th;
-            surface.TextExtent(text, strlen(text),&tw, &th);
+            surface.TextExtent(text, (int)strlen(text),&tw, &th);
 
             if((isRadio || isCheckbox) && !bevelOver)
-               WriteCaption(surface, /*clientSize.h +*/ CAPTION_DISTANCE + 3, 
+               WriteCaption(surface, /*clientSize.h +*/ CAPTION_DISTANCE + 3,
                   (clientSize.h - th - 4)/2);
-            else 
+            else
             {
                int x, y = (clientSize.h - th - 1)/2 + offset;
-               
+
                if(ellipsis)
                {
                   int width = clientSize.w - 2*6;
                   int x = 6 + offset;
 
-                  surface.WriteTextDots(alignment, x, y, width, text, strlen(text));
+                  surface.WriteTextDots(alignment, x, y, width, text, (int)strlen(text));
                }
                else
                {
@@ -889,7 +889,7 @@ class SimSkin_ScrollBar : ScrollBar
 {
    void OnApplyGraphics()
    {
-      PUREVTBL(ScrollBar)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics](this);
+      ((void (*)(Window))(void *)PUREVTBL(ScrollBar)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics])(this);
 
       //background = { skinBackground.r * 9 / 6, skinBackground.g * 9 / 6, skinBackground.b * 9 / 6 };
 /*
@@ -898,30 +898,30 @@ class SimSkin_ScrollBar : ScrollBar
       downBtn.background = Color {  70 * 6/10, 130* 6/10, 180* 6/10 }; //skinBackground;
       downBtn.bitmap = { (direction == vertical) ? "<:ecere>elements/arrowDown.png" : "<:ecere>elements/arrowRight.png", monochrome = true };
       thumb.background = Color {  70 * 6/10, 130* 6/10, 180* 6/10 }; //skinBackground;*/
-   }   
+   }
 }
 
 /*class SimSkin_DropBox : DropBox
 {
    void OnApplyGraphics()
    {
-      PUREVTBL(DropBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics](this);
+      ((void (*)(Window))(void *)PUREVTBL(DropBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics])(this);
       button.bitmap = { "<:ecere>elements/arrowDown.png", monochrome = true };
       background = skinBackground;
       foreground = skinForeground;
       selectionColor = skinMainColor;
-   }   
+   }
 }*/
 
 /*class SimSkin_ListBox : ListBox
 {
    void OnApplyGraphics()
    {
-      PUREVTBL(ListBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics](this);
+      ((void (*)(Window))(void *)PUREVTBL(ListBox)[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnApplyGraphics])(this);
       background = skinBackground;
       foreground = skinForeground;
       selectionColor = skinMainColor;
-   }   
+   }
 }*/
 
 public class SimSkin : Skin
@@ -942,7 +942,7 @@ public class SimSkin : Skin
       return { faceName = "Verdana", size = 6.5f };
    }
 
-   char * ::CursorsBitmaps(uint id, int *hotSpotX, int *hotSpotY, byte ** paletteShades)
+   const char * ::CursorsBitmaps(uint id, int *hotSpotX, int *hotSpotY, byte ** paletteShades)
    {
       return null;
    }