import "ProgressBar"
import "EditBox"
import "DataBox"
+import "ToolTip"
#if !defined(ECERE_VANILLA) && !defined(ECERE_NO3D)
import "Desktop3D"
import "FileDialog"
import "MessageBox"
import "WindowList"
+import "i18n"
// Had to define this here for native decorations support, because the menu bar is part of total decoration's size, but not part of the system decorations
+#ifdef HIGH_DPI
+define skinMenuHeight = 40;
+define statusBarHeight = 30;
+#else
define skinMenuHeight = 25;
define statusBarHeight = 18;
+#endif
default extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyDown;
-public enum DialogResult { cancel, yes, no, ok };
+public enum DialogResult : int64 { cancel, yes, no, ok };
public class MouseButtons
{
// Clear();
Empty();
- FASTLIST_LOOP(source, extentBox)
+ //FASTLIST_LOOP(source, extentBox)
+ for(extentBox = (BoxItem)source.first; extentBox; extentBox = (BoxItem)extentBox.next)
AddBox(extentBox.box);
}
// Clip all boxes of extent against inside of the new box
BoxItem extentBox, next;
- FASTLIST_LOOPN(this, extentBox, next)
+ //FASTLIST_LOOPN(this, extentBox, next) // Macros still mess up the parser!
+ for(extentBox = (BoxItem)this.first; extentBox; extentBox = next)
{
+ next = (BoxItem)extentBox.next;
if(box.left > extentBox.box.left) extentBox.box.left = box.left;
if(box.top > extentBox.box.top) extentBox.box.top = box.top;
if(box.right < extentBox.box.right) extentBox.box.right = box.right;
temp.Copy(this);
Empty();
- FASTLIST_LOOP(temp, extentBox)
+ for(extentBox = (BoxItem)temp.first; extentBox; extentBox = (BoxItem)extentBox.next)
{
if(extentBox.box.left < box.right && extentBox.box.right > box.left &&
extentBox.box.top < box.bottom && extentBox.box.bottom > box.top)
BoxItem extentBox, next;
// First pass: check if this box is not already covered by one of the extent's box
- FASTLIST_LOOP(this, extentBox)
+ for(extentBox = (BoxItem)this.first; extentBox; extentBox = (BoxItem)extentBox.next)
{
if(extentBox.box.left <= box.left && extentBox.box.right >= box.right &&
extentBox.box.top <= box.top && extentBox.box.bottom >= box.bottom)
}
// Second pass: only keep boxes not completely covered in the new box
- FASTLIST_LOOPN(this, extentBox, next)
+ for(extentBox = (BoxItem)this.first; extentBox; extentBox = next)
{
+ next = (BoxItem)extentBox.next;
if(extentBox.box.left >= box.left && extentBox.box.right <= box.right &&
extentBox.box.top >= box.top && extentBox.box.bottom <= box.bottom)
Delete(extentBox);
if(box.bottom >= box.top && box.right >= box.left)
{
// Optimization: if the resulting boxes touch, add them smarter
- FASTLIST_LOOP(this, extentBox)
+ for(extentBox = (BoxItem)this.first; extentBox; extentBox = (BoxItem)extentBox.next)
{
if(box.top == extentBox.box.top && box.bottom == extentBox.box.bottom)
{
{
BoxItem extentBox;
- FASTLIST_LOOP(b, extentBox)
+ for(extentBox = (BoxItem)b.first; extentBox; extentBox = (BoxItem)extentBox.next)
UnionBox(extentBox.box, temp);
}
Empty();
- FASTLIST_LOOP(b, extentBox)
+ for(extentBox = (BoxItem)b.first; extentBox; extentBox = (BoxItem)extentBox.next)
{
temp2.Copy(temp);
temp2.IntersectBox(extentBox.box);
void Exclusion(Extent b, Extent temp)
{
BoxItem extentBox;
- FASTLIST_LOOP(b, extentBox)
+ for(extentBox = (BoxItem)b.first; extentBox; extentBox = (BoxItem)extentBox.next)
ExcludeBox(extentBox.box, temp);
}
void Offset(int x, int y)
{
BoxItem extentBox;
- FASTLIST_LOOP(this, extentBox)
+ for(extentBox = (BoxItem)this.first; extentBox; extentBox = (BoxItem)extentBox.next)
{
extentBox.box.left += x;
extentBox.box.top += y;
private:
class_data char * icon;
class_no_expansion
- class_default_property text;
+ class_default_property caption;
// class_initialize GuiApplication::Initialize;
class_designer FormDesigner;
class_property char * icon
Window()
{
- if(guiApp) guiApp.Initialize(true);
+ bool switchMode = true;
+#if defined(__ANDROID__)
+ switchMode = false;
+ fullRender = true;
+#endif
+ if(guiApp)
+ guiApp.Initialize(switchMode);
if(guiApp && guiApp.currentSkin && ((subclass(Window))_class).pureVTbl)
{
autoCreate = true;
modifyVirtArea = true;
manageDisplay = true;
+ nativeDecorations = true;
// scrollFlags = ScrollFlags { snapX = true, snapY = true };
sbStep.x = sbStep.y = 8;
ResPtr ptr;
if(parent)
+ {
stopwatching(parent, font);
+ if(parent.activeChild == this)
+ parent.activeChild = null;
+ if(parent.activeClient == this)
+ parent.activeClient = null;
+ }
if(!destroyed)
{
{
int x = absPosition.x + clientStart.x;
int y = absPosition.y + clientStart.y;
- if(rootWindow.nativeDecorations)
+ if(rootWindow.nativeDecorations && rootWindow.windowHandle)
{
x -= rootWindow.clientStart.x;
y -= rootWindow.clientStart.y - (rootWindow.hasMenuBar ? skinMenuHeight : 0);
{
int x = absPosition.x;
int y = absPosition.y;
- if(rootWindow.nativeDecorations)
+ if(rootWindow.nativeDecorations && rootWindow.windowHandle)
{
x -= rootWindow.clientStart.x;
y -= rootWindow.clientStart.y - (rootWindow.hasMenuBar ? skinMenuHeight : 0);
void FigureCaption(char * caption)
{
+ Window activeClient = null;
+
caption[0] = '\0';
if(this.caption)
strcpy(caption, this.caption);
if(modifiedDocument)
strcat(caption, " *");
}
- if(activeClient && menuBar &&
- activeClient.state == maximized)
+
+ if(menuBar)
+ {
+ for(activeClient = this.activeClient; activeClient && !((BorderBits)activeClient.borderStyle).fixed; activeClient = activeClient.activeClient);
+ }
+ if(activeClient && activeClient.state == maximized)
{
if(activeClient.caption)
{
}
// This is required to get proper initial decoration size using native decorations on Windows
- if(nativeDecorations && guiApp && guiApp.interfaceDriver && !visible)
- guiApp.interfaceDriver.PositionRootWindow(this, x, y, size.w, size.h, true, true);
+ if(nativeDecorations && windowHandle && guiApp && guiApp.interfaceDriver && !visible)
+ guiApp.interfaceDriver.PositionRootWindow(this, x, y, Max(1, size.w), Max(1, size.h), true, true);
GetDecorationsSize(&ew, &eh);
if(anchor.left.type >= cascade && (state == normal /*|| state == Hidden*/))
SetPosition(x, y, w, h, true, modifyArea, updateScrollBars);
clientResized = oldCW != clientSize.w || oldCH != clientSize.h || force;
+ if(clientResized && this == rootWindow && nativeDecorations && rootWindow.windowHandle)
+ windowResized = true;
if(display && rootWindow != this)
Update(null);
{
if(!thisOnly)
{
- UpdateNonClient();
+ // Buttons bitmap resources crash if we do this while switching mode
+ if(!guiApp || !guiApp.modeSwitching)
+ UpdateNonClient();
// Process Anchored Children
if(processAnchors)
y -= guiApp.desktop.absPosition.y;
}*/
//guiApp.Log("Position %s\n", caption);
- if(windowResized || windowMoved)
- if(display && !display.flags.memBackBuffer && changeRootWindow)
- guiApp.interfaceDriver.PositionRootWindow(this, x, y, w, h, windowMoved, windowResized); //realResized);
+ if(windowHandle)
+ {
+ if(windowResized || windowMoved)
+ if(display && !display.flags.memBackBuffer && changeRootWindow)
+ guiApp.interfaceDriver.PositionRootWindow(this, x, y, w, h, windowMoved, windowResized); //realResized);
- if(!guiApp.fullScreenMode && this != guiApp.desktop && (windowResized || windowMoved))
- for(child = parent.children.first; child && child != this; child = child.next)
- if(child.rootWindow)
- guiApp.interfaceDriver.UpdateRootWindow(child.rootWindow);
+ if(!guiApp.fullScreenMode && this != guiApp.desktop && (windowResized || windowMoved))
+ for(child = parent.children.first; child && child != this; child = child.next)
+ if(child.rootWindow)
+ guiApp.interfaceDriver.UpdateRootWindow(child.rootWindow);
+ }
if(display)
{
if(windowResized)
{
// result = realResized ? display.Resize(size.w, size.h) : true;
- if(nativeDecorations)
+ if(nativeDecorations && rootWindow.windowHandle)
{
int w = clientSize.w, h = clientSize.h;
if(hasMenuBar) h += skinMenuHeight;
display.Unlock();
}
}
- if(guiApp.driver && changeRootWindow)
+ if(guiApp.driver && changeRootWindow && windowHandle)
{
if(windowResized || windowMoved)
if(!display || display.flags.memBackBuffer)
}
else
{
+ int oldHRange = sbh ? sbh.range : 0;
+ int oldVRange = sbv ? sbv.range : 0;
// Then start off with horizontal scrollbar range
if(sbh)
{
positionH = sbh.thumbPosition;
+
+ /*
sbh.seen = cw;
sbh.total = rvw;
+ */
+ SBSetSeen(sbh, cw);
+ SBSetTotal(sbh, rvw);
rangeH = sbh.range;
if(rangeH > 1)
ch -= guiApp.currentSkin.HorizontalSBH();
if(sbv)
{
positionV = sbv.thumbPosition;
+ /*
sbv.seen = ch;
sbv.total = rvh;
+ */
+ SBSetSeen(sbv, ch);
+ SBSetTotal(sbv, rvh);
rangeV = sbv.range;
if(rangeV > 1)
{
// Maybe we need to set the range on the horizontal scrollbar again
if(sbh)
{
+ /*
sbh.seen = cw;
sbh.total = rvw;
- sbh.Action(setRange, positionH, 0);
+ */
+ SBSetSeen(sbh, cw);
+ SBSetTotal(sbh, rvw);
+ //sbh.Action(setRange, positionH, 0);
if(rangeH <= 1 && sbh.range > 1)
{
ch -= guiApp.currentSkin.HorizontalSBH();
+ /*
sbv.seen = ch;
sbv.total = rvh;
+ */
+ SBSetSeen(sbv, ch);
+ SBSetTotal(sbv, rvh);
rangeV = sbv.range;
- sbv.Action(setRange, positionV, 0);
+ //sbv.Action(setRange, positionV, 0);
}
rangeH = sbh.range;
}
}
+ if(sbh && sbh.range != oldHRange) sbh.Action(setRange, positionH, 0);
+ if(sbv && sbv.range != oldVRange) sbv.Action(setRange, positionV, 0);
}
// Update the scrollbar visibility
if(sbh) // && !sbh.style.hidden
{
- sbh.Move(clientStart.x, clientStart.y + clientSize.h, clientSize.w,0);
+ if(!sbh.anchored)
+ sbh.Move(clientStart.x, clientStart.y + clientSize.h, clientSize.w,0);
// Need to set the range again (should improve...) since the scrollbars didn't have
// the right size when UpdateScrollArea set the range on it
if(flag)
}
if(sbv) // && !sbv.state.hidden
{
- sbv.Move(clientStart.x + clientSize.w, clientStart.y, 0, clientSize.h);
+ if(!sbv.anchored)
+ sbv.Move(clientStart.x + clientSize.w, clientStart.y, 0, clientSize.h);
// Need to set the range again (should improve...) since the scrollbars didn't have
// the right size when UpdateScrollArea set the range on it
if(flag)
}
}
+ Window GetParentMenuBar()
+ {
+ Window result = this;
+ bool notActiveClient = false;
+ Window menuBarParent;
+ for(menuBarParent = this; menuBarParent; menuBarParent = menuBarParent.parent)
+ {
+ if(menuBarParent.menuBar) { result = notActiveClient ? null : menuBarParent.menuBar; break; }
+ if(menuBarParent.parent && /*menuBarParent != */!menuBarParent.parent.activeClient)
+ notActiveClient = true;
+ }
+ return result;
+ }
+
void CreateSystemChildren(void)
{
Window parent = this;
bool hasClose = false, hasMaxMin = false;
Point scroll = this.scroll;
- if(state == maximized && this.parent.menuBar)
- {
- if(this.parent.activeClient == this)
- parent = this.parent.menuBar;
- else
- parent = null;
- }
+ if(state == maximized)
+ parent = GetParentMenuBar();
if(parent)
{
UpdateDecorations();
if(parent)
{
- if(parent.rootWindow == parent && parent.activeClient == this) // Added this last check
+ if(parent.activeClient == this) // Added this last check
{
- char caption[2048];
- parent.FigureCaption(caption);
- guiApp.interfaceDriver.SetRootWindowCaption(parent, caption);
+ if(parent.rootWindow == parent)
+ {
+ char caption[2048];
+ parent.FigureCaption(caption);
+ guiApp.interfaceDriver.SetRootWindowCaption(parent, caption);
+ }
+ else
+ parent.UpdateCaption();
}
parent.UpdateDecorations();
}
previous.CreateSystemChildren();
}
}
+
if(menu)
{
MenuItem item;
if(menu)
menu.Clean(this);
- if(activeClient && activeClient.menu && activeClient.state != minimized)
- {
- if(mergeMenus)
- {
- //activeClient.menu.Clean(activeClient);
- menu.Merge(activeClient.menu, true, activeClient);
- }
- }
-
- if(activeChild && activeChild != activeClient && activeChild.menu && activeChild.state != minimized)
- {
- if(mergeMenus)
- menu.Merge(activeChild.menu, true, activeChild);
- }
-
// Build window list
if(activeClient)
{
if(item) item.disabled = !activeClient || !activeClient.style.hasClose;
item = menu.FindItem(MenuFileSaveAll, 0);
if(item) item.disabled = numDocuments < 1;
+
+ if(activeClient && activeClient.menu && activeClient.state != minimized)
+ {
+ if(mergeMenus)
+ {
+ //activeClient.menu.Clean(activeClient);
+ menu.Merge(activeClient.menu, true, activeClient);
+ }
+ }
+
+ if(activeChild && activeChild != activeClient && activeChild.menu && activeChild.state != minimized)
+ {
+ if(mergeMenus)
+ menu.Merge(activeChild.menu, true, activeChild);
+ }
}
// This is called again for a child window change, with same active client
OnActivateClient(activeClient, previous);
+ if(!menuBar && !((BorderBits)borderStyle).fixed && parent && parent.activeClient == this)
+ parent.UpdateActiveDocument(null);
}
void _ShowDecorations(Box box, bool post)
if(this == rootWindow)
{
if(style.drawBehind || background.a)
+ {
+ int a = background.a;
+ // Premultiply alpha for clear color
+ surface.SetBackground({ (byte)a, { (byte)(a*background.color.r/255), (byte)(a*background.color.g/255), (byte)(a*background.color.b/255) } });
surface.Clear(colorBuffer);
+ surface.SetBackground(background);
+ }
}
else if(background.a)
{
}
else if(/*style.clearDepthBuffer || */background.a)
{
+ int a = background.a;
// surface.Clear((style.clearDepthBuffer ? depthBuffer : 0) | (background.a ? colorBuffer : 0));
+ // Premultiply alpha for clear color
+ surface.SetBackground({ (byte)a, { (byte)(a*background.color.r/255), (byte)(a*background.color.g/255), (byte)(a*background.color.b/255) } });
surface.Clear(colorBuffer);
+ surface.SetBackground(background);
}
}
bool opaque = IsOpaque();
Window child;
int offsetX = absPosition.x - rootWindow.absPosition.x, offsetY = absPosition.y - rootWindow.absPosition.y;
- if(rootWindow.nativeDecorations)
+ if(rootWindow.nativeDecorations && rootWindow.windowHandle)
{
offsetX -= rootWindow.clientStart.x;
offsetY -= rootWindow.clientStart.y - (rootWindow.hasMenuBar ? skinMenuHeight : 0);
Extent * renderArea = &rootWindow.tempExtents[1];
int offsetX = child.absPosition.x - rootWindow.absPosition.x, offsetY = child.absPosition.y - rootWindow.absPosition.y;
- if(child.rootWindow.nativeDecorations)
+ if(child.rootWindow.nativeDecorations && rootWindow.windowHandle)
{
offsetX -= child.rootWindow.clientStart.x;
offsetY -= child.rootWindow.clientStart.y - (child.rootWindow.hasMenuBar ? skinMenuHeight : 0);
Extent * dirtyExtentWindow = &rootWindow.tempExtents[1];
Window child;
int offsetX = absPosition.x - rootWindow.absPosition.x, offsetY = absPosition.y - rootWindow.absPosition.y;
- if(rootWindow.nativeDecorations)
+ if(rootWindow.nativeDecorations && rootWindow.windowHandle)
{
offsetX -= rootWindow.clientStart.x;
offsetY -= rootWindow.clientStart.y - (rootWindow.hasMenuBar ? skinMenuHeight : 0);
dirty->Empty();
// Will need scrolledArea.x & scrolledArea.y to support multiple scrolls
- FASTLIST_LOOP(scrollExtent, scrollBox)
+ for(scrollBox = (BoxItem)scrollExtent.first; scrollBox; scrollBox = (BoxItem)scrollBox.next)
display.Scroll(scrollBox.box, scrolledArea.x, scrolledArea.y, dirty);
scrolledArea.x = 0;
Window child;
Window rootWindow = this.rootWindow;
int offsetX = absPosition.x - rootWindow.absPosition.x, offsetY = absPosition.y - rootWindow.absPosition.y;
- if(rootWindow.nativeDecorations)
+ if(rootWindow.nativeDecorations && rootWindow.windowHandle)
{
offsetX -= rootWindow.clientStart.x;
offsetY -= rootWindow.clientStart.y - (rootWindow.hasMenuBar ? skinMenuHeight : 0);
printf("\n\nRendering %s (%x):\n------------------------------------------\n", _class.name, this);*/
#endif
- FASTLIST_LOOP(renderArea, extentBox)
+ for(extentBox = (BoxItem)renderArea.first; extentBox; extentBox = (BoxItem)extentBox.next)
{
Box box = extentBox.box;
{
// TO DO: There's an issue about draw over children...
// TO DO: Don't wanna go through this if method isn't used
- FASTLIST_LOOP(/*renderArea */overRenderArea, extentBox)
+ for(extentBox = (BoxItem)overRenderArea.first; extentBox; extentBox = (BoxItem)extentBox.next)
+ //FASTLIST_LOOP(/*renderArea */overRenderArea, extentBox)
{
Box box = extentBox.box;
//printf("\n\nUpdate:\n------------------------------------------\n");
#endif
- FASTLIST_LOOP(updateExtent, extentBox)
+ //FASTLIST_LOOP(updateExtent, extentBox)
+ for(extentBox = (BoxItem)updateExtent.first; extentBox; extentBox = (BoxItem)extentBox.next)
{
#ifdef _DEBUG
/*printf("Updating (%d, %d) - (%d, %d)\n",
{
BoxItem extentBox, next;
BoxItem first = (BoxItem)ACCESS_ITEM(dirtyBack, dirtyBack.first);
- FASTLIST_LOOPN(dirtyBack, extentBox, next)
+ for(extentBox = (BoxItem)dirtyBack.first; extentBox; extentBox = next)
{
+ next = (BoxItem)extentBox.next;
if(extentBox != first)
{
if(extentBox.box.left < first.box.left)
}
if(activeChild)
- if(!activeChild.PropagateActive(active, previous, goOnWithActivation, false) || !*goOnWithActivation)
+ {
+ Window aChild = activeChild;
+ incref aChild;
+ if(!aChild.PropagateActive(active, previous, goOnWithActivation, false) || !*goOnWithActivation)
{
+ delete aChild;
return false;
}
+ delete aChild;
+ }
}
}
return result;
bool real = parent.activeChild != this;
// TEST THIS: New activateParent check here!!! CAUSED MENUS NOT GOING AWAY
- if(/*activateParent && */guiApp.interimWindow &&
+ if(!style.inactive && /*activateParent && */guiApp.interimWindow &&
!IsDescendantOf(guiApp.interimWindow) &&
!IsSlaveOf(guiApp.interimWindow))
{
parent.activeChild = this;
if(!style.nonClient /*&& style.isActiveClient*/)
{
- if(style.isActiveClient && !style.hidden)
- parent.activeClient = this;
- parent.UpdateActiveDocument(previous);
+ if(!style.hidden)
+ {
+ if(style.isActiveClient)
+ parent.activeClient = this;
+ // Moved UpdateActiveDocument inside hidden check
+ // To prevent activating previous window while creating a new one
+ // (It was messing up the privateModule in the CodeEditor)
+ parent.UpdateActiveDocument(previous);
+ }
}
}
}
case tab: case shiftTab:
{
Window cycleParent = this;
- if(this == guiApp.interimWindow && !master.style.interim && !cycleParent.style.tabCycle)
+ if(this == guiApp.interimWindow && master && !master.style.interim && !cycleParent.style.tabCycle && master.parent)
cycleParent = master.parent;
if(!guiApp.windowCaptured && cycleParent.style.tabCycle)
status = false;
break;
}
- if(style.tabCycle ||
- CycleChildren(key.shift, true, false, true))
+ if(style.tabCycle)
{
delete this;
return true;
}
+ if(CycleChildren(key.shift, true, false, true))
+ {
+ status = false;
+ break;
+ }
}
break;
/*
Window hotKeyWindow = hotKey.window;
Window parent = hotKeyWindow.parent;
Window prevActiveWindow = activeChild;
+ // For when sys buttons are placed inside the menu bar
+ if(parent && parent._class == class(PopupMenu))
+ parent = parent.parent;
- // Don't process non-visible buttons, but make an exception for the Alt-F4 with Native Decorations turned on
- if(hotKeyWindow.style.hidden && (!hotKeyWindow.style.nonClient || !parent || !parent.nativeDecorations || (hotKeyWindow != parent.sysButtons[2] && hotKeyWindow != parent.sysButtons[1] )))
+ // Don't process non-visible buttons, but make an exception for the Alt-F4 with Native Decorations turned on; This handles alt+enter as well
+ if(hotKeyWindow.style.hidden && (!hotKeyWindow.style.nonClient || !parent || !parent.nativeDecorations || (hotKeyWindow != parent.sysButtons[2] && hotKeyWindow != parent.sysButtons[1])))
continue;
if(prevActiveWindow) incref prevActiveWindow;
// Setup relationship with outside world (bb root || !bb)
if((!guiApp.fullScreenMode && parent == guiApp.desktop) || this == guiApp.desktop ||
- (_displayDriver && displayDriver != parent.displayDriver))
+ (_displayDriver && parent.dispDriver && dispDriver != parent.dispDriver))
{
rootWindow = this;
if(!tempExtents)
bool result = false;
Window child;
- if((!guiApp.fullScreenMode && parent == guiApp.desktop) || (guiApp.fullScreenMode && (this == guiApp.desktop || (_displayDriver && displayDriver != parent.displayDriver))))
+ if((!guiApp.fullScreenMode && parent == guiApp.desktop) || (guiApp.fullScreenMode && (this == guiApp.desktop || (_displayDriver && parent.dispDriver && dispDriver != parent.dispDriver))))
{
subclass(DisplayDriver) dDriver = (dispDriver && !formDesigner) ? dispDriver : GetDisplayDriver(guiApp.defaultDisplayDriver);
DisplaySystem displaySystem = dDriver ? dDriver.displaySystem : null;
delete display;
}
}
- guiApp.interfaceDriver.SetIcon(this, icon);
+ // Sometimes icon does not show up on Windows XP if we set here...
+ // guiApp.interfaceDriver.SetIcon(this, icon);
}
else if(this != guiApp.desktop)
{
Window child;
WindowState stateBackup = state;
- /*
- if(!rootWindow.created)
- printf("");
- */
-
if(((subclass(Window))_class).pureVTbl)
{
if(_vTbl == _class._vTbl)
}
*/
- captionFont = guiApp.currentSkin.CaptionFont();
+ captionFont = guiApp.currentSkin ? guiApp.currentSkin.CaptionFont() : null;
AddResource(captionFont);
if(OnLoadGraphics())
child.SetVisibility(visible);
Update(null);
ConsequentialMouseMove(false);
+ if(parent && !nonClient) parent.OnChildVisibilityToggled(this, visible);
}
}
return result;
}
- bool DestroyEx(int returnCode)
+ bool DestroyEx(int64 returnCode)
{
OldLink slave;
Timer timer, nextTimer;
if(master.defaultControl == this)
master.defaultControl = null;
}
+ if(parent)
+ parent.OnChildAddedOrRemoved(this, true);
if(parent && !parent.destroyed /*&&
rootWindow && rootWindow.display && !rootWindow.destroyed*/)
{
if(prevState != newState)
lastState = prevState;
- if(rootWindow != this || !nativeDecorations)
+ if(rootWindow != this || !nativeDecorations || !windowHandle)
{
if(style.isActiveClient && !style.hidden && prevState == minimized)
parent.numIcons--;
if(child.cycle && !child.style.nonClient && child.style.isActiveClient && child.visible)
{
DataRow row = listBox.AddRow();
- row.tag = (int)child;
+ row.tag = (int64)child;
child.FigureCaption(caption);
row.SetData(null, caption);
}
for(child = children.first; child; child = child.next)
{
- if(child.style.isDocument)
+ // TO CHECK: Do we want a documentID when we already have a file name?
+ if(child.style.isDocument && !child.fileName)
{
if(child.documentID-1 > size - 2)
{
(master && master != guiApp.desktop && !master.created))
return false;
+ if(parent)
+ stopwatching(parent, font);
+
if(!parent)
property::parent = guiApp.desktop;
if(!master) master = parent;
Window slave = link.data;
next = link.next;
if(!slave.created && (slave.autoCreate || slave.wasCreated))
- slave.Create();
+ {
+ if(slave.Create())
+ // Things might have happened that invalidated 'next'...
+ // Start over the search for slaves to create.
+ // (Added this to fix crash with Stacker & Toolbar)
+ next = slaves.first;
+ }
}
}
if(state == minimized) parent.numIcons--;
}
+ parent.OnChildAddedOrRemoved(this, false);
+
// Real set state & activate for proper display & activation
property::visible = visible;
// SetState(state & 0x00000003, true, 0);
+ guiApp.interfaceDriver.SetIcon(this, icon);
if(visible)
{
return result;
}
- bool Destroy(int code)
+ bool Destroy(int64 code)
{
//if(created)
if(this)
{
- if(!CloseConfirmation(false)) return false;
+ if(!destroyed && !CloseConfirmation(false)) return false;
incref this;
if(DestroyEx(code))
{
// TOCHECK: Should autoCreate be set to false here?
autoCreate = false;
wasCreated = false;
- // Is this needed here? DestroyEx should decref already...
delete this;
return true;
}
PopupMenu windowMenu { master = this, interim = true, position = { x + 1 - guiApp.desktop.position.x, y + 1 - guiApp.desktop.position.y }, menu = menu };
MenuItem
{
- menu, "Restore", r, NotifySelect = MenuWindowRestore,
+ menu, $"Restore", r, NotifySelect = MenuWindowRestore,
disabled = (!style.hasMaximize && !style.hasMinimize) || state == normal, bitmap = guiApp.currentSkin.GetBitmap(restore)
};
MenuItem
{
- menu, "Move", m, NotifySelect = MenuWindowMove,
+ menu, $"Move", m, NotifySelect = MenuWindowMove,
disabled = !style.fixed || state == maximized
};
MenuItem
{
- menu, "Size", s, NotifySelect = MenuWindowSize,
+ menu, $"Size", s, NotifySelect = MenuWindowSize,
disabled = !style.sizable || state != normal
};
MenuItem
{
- menu, "Minimize", n, NotifySelect = MenuWindowMinimize,
+ menu, $"Minimize", n, NotifySelect = MenuWindowMinimize,
disabled = !style.hasMinimize || state == minimized, bitmap = guiApp.currentSkin.GetBitmap(minimize)
};
MenuItem
{
- menu, "Maximize", KeyCode::x, NotifySelect = MenuWindowMaximize,
+ menu, $"Maximize", KeyCode::x, NotifySelect = MenuWindowMaximize,
disabled = !style.hasMaximize || state == maximized, bitmap = guiApp.currentSkin.GetBitmap(maximize)
};
MenuItem
{
- menu, "Stay On Top", t, NotifySelect = MenuWindowStayOnTop,
+ menu, $"Stay On Top", t, NotifySelect = MenuWindowStayOnTop,
disabled = !style.fixed, checkable = true, checked = style.stayOnTop
};
MenuDivider { menu };
MenuItem
{
- menu, "Close", c, (parent == guiApp.desktop) ? altF4 : ( style.isActiveClient ? ctrlF4 : 0), NotifySelect = MenuWindowClose,
+ menu, $"Close", c, (parent == guiApp.desktop) ? altF4 : ( style.isActiveClient ? ctrlF4 : 0), NotifySelect = MenuWindowClose,
bold = true, disabled = !style.hasClose, bitmap = guiApp.currentSkin.GetBitmap(close)
};
windowMenu.Create();
char caption[MAX_F_STRING];
va_list args;
va_start(args, format);
- vsprintf(caption, format, args);
+ vsnprintf(caption, sizeof(caption), format, args);
+ caption[sizeof(caption)-1] = 0;
va_end(args);
- this.caption = new char[strlen(caption)+1];
- if(this.caption)
- strcpy(this.caption, caption);
+ this.caption = CopyString(caption);
}
if(created)
UpdateCaption();
DialogResult dialogRes;
char message[1024];
if(fileName)
- sprintf(message, "Save changes to %s?", fileName);
+ sprintf(message, $"Save changes to %s?", fileName);
else
- sprintf(message, "Save changes to Untitled %d?", documentID);
+ sprintf(message, $"Save changes to Untitled %d?", documentID);
- dialogRes = MessageBox { master = master, type = yesNoCancel, text = parent.caption, contents = message }.Modal();
+ dialogRes = MessageBox { master = master, type = yesNoCancel, text = parent.caption ? parent.caption : rootWindow.caption, contents = message }.Modal();
if(dialogRes == yes)
{
if(result)
{
for(slave = slaves.first; slave; slave = slave.next)
- if(!((Window)slave.data).CloseConfirmation(true))
+ {
+ Window w = slave.data;
+ if((w.parent == this || !w.IsDescendantOf(this)) && !w.CloseConfirmation(true))
{
// ((Window)slave.data).CloseConfirmation(true);
result = false;
break;
}
+ }
}
if(result)
}
else
{
- MessageBox dialog { master = master, type = yesNoCancel, text = "Error writing file", contents = "Save as a different file?" };
+ MessageBox dialog { master = master, type = yesNoCancel, text = $"Error writing file", contents = $"Save as a different file?" };
DialogResult answer = dialog.Modal();
saving = false;
if(answer != yes) return (bool)answer;
fileMonitor.fileName = null;
fileDialog.type = save;
- fileDialog.text = "Save As";
+ fileDialog.text = $"Save As";
while(true)
{
}
else
{
- MessageBox dialog { master = master.parent ? master : this, type = yesNoCancel, text = "Error writing file", contents = "Save as a different file?" };
+ MessageBox dialog { master = master.parent ? master : this, type = yesNoCancel, text = $"Error writing file", contents = $"Save as a different file?" };
DialogResult answer = dialog.Modal();
saving = false;
if(answer != yes)
bool MenuWindowSelectWindow(MenuItem selection, Modifiers mods)
{
Window document;
- int id = selection.id;
+ int64 id = selection.id;
OldLink cycle = activeClient.cycle;
int c = 0;
//for(c = 0, cycle = activeChild.cycle; c<id; cycle = cycle.next, c++);
while(true)
{
Window sibling = cycle.data;
- if(sibling.style.isActiveClient)
+ if(sibling.style.isActiveClient && sibling.visible && !sibling.style.nonClient)
{
if(c == id)
break;
virtual bool OnFileModified(FileChange fileChange, char * param);
virtual bool OnSaveFile(char * fileName);
+ // Virtual Methods -- Children management (To support Stacker, for lack of built-in auto-layout)
+ // Note: A 'client' would refer to isActiveClient, rather than
+ // being confined to the 'client area' (nonClient == false)
+ virtual void OnChildAddedOrRemoved(Window child, bool removed);
+ virtual void OnChildVisibilityToggled(Window child, bool visible);
+ virtual void OnChildResized(Window child, int x, int y, int w, int h);
+
// Skins Virtual Functions
virtual void GetDecorationsSize(MinMaxValue * w, MinMaxValue * h);
virtual void SetWindowMinimum(MinMaxValue * mw, MinMaxValue * mh);
}
virtual void ShowDecorations(Font captionFont, Surface surface, char * name, bool active, bool moving);
virtual void PreShowDecorations(Font captionFont, Surface surface, char * name, bool active, bool moving);
- virtual bool IsMouseMoving(int x, int y, int w, int h);
- virtual bool IsMouseResizing(int x, int y, int w, int h, bool *resizeX, bool *resizeY, bool *resizeEndX, bool *resizeEndY);
+ virtual bool IsMouseMoving(int x, int y, int w, int h)
+ {
+ return false;
+ }
+ virtual bool IsMouseResizing(int x, int y, int w, int h, bool *resizeX, bool *resizeY, bool *resizeEndX, bool *resizeEndY)
+ {
+ return false;
+ }
virtual void UpdateNonClient();
virtual void SetBox(Box box);
virtual bool IsInside(int x, int y)
// Properties
property Window parent
{
- property_category "Layout"
+ property_category $"Layout"
set
{
if(value || guiApp.desktop)
parent.childrenOrder.Delete(order);
cycle = null;
order = null;
+ // *** TODO: Added this here to solve crash on setting parent to null before destroying/destructing ***
+ // Should something else be done?
+ if(parent && parent.activeChild == this)
+ parent.activeChild = null;
+ if(parent && parent.activeClient == this)
+ parent.activeClient = null;
//if(created)
{
else if(anchor.vert.type == middleRelative) anchor.vert.percent = (float)((y + h / 2) - (vph / 2)) / vph;
}
parent = value;
+ parent.OnChildAddedOrRemoved(this, false);
// *** NEW HERE ***
if(!style.inactive)
*/
}
scrolledPos.x = MININT; // Prevent parent update
- property::anchor = anchor;
+ {
+ bool anchored = this.anchored;
+ property::anchor = anchor;
+ this.anchored = anchored;
+ }
/*
{
int x, y, w, h;
}
// else parent = value;
+ if(oldParent)
+ oldParent.OnChildAddedOrRemoved(this, true);
}
}
get { return parent; }
property Window master
{
- property_category "Behavior"
+ property_category $"Behavior"
set
{
//if(this == value) return;
if(style.isDefault && !value.defaultControl)
value.defaultControl = this;
-
}
}
master = value;
get { return master ? master : parent; }
};
- property char * text
+ property char * caption
{
- property_category "Appearance"
+ property_category $"Appearance"
watchable
set
{
property Key hotKey
{
- property_category "Behavior"
+ property_category $"Behavior"
set
{
setHotKey = value;
property Color background
{
- property_category "Appearance"
+ property_category $"Appearance"
set
{
background.color = value;
property Percentage opacity
{
- property_category "Appearance"
+ property_category $"Appearance"
set
{
background.a = (byte)Min(Max((int)(value * 255), 0), 255);
- drawBehind = background.a ? false : true;
+ drawBehind = (background.a == 255) ? false : true;
}
get { return background.a / 255.0f; }
};
property Color foreground
{
- property_category "Appearance"
+ property_category $"Appearance"
set
{
foreground = value;
property BorderStyle borderStyle
{
- property_category "Appearance"
+ property_category $"Appearance"
set
{
if(!((BorderBits)value).fixed)
style.hasClose = false;
style.hasMaximize = false;
style.hasMinimize = false;
+ nativeDecorations = false;
}
style.borderBits = value;
if(created)
property Size minClientSize
{
- property_category "Layout"
+ property_category $"Layout"
set { minSize = value; }
get { value = minSize; }
};
property Size maxClientSize
{
- property_category "Layout"
+ property_category $"Layout"
set { maxSize = value; }
get { value = maxSize; }
};
property bool hasMaximize
{
- property_category "Window Style"
+ property_category $"Window Style"
set
{
style.hasMaximize = value;
property bool hasMinimize
{
- property_category "Window Style"
+ property_category $"Window Style"
set
{
style.hasMinimize = value;
property bool hasClose
{
- property_category "Window Style"
+ property_category $"Window Style"
set
{
style.hasClose = value;
property bool nonClient
{
- property_category "Layout"
+ property_category $"Layout"
set
{
style.nonClient = value;
property bool inactive
{
- property_category "Behavior"
+ property_category $"Behavior"
set
{
if(value)
property bool clickThrough
{
- property_category "Behavior"
+ property_category $"Behavior"
set { style.clickThrough = value; }
get { return style.clickThrough; }
};
property bool isRemote
{
- property_category "Behavior"
+ property_category $"Behavior"
set { style.isRemote = value; }
get { return style.isRemote; }
};
property bool noCycle
{
- property_category "Behavior"
+ property_category $"Behavior"
set { style.noCycle = value; }
get { return style.noCycle; }
};
property bool isModal
{
- property_category "Behavior"
+ property_category $"Behavior"
set { style.modal = value; }
get { return style.modal; }
};
property bool interim
{
- property_category "Behavior"
+ property_category $"Behavior"
set { style.interim = value; }
get { return style.interim; }
};
property bool tabCycle
{
- property_category "Behavior"
+ property_category $"Behavior"
set { style.tabCycle = value; }
get { return style.tabCycle; }
};
property bool isDefault
{
- property_category "Behavior"
+ property_category $"Behavior"
set
{
if(master)
property bool drawBehind
{
- property_category "Window Style"
+ property_category $"Window Style"
set { style.drawBehind = value; }
get { return style.drawBehind; }
};
property bool hasMenuBar
{
- property_category "Window Style"
+ property_category $"Window Style"
set
{
if(value)
property bool hasStatusBar
{
- property_category "Window Style"
+ property_category $"Window Style"
set
{
if(value)
};
property bool stayOnTop
{
- property_category "Window Style"
+ property_category $"Window Style"
set
{
if(value)
property Menu menu
{
- property_category "Window Style"
+ property_category $"Window Style"
set
{
delete menu;
property FontResource font
{
- property_category "Appearance"
+ property_category $"Appearance"
watchable
isset { return setFont ? true : false; }
set
property SizeAnchor sizeAnchor
{
- property_category "Layout"
+ property_category $"Layout"
isset
{
return ((anchor.left.type == none || anchor.left.type == middleRelative || anchor.right.type == none) ||
property Size size
{
- property_category "Layout"
+ property_category $"Layout"
isset
{
Anchor thisAnchor = anchor;
ComputeAnchors(stateAnchor, stateSizeAnchor, &x, &y, &w, &h);
Position(x, y, w, h, true, true, true, true, false, true);
+ if(parent && parent.created && !nonClient) parent.OnChildResized(this, x, y, w, h);
}
}
get { value = size; }
property Size clientSize
{
- property_category "Layout"
+ property_category $"Layout"
isset
{
return ((anchor.left.type == none || anchor.left.type == middleRelative || anchor.right.type == none) ||
property Anchor anchor
{
- property_category "Layout"
+ property_category $"Layout"
isset { return (anchor.left.type != offset || anchor.top.type != offset || anchor.right.type || anchor.bottom.type); }
set
property Point position
{
- property_category "Layout"
+ property_category $"Layout"
set
{
if(value == null) return;
property bool disabled
{
- property_category "Behavior"
+ property_category $"Behavior"
set
{
if(this && disabled != value)
property WindowState state
{
- property_category "Behavior"
+ property_category $"Behavior"
set { SetState(value, false, 0); }
get { return this ? state : 0; }
};
property bool visible
{
- property_category "Behavior"
+ property_category $"Behavior"
set
{
if(this && !value && !style.hidden && parent)
firewatchers;
}
- else
+ else if(this)
style.hidden = !value;
}
property bool isDocument
{
- property_category "Document"
+ property_category $"Document"
set { style.isDocument = value; }
get { return style.isDocument; }
};
property bool mergeMenus
{
- property_category "Window Style"
+ property_category $"Window Style"
set { mergeMenus = value; }
get { return (bool)mergeMenus; }
};
property bool hasHorzScroll
{
- property_category "Window Style"
+ property_category $"Window Style"
set
{
if(value)
property bool hasVertScroll
{
- property_category "Window Style"
+ property_category $"Window Style"
set
{
if(value)
property bool dontHideScroll
{
- property_category "Behavior"
+ property_category $"Behavior"
set
{
scrollFlags.dontHide = value;
property bool dontScrollVert
{
- property_category "Behavior"
+ property_category $"Behavior"
set { style.dontScrollVert = value; }
get { return style.dontScrollVert; }
};
property bool dontScrollHorz
{
- property_category "Behavior"
+ property_category $"Behavior"
set { style.dontScrollHorz = value; }
get { return style.dontScrollHorz; }
};
property bool snapVertScroll
{
- property_category "Behavior"
+ property_category $"Behavior"
set
{
scrollFlags.snapY = value;
};
property bool snapHorzScroll
{
- property_category "Behavior"
+ property_category $"Behavior"
set
{
scrollFlags.snapX = value;
property Point scroll
{
- property_category "Behavior"
- set
- {
- // scroll = value;
- // TESTING THIS IMPLEMENTATION:
- SetScrollPosition(value.x, value.y);
- }
+ property_category $"Behavior"
+ set { SetScrollPosition(value.x, value.y); }
get { value = scroll; }
};
property bool modifyVirtualArea
{
- property_category "Behavior"
+ property_category $"Behavior"
set { modifyVirtArea = value; }
get { return (bool)modifyVirtArea; }
};
+ property bool dontAutoScrollArea
+ {
+ property_category $"Behavior"
+ // Activating a child control out of view will automatically scroll to make it in view
+ set { noAutoScrollArea = value; }
+ get { return (bool)noAutoScrollArea; }
+ };
+
property char * fileName
{
- property_category "Document"
+ property_category $"Document"
set
{
if(menu && ((!fileName && value) || (fileName && !value)))
get { return fileName; }
};
- property int id
+ property int64 id
{
- property_category "Data"
+ property_category $"Data"
set { id = value; }
get { return id; }
};
property bool modifiedDocument
{
- property_category "Document"
+ property_category $"Document"
set
{
if(style.isDocument || fileName)
property bool showInTaskBar
{
- property_category "Window Style"
+ property_category $"Window Style"
set { style.showInTaskBar = value; }
get { return (style.showInTaskBar; }
};
property FileDialog saveDialog { set { saveDialog = value; } };
property bool isActiveClient
{
- property_category "Behavior"
+ property_category $"Behavior"
set { style.isActiveClient = value; }
get { return style.isActiveClient; }
};
property Cursor cursor
{
- property_category "Appearance"
+ property_category $"Appearance"
set
{
cursor = value;
//#if !defined(ECERE_VANILLA)
property char * name
{
- property_category "Design"
+ property_category $"Design"
get
{
return (this && object) ? object.name : null;
//#endif
property char * displayDriver
{
- property_category "Behavior"
+ property_category $"Behavior"
set
{
dispDriver = GetDisplayDriver(value);
property bool autoCreate { set { autoCreate = value; } get { return (bool)autoCreate; } };
property Size scrollArea
{
- property_category "Behavior"
+ property_category $"Behavior"
set
{
if(value != null)
};
property bool is3D
{
- property_category "Layout"
+ property_category $"Layout"
set { if(this) is3D = value; }
get { return (bool)is3D; }
};
property bool alphaBlend { get { return (bool)alphaBlend; } set { alphaBlend = value; } };
property bool useSharedMemory { get { return (bool)useSharedMemory; } set { useSharedMemory = value; } };
property CreationActivationOption creationActivation { get { return creationActivation; } set { creationActivation = value; } };
- property bool nativeDecorations { get { return (bool)nativeDecorations && (formDesigner || rootWindow == this); } set { nativeDecorations = value; } };
+ property bool nativeDecorations
+ {
+ get { return (bool)nativeDecorations; }
+ set { nativeDecorations = value; }
+#if !defined(ECERE_VANILLA) && !defined(ECERE_NOTRUETYPE)
+ isset
+ {
+ //return (nativeDecorations && (rootWindow == this || (formDesigner && activeDesigner && ((FormDesigner)activeDesigner.classDesigner).form && parent == ((FormDesigner)activeDesigner.classDesigner).form.parent))) != style.fixed;
+ bool result = false;
+ if(nativeDecorations)
+ {
+ if(rootWindow == this)
+ result = true;
+ else
+ {
+ if(formDesigner && activeDesigner)
+ {
+ FormDesigner cd = (FormDesigner)activeDesigner.classDesigner;
+ Window form = cd ? cd.form : null;
+ if(form && parent == form.parent)
+ result = true;
+ }
+ }
+ }
+ return result != style.fixed;
+ }
+#endif
+ };
property bool manageDisplay { get { return (bool)manageDisplay; } set { manageDisplay = value; } };
-
+
+ property char * text
+ {
+ property_category $"Deprecated"
+ watchable
+ set { property::caption = value; }
+ get { return property::caption; }
+ }
private:
// Data
//char * yo;
int numPositions;
Menu menu;
ScrollFlags scrollFlags;// Window Scrollbar Flags
- int id; // Control ID
+ int64 id; // Control ID
int documentID;
ColorAlpha background; // Background color used to draw the window area
Color foreground;
// Checks used internally for them not to take effect in FormDesigner
property bool _isModal { get { return !formDesigner ? style.modal : false; } }
- property bool _displayDriver { get { return !formDesigner ? displayDriver : null; } }
+ property subclass(DisplayDriver) _displayDriver { get { return !formDesigner ? dispDriver : null; } }
WindowController controller;
public property WindowController controller { get { return controller; } set { delete controller; controller = value; if(controller) incref controller; } }
public class CommonControl : Window
{
// creationActivation = doNothing;
+
+ ToolTip toolTip;
+ public property String toolTip
+ {
+ property_category $"Appearance"
+ set
+ {
+ if(created) CommonControl::OnDestroy();
+ delete toolTip;
+ toolTip = value ? ToolTip { tip = value; } : null;
+ incref toolTip;
+ if(created) CommonControl::OnCreate();
+ }
+ get { return toolTip ? toolTip.tip : null; }
+ }
+
+ void OnDestroy()
+ {
+ if(toolTip)
+ // (Very) Ugly work around for the fact that the parent watcher
+ // won't fire when it's already been disconnected...
+ eInstance_FireSelfWatchers(toolTip,
+ __ecereProp___ecereNameSpace__ecere__gui__Window_parent);
+ }
+
+ bool OnCreate()
+ {
+ if(toolTip)
+ toolTip.parent = this;
+ return true;
+ }
+ ~CommonControl()
+ {
+ delete toolTip;
+ }
};
public class Percentage : float
{
bool OnKeyDown(Key key, unichar ch)
{
- bool result = ((int(*)())(void *)controller.OnKeyDown)((void *)controller.controlled, (void *)controller, key, ch);
+ bool result = ((bool(*)(Window, WindowController, Key, unichar))(void *)controller.OnKeyDown)((Window)controller.controlled, controller, key, ch);
if(result)
- result = controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyDown](controller.window, key, ch);
+ result = ((bool (*)(Window, Key, unichar))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyDown])(controller.window, key, ch);
return result;
}
bool OnKeyUp(Key key, unichar ch)
{
- bool result = ((int(*)())(void *)controller.OnKeyUp)((void *)controller.controlled, (void *)controller, key, ch);
+ bool result = ((bool(*)(Window, WindowController, Key, unichar))(void *)controller.OnKeyUp)((Window)controller.controlled, controller, key, ch);
if(result)
- result = controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyUp](controller.window, key, ch);
+ result = ((bool(*)(Window, Key, unichar))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyUp])(controller.window, key, ch);
return result;
}
bool OnKeyHit(Key key, unichar ch)
{
- bool result = ((int(*)())(void *)controller.OnKeyHit)((void *)controller.controlled, (void *)controller, key, ch);
+ bool result = ((bool(*)(Window, WindowController, Key, unichar))(void *)controller.OnKeyHit)((Window)controller.controlled, controller, key, ch);
if(result)
- result = controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyHit](controller.window, key, ch);
+ result = ((bool(*)(Window, Key, unichar))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnKeyHit])(controller.window, key, ch);
return result;
}
bool OnMouseMove(int x, int y, Modifiers mods)
{
- bool result = ((int(*)())(void *)controller.OnMouseMove)((void *)controller.controlled, (void *)controller, x, y, mods);
+ bool result = ((bool(*)(Window, WindowController, int, int, Modifiers))(void *)controller.OnMouseMove)((Window)controller.controlled, controller, x, y, mods);
if(result)
- result = controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnMouseMove](controller.window, x, y, mods);
+ result = ((bool(*)(Window, int, int, Modifiers))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnMouseMove])(controller.window, x, y, mods);
return result;
}
bool OnLeftButtonDown(int x, int y, Modifiers mods)
{
- bool result = ((int(*)())(void *)controller.OnLeftButtonDown)((void *)controller.controlled, (void *)controller, x, y, mods);
+ bool result = ((bool(*)(Window, WindowController, int, int, Modifiers))(void *)controller.OnLeftButtonDown)((Window)controller.controlled, controller, x, y, mods);
if(result)
- result = controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftButtonDown](controller.window, x, y, mods);
+ result = ((bool(*)(Window, int, int, Modifiers))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftButtonDown])(controller.window, x, y, mods);
return result;
}
bool OnLeftButtonUp(int x, int y, Modifiers mods)
{
- bool result = ((int(*)())(void *)controller.OnLeftButtonUp)((void *)controller.controlled, (void *)controller, x, y, mods);
+ bool result = ((bool(*)(Window, WindowController, int, int, Modifiers))(void *)controller.OnLeftButtonUp)((Window)controller.controlled, controller, x, y, mods);
if(result)
- result = controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftButtonUp](controller.window, x, y, mods);
+ result = ((bool(*)(Window, int, int, Modifiers))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftButtonUp])(controller.window, x, y, mods);
return result;
}
bool OnLeftDoubleClick(int x, int y, Modifiers mods)
{
- bool result = ((int(*)())(void *)controller.OnLeftDoubleClick)((void *)controller.controlled, (void *)controller, x, y, mods);
+ bool result = ((bool(*)(Window, WindowController, int, int, Modifiers))(void *)controller.OnLeftDoubleClick)((Window)controller.controlled, controller, x, y, mods);
if(result)
- result = controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftDoubleClick](controller.window, x, y, mods);
+ result = ((bool(*)(Window, int, int, Modifiers))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftDoubleClick])(controller.window, x, y, mods);
return result;
}
bool OnRightButtonDown(int x, int y, Modifiers mods)
{
- bool result = ((int(*)())(void *)controller.OnRightButtonDown)((void *)controller.controlled, (void *)controller, x, y, mods);
+ bool result = ((bool(*)(Window, WindowController, int, int, Modifiers))(void *)controller.OnRightButtonDown)((Window)controller.controlled, controller, x, y, mods);
if(result)
- result = controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRightButtonDown](controller.window, x, y, mods);
+ result = ((bool(*)(Window, int, int, Modifiers))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRightButtonDown])(controller.window, x, y, mods);
return result;
}
bool OnRightButtonUp(int x, int y, Modifiers mods)
{
- bool result = ((int(*)())(void *)controller.OnRightButtonUp)((void *)controller.controlled, (void *)controller, x, y, mods);
+ bool result = ((bool(*)(Window, WindowController, int, int, Modifiers))(void *)controller.OnRightButtonUp)((Window)controller.controlled, controller, x, y, mods);
if(result)
- result = controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRightButtonUp](controller.window, x, y, mods);
+ result = ((bool(*)(Window, int, int, Modifiers))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRightButtonUp])(controller.window, x, y, mods);
return result;
}
bool OnRightDoubleClick(int x, int y, Modifiers mods)
{
- bool result = ((int(*)())(void *)controller.OnRightDoubleClick)((void *)controller.controlled, (void *)controller, x, y, mods);
+ bool result = ((bool(*)(Window, WindowController, int, int, Modifiers))(void *)controller.OnRightDoubleClick)((Window)controller.controlled, controller, x, y, mods);
if(result)
- result = controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRightDoubleClick](controller.window, x, y, mods);
+ result = ((bool(*)(Window, int, int, Modifiers))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRightDoubleClick])(controller.window, x, y, mods);
return result;
}
bool OnMiddleButtonDown(int x, int y, Modifiers mods)
{
- bool result = ((int(*)())(void *)controller.OnMiddleButtonDown)((void *)controller.controlled, (void *)controller, x, y, mods);
+ bool result = ((bool(*)(Window, WindowController, int, int, Modifiers))(void *)controller.OnMiddleButtonDown)((Window)controller.controlled, controller, x, y, mods);
if(result)
- result = controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnMiddleButtonDown](controller.window, x, y, mods);
+ result = ((bool(*)(Window, int, int, Modifiers))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnMiddleButtonDown])(controller.window, x, y, mods);
return result;
}
bool OnMiddleButtonUp(int x, int y, Modifiers mods)
{
- bool result = ((int(*)())(void *)controller.OnMiddleButtonUp)((void *)controller.controlled, (void *)controller, x, y, mods);
+ bool result = ((bool(*)(Window, WindowController, int, int, Modifiers))(void *)controller.OnMiddleButtonUp)((Window)controller.controlled, controller, x, y, mods);
if(result)
- result = controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnMiddleButtonUp](controller.window, x, y, mods);
+ result = ((bool(*)(Window, int, int, Modifiers))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnMiddleButtonUp])(controller.window, x, y, mods);
return result;
}
bool OnMiddleDoubleClick(int x, int y, Modifiers mods)
{
- bool result = ((int(*)())(void *)controller.OnMiddleDoubleClick)((void *)controller.controlled, (void *)controller, x, y, mods);
+ bool result = ((bool(*)(Window, WindowController, int, int, Modifiers))(void *)controller.OnMiddleDoubleClick)((Window)controller.controlled, controller, x, y, mods);
if(result)
- result = controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnMiddleDoubleClick](controller.window, x, y, mods);
+ result = ((bool(*)(Window, int, int, Modifiers))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnMiddleDoubleClick])(controller.window, x, y, mods);
return result;
}
void OnResize(int width, int height)
{
- ((int(*)())(void *)controller.OnResize)((void *)controller.controlled, (void *)controller, width, height);
- controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnResize](controller.window, width, height);
+ ((void(*)(Window, WindowController, int, int))(void *)controller.OnResize)((Window)controller.controlled, controller, width, height);
+ ((void(*)(Window, int, int))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnResize])(controller.window, width, height);
}
void OnRedraw(Surface surface)
{
- ((int(*)())(void *)controller.OnRedraw)((void *)controller.controlled, (void *)controller, surface);
- controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw](controller.window, surface);
+ ((void(*)(Window, WindowController, Surface))(void *)controller.OnRedraw)((Window)controller.controlled, controller, surface);
+ ((void(*)(Window, Surface))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnRedraw])(controller.window, surface);
}
bool OnCreate()
{
- bool result = ((int(*)())(void *)controller.OnCreate)((void *)controller.controlled, (void *)controller);
+ bool result = ((bool(*)(Window, WindowController))(void *)controller.OnCreate)((Window)controller.controlled, controller);
if(result)
- result = controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnCreate](controller.window);
+ result = ((bool(*)(Window))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnCreate])(controller.window);
return result;
}
+
+ bool OnLoadGraphics()
+ {
+ bool result = ((bool(*)(Window, WindowController))(void *)controller.OnLoadGraphics)((Window)controller.controlled, controller);
+ if(result)
+ result = ((bool(*)(Window))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLoadGraphics])(controller.window);
+ return result;
+ }
+
+ void OnUnloadGraphics()
+ {
+ ((void(*)(Window, WindowController))(void *)controller.OnUnloadGraphics)((Window)controller.controlled, controller);
+ ((void(*)(Window))(void *)controller.windowVTbl[__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnUnloadGraphics])(controller.window);
+ }
}
public class WindowController<class V>
virtual void V::OnResize(WindowController controller, int width, int height);
virtual void V::OnRedraw(WindowController controller, Surface surface);
virtual bool V::OnCreate(WindowController controller);
+ virtual bool V::OnLoadGraphics(WindowController controller);
+ virtual void V::OnUnloadGraphics(WindowController controller);
private:
int (** windowVTbl)();