Mercurial > projects > mde
diff mde/gui/widget/miscWidgets.d @ 75:25cb7420dc91
A massive overhaul/rewrite for the gui's data management and setup code. Currently much that was working is broken.
imde's classes are created in a static this instead of mde's main.
gl setup code moved from gl/basic.d to gl/draw.d
mergetag.DefaultData: now HIGH_LOW priority instead of LOW_HIGH. Reduced type list to only used types; small fix for indent function.
setup.paths: new NoFileException thrown instead of MTFileIOException
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Mon, 28 Jul 2008 18:17:48 +0100 |
parents | 672b6b162a36 |
children | 65780e0e48e6 |
line wrap: on
line diff
--- a/mde/gui/widget/miscWidgets.d Mon Jul 07 15:54:47 2008 +0100 +++ b/mde/gui/widget/miscWidgets.d Mon Jul 28 18:17:48 2008 +0100 @@ -26,30 +26,30 @@ /// A fixed-size blank widget. class FixedBlankWidget : FixedWidget { - this (IWindow wind, int[] data) { - if (data.length != 3) throw new WidgetDataException; - super (wind, data); + this (IWidgetManager mgr, WidgetData data) { + if (data.ints.length != 3) throw new WidgetDataException; + super (mgr, data); } void draw () { super.draw; - window.renderer.drawBlank (x,y, w,h); + mgr.renderer.drawBlank (x,y, w,h); } } /// A completely resizable blank widget (initial size zero). class SizableBlankWidget : SizableWidget { - this (IWindow wind, int[] data) { - if (data.length != 1) throw new WidgetDataException; - super (wind, data); + this (IWidgetManager mgr, WidgetData data) { + if (data.ints.length != 1) throw new WidgetDataException; + super (mgr, data); } void draw () { super.draw; - window.renderer.drawBlank (x,y, w,h); + mgr.renderer.drawBlank (x,y, w,h); } } @@ -60,21 +60,21 @@ // pushed is not the same as the button being clicked but not yet released. // it is whether the mouse is over the button after being clicked. - this (IWindow wind, int[] data) { - if (data.length != 3) throw new WidgetDataException; - super (wind, data); + this (IWidgetManager mgr, WidgetData data) { + if (data.ints.length != 3) throw new WidgetDataException; + super (mgr, data); } void draw () { - window.renderer.drawButton (x,y, w,h, pushed); + mgr.renderer.drawButton (x,y, w,h, pushed); } void clickEvent (wdabs, wdabs, ubyte b, bool state) { if (b == 1 && state == true) { pushed = true; - window.requestRedraw; - window.gui.addClickCallback (&clickWhileHeld); - window.gui.addMotionCallback (&motionWhileHeld); + mgr.requestRedraw; + mgr.addClickCallback (&clickWhileHeld); + mgr.addMotionCallback (&motionWhileHeld); } } // Called when a mouse motion/click event occurs while (held == true) @@ -84,8 +84,8 @@ Stdout ("Button clicked!").newline; pushed = false; - window.requestRedraw; - window.gui.removeCallbacks (cast(void*) this); + mgr.requestRedraw; + mgr.removeCallbacks (this); return true; } @@ -96,6 +96,6 @@ if (cx >= x && cx < x+w && cy >= y && cy < y+h) pushed = true; else pushed = false; if (oldPushed != pushed) - window.requestRedraw; + mgr.requestRedraw; } }