+#if defined(WIN32)
+#define WIN32_LEAN_AND_MEAN
+#define Method _Method
+#include <windows.h>
+#undef Method
+#endif
+
public import "ecere"
//define test = Color { 5, 4, 2 };
{
bool isNormal = (state == normal || state == maximized);
int top = 0, border = 0, bottom = 0;
+
+ if(nativeDecorations && rootWindow == this) return;
+
if(state == minimized)
top = border = bottom = DEAD_BORDER;
else if(((BorderBits)borderStyle).sizable)
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);
}
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);
}
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);
{
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)
void GetDecorationsSize(MinMaxValue * w, MinMaxValue * h)
{
*w = *h = 0;
+
+ if(hasMenuBar && state != minimized)
+ {
+ *h += MENU_HEIGHT;
+ }
+ if(statusBar && state != minimized)
+ {
+ *h += STATUS_HEIGHT;
+ }
+
+ if(nativeDecorations && rootWindow == this)
+ {
+#if defined(WIN32)
+ RECT rcClient, rcWindow;
+ GetClientRect(systemHandle, &rcClient);
+ GetWindowRect(systemHandle, &rcWindow);
+ *w += (rcWindow.right - rcWindow.left) - rcClient.right;
+ *h += (rcWindow.bottom - rcWindow.top) - rcClient.bottom;
+
+ // PrintLn(_class.name, " is at l = ", rcWindow.left, ", r = ", rcWindow.right);
+#endif
+ return;
+ }
if((((BorderBits)borderStyle).deep || ((BorderBits)borderStyle).bevel) && state != minimized)
{
*w += 4;
*w += 2;
*h += 2;
}
- if(hasMenuBar && state != minimized)
- {
- *h += MENU_HEIGHT;
- }
- if(statusBar && state != minimized)
- {
- *h += STATUS_HEIGHT;
- }
}
bool IsMouseMoving(int x, int y, int w, int h)
{
BorderBits style = (BorderBits)borderStyle; // TOFIX: borderStyle.fixed doesn't work
+ if(nativeDecorations && rootWindow == this) return false;
if(style.fixed)
{
bool resizeX, resizeY, resizeEndX, resizeEndY;
bool result = false;
*resizeX = *resizeY = *resizeEndX = *resizeEndY = false;
+ if(nativeDecorations && rootWindow == this) return false;
if(((BorderBits)borderStyle).sizable && (state == normal))
{
void SetWindowMinimum(MinMaxValue * mw, MinMaxValue * mh)
{
bool isNormal = (state == normal || state == maximized);
+ if(nativeDecorations && rootWindow == this) return;
if(((BorderBits)borderStyle).fixed && (state != maximized || !parent.menuBar))
{
*mw = MIN_WIDTH;
*x = *y = 0;
- GetDecorationsSize(&aw, &ah);
-
- // Compute client area start
- if(((BorderBits)borderStyle).deep || ((BorderBits)borderStyle).bevel)
+ if(hasMenuBar)
{
- *x += 2;
- *y += 2;
+ *y += MENU_HEIGHT;
}
- if(((BorderBits)borderStyle).sizable && isNormal)
- {
- *x += BORDER;
- *y += TOP;
- }
+ GetDecorationsSize(&aw, &ah);
- if(hasMenuBar)
+ if(nativeDecorations && rootWindow == this)
{
- *y += MENU_HEIGHT;
+#if defined(WIN32)
+ RECT rcWindow;
+ POINT client00 = { 0, 0 };
+ ClientToScreen(systemHandle, &client00);
+ GetWindowRect(systemHandle, &rcWindow);
+ *x += client00.x - rcWindow.left;
+ *y += client00.y - rcWindow.top;
+#endif
}
-
- if(((BorderBits)borderStyle).fixed && (state != maximized || !parent.menuBar))
+ else
{
- *y += CAPTION;
- if(!((BorderBits)borderStyle).sizable || state == minimized)
+ // Compute client area start
+ if(((BorderBits)borderStyle).deep || ((BorderBits)borderStyle).bevel)
{
- *y += DEAD_BORDER;
- *x += DEAD_BORDER;
+ *x += 2;
+ *y += 2;
}
- }
- if(((BorderBits)borderStyle).contour && !((BorderBits)borderStyle).fixed)
- {
- *x += 1;
- *y += 1;
+ if(((BorderBits)borderStyle).sizable && isNormal)
+ {
+ *x += BORDER;
+ *y += TOP;
+ }
+
+ if(((BorderBits)borderStyle).fixed && (state != maximized || !parent.menuBar))
+ {
+ *y += CAPTION;
+ if(!((BorderBits)borderStyle).sizable || state == minimized)
+ {
+ *y += DEAD_BORDER;
+ *x += DEAD_BORDER;
+ }
+ }
+
+ if(((BorderBits)borderStyle).contour && !((BorderBits)borderStyle).fixed)
+ {
+ *x += 1;
+ *y += 1;
+ }
}
// Reduce client area
bool isNormal = (state == normal || state == maximized);
int top = 0, border = 0;
int insideBorder;
- if(state == minimized)
- top = border = DEAD_BORDER;
- else if(((BorderBits)borderStyle).sizable)
+
+ if(!nativeDecorations || rootWindow != this)
{
- if(state == maximized && parent.menuBar)
+ if(state == minimized)
+ top = border = DEAD_BORDER;
+ else if(((BorderBits)borderStyle).sizable)
+ {
+ if(state == maximized && parent.menuBar)
+ {
+ top = 2;
+ border = 2;
+ }
+ else
+ {
+ top = isNormal ? TOP : 0;
+ border = isNormal ? BORDER : 0;
+ }
+ }
+ else if(((BorderBits)borderStyle).fixed)
{
top = 2;
border = 2;
}
- else
+ else if(((BorderBits)borderStyle).contour)
{
- top = isNormal ? TOP : 0;
- border = isNormal ? BORDER : 0;
+ top = 1;
+ border = 1;
}
- }
- else if(((BorderBits)borderStyle).fixed)
- {
- top = 2;
- border = 2;
- }
- else if(((BorderBits)borderStyle).contour)
- {
- top = 1;
- border = 1;
- }
- insideBorder = border;
- if(((BorderBits)borderStyle).deep)
- insideBorder += 2;
+ insideBorder = border;
+ if(((BorderBits)borderStyle).deep)
+ insideBorder += 2;
- if(menuBar)
- {
- if(state == minimized)
- menuBar.visible = false;
- else
- menuBar.visible = true;
- menuBar.Move(clientStart.x, clientStart.y - MENU_HEIGHT, size.w - insideBorder * 2, MENU_HEIGHT);
- }
- if(statusBar)
- {
- if(state == minimized)
- statusBar.visible = false;
- else
+ if(menuBar)
{
- statusBar.visible = true;
- statusBar.anchor = { left = clientStart.x, bottom = border };
- statusBar.size.w = size.w - insideBorder * 2;
+ if(state == minimized)
+ menuBar.visible = false;
+ else
+ menuBar.visible = true;
+ menuBar.Move(clientStart.x, clientStart.y - MENU_HEIGHT, size.w - insideBorder * 2, MENU_HEIGHT);
+ }
+ if(statusBar)
+ {
+ if(state == minimized)
+ statusBar.visible = false;
+ else
+ {
+ statusBar.visible = true;
+ statusBar.anchor = { left = clientStart.x, bottom = border };
+ statusBar.size.w = size.w - insideBorder * 2;
+ }
}
}
-
- if(minimizeButton)
- {
- minimizeButton.anchor = { right = ((maximizeButton && !maximizeButton.disabled) ? 25 + 34 + 4 : 34 + 4) + border, top = top + BUTTON_OFFSET };
- minimizeButton.size = { 20, 10 };
- minimizeButton.foreground = skinForeground;
- minimizeButton.background = skinBackground;
- minimizeButton.bevel = false;
- minimizeButton.OnRedraw = Minimize_OnRedraw;
- minimizeButton.visible = true;
- }
- if(maximizeButton && !maximizeButton.disabled)
- {
- maximizeButton.anchor = { right = 34 + 4 + border, top = top + BUTTON_OFFSET };
- maximizeButton.size = { 20, 10 };
- maximizeButton.bevel = false;
- maximizeButton.foreground = skinForeground;
- maximizeButton.background = skinBackground;
- maximizeButton.OnRedraw = Maximize_OnRedraw;
- maximizeButton.visible = true;
- }
- if(closeButton)
+ if(!nativeDecorations || rootWindow != this)
{
- closeButton.anchor = { right = -1 + border, top = top + BUTTON_OFFSET };
- closeButton.size = { 34, 10 };
- closeButton.bevel = false;
- closeButton.foreground = skinForeground;
- closeButton.background = skinBackground;
- closeButton.OnRedraw = Close_OnRedraw;
- closeButton.visible = true;
+ if(minimizeButton)
+ {
+ minimizeButton.anchor = { right = ((maximizeButton && !maximizeButton.disabled) ? 25 + 34 + 4 : 34 + 4) + border, top = top + BUTTON_OFFSET };
+ minimizeButton.size = { 20, 10 };
+ minimizeButton.foreground = skinForeground;
+ minimizeButton.background = skinBackground;
+ minimizeButton.bevel = false;
+ minimizeButton.OnRedraw = Minimize_OnRedraw;
+ minimizeButton.visible = true;
+ }
+ if(maximizeButton && !maximizeButton.disabled)
+ {
+ maximizeButton.anchor = { right = 34 + 4 + border, top = top + BUTTON_OFFSET };
+ maximizeButton.size = { 20, 10 };
+ maximizeButton.bevel = false;
+ maximizeButton.foreground = skinForeground;
+ maximizeButton.background = skinBackground;
+ maximizeButton.OnRedraw = Maximize_OnRedraw;
+ maximizeButton.visible = true;
+ }
+ if(closeButton)
+ {
+ closeButton.anchor = { right = -1 + border, top = top + BUTTON_OFFSET };
+ closeButton.size = { 34, 10 };
+ closeButton.bevel = false;
+ closeButton.foreground = skinForeground;
+ closeButton.background = skinBackground;
+ closeButton.OnRedraw = Close_OnRedraw;
+ closeButton.visible = true;
+ }
}
}
}
}*/
-#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;
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;
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);
{
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)
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
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
{
{
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 };
/*
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
class_property(selectionColor) = (Color)skinMainColor;
class_property(disabledBackColor) = (Color)Color{ 128,128,128 };
class_property(disabledFrontColor) = (Color)Color{ 255,255,255 };
+ class_property(selectionText) = (Color)white;
FontResource ::SystemFont()
{