int margin; margin = 2;
Point offset; offset = { 0, 20 };
- public property String tip
+ public property const String tip
{
set
{
tip = CopyString(value);
next = tip[0];
- for(c = 0; ch = next; c++)
+ for(c = 0; (ch = next); c++)
{
next = tip[c+1];
if(ch == '\n' || next == '\0')
timer.Stop();
position =
{
- pos.x + offset.x + tippedWindow.clientStart.x +
+ pos.x + offset.x + tippedWindow.clientStart.x +
tippedWindow.absPosition.x - parent.position.x;
- pos.y + offset.y + tippedWindow.clientStart.y +
+ pos.y + offset.y + tippedWindow.clientStart.y +
tippedWindow.absPosition.y - parent.position.y;
};
Create();
ToolTip ::Find(Window window)
{
Window w;
- for(w = window.firstSlave; w; w = w.next)
+ for(w = window.firstSlave; w; w = w.nextSlave)
{
if(eClass_IsDerived(w._class, class(ToolTip)))
break;
toolTip.closeTimer.Stop();
if(!mods.isSideEffect && !toolTip.created && rootWindow.active)
toolTip.timer.Start();
- return toolTip.OrigOnMouseOver(this, x, y, mods);
+ return toolTip.OrigOnMouseOver ? toolTip.OrigOnMouseOver(this, x, y, mods) : true;
}
return true;
}
{
toolTip.timer.Stop();
toolTip.closeTimer.Start();
- return toolTip.OrigOnMouseLeave(this, mods);
+ return toolTip.OrigOnMouseLeave ? toolTip.OrigOnMouseLeave(this, mods) : true;
}
return true;
}
{
toolTip.timer.Stop();
toolTip.Destroy(0);
- return toolTip.OrigOnLeftButtonDown(this, x, y, mods);
+ return toolTip.OrigOnLeftButtonDown ? toolTip.OrigOnLeftButtonDown(this, x, y, mods) : true;
}
return true;
}
toolTip.timer.Stop();
toolTip.timer.Start();
}
- return toolTip.OrigOnMouseMove(this, x, y, mods);
+ return toolTip.OrigOnMouseMove ? toolTip.OrigOnMouseMove(this, x, y, mods) : true;
}
return true;
}
}
}
}
+
+// NOTE: I'm putting this here for now because I don't have time to update all the makefiles right now
+import "Stacker"
+
+public class ToolBar : Stacker
+{
+ direction = horizontal;
+ background = formColor;
+ gap = 0;
+ inactive = true;
+
+ anchor = Anchor { left = 0, right = 0 };
+ clientSize = { h = 32 };
+ borderStyle = bevel;
+
+ watch(master)
+ {
+ Window w;
+ for(w = firstChild; w; w = w.next)
+ w.master = master;
+ };
+}
+
+public class ToolButton : Button
+{
+ bevelOver = true;
+ size = Size { 24, 24 };
+ opacity = 0;
+ bitmapAlignment = center;
+ MenuItem * menuItemPtr;
+
+ watch(master)
+ {
+ if(menuItemPtr)
+ {
+ Window master = this.master;
+ if(master && master.parent && !eClass_IsDerived(master._class, class(Stacker)))
+ {
+ MenuItem menuItem = this.menuItem;
+ BitmapResource bmp;
+
+ if(menuItem && (bmp = menuItem.bitmap))
+ {
+ //bitmap = bmp;
+ // We cannot reuse the same BitmapResource object here, as a BitmapResource is meant to be added with AddResource to a single Window
+ bitmap = { fileName = bmp.fileName, grayed = bmp.grayed, monochrome = bmp.monochrome, transparent = bmp.transparent, alphaBlend = bmp.alphaBlend, keepData = bmp.keepData };
+ }
+ }
+ }
+ };
+
+ NotifyClicked = SelectMenuItem;
+
+ bool Window::SelectMenuItem(Button button, int x, int y, Modifiers mods)
+ {
+ ToolButton toolButton = (ToolButton)button;
+ MenuItem menuItem = toolButton.menuItem;
+ return menuItem ? menuItem.NotifySelect(this, menuItem, 0) : 0;
+ }
+
+public:
+ property MenuItem * menuItemPtr { set { menuItemPtr = value; } }
+ property MenuItem menuItem
+ {
+ get
+ {
+ MenuItem menuItem = menuItemPtr ? *(MenuItem *)((byte *)master + (uintptr)menuItemPtr) : null;
+ return menuItem;
+ }
+ }
+}
+
+public class ToolSeparator : Window
+{
+ size = Size { 4, 24 };
+ opacity = 0;
+
+ void OnRedraw(Surface surface)
+ {
+ surface.foreground = Color { 85, 85, 85 };
+ surface.VLine(0, 23, 1);
+ surface.foreground = white;
+ surface.VLine(0, 23, 2);
+ }
+}