Mercurial > projects > mde
diff mde/gui/widget/Widget.d @ 114:b16a534f5302
Changes for tango r4201. Added override keyword in a lot of places.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 19 Dec 2008 15:15:06 +0000 |
parents | 9824bee909fd |
children | 1b1e2297e2fc |
line wrap: on
line diff
--- a/mde/gui/widget/Widget.d Fri Dec 19 10:32:28 2008 +0000 +++ b/mde/gui/widget/Widget.d Fri Dec 19 15:15:06 2008 +0000 @@ -55,59 +55,54 @@ } // Widgets need to do their initialization either in this() or setup(). - bool setup (uint,uint) { + override bool setup (uint,uint) { return false; } // Don't save any data: fine for many widgets. - bool saveChanges () { + override bool saveChanges () { return false; } //END Load and save //BEGIN Size and position - bool isWSizable () { return false; } - bool isHSizable () { return false; } + override bool isWSizable () { return false; } + override bool isHSizable () { return false; } /* Return minimal/fixed size. */ - wdim minWidth () { + override wdim minWidth () { return mw; } - wdim minHeight () { + override wdim minHeight () { return mh; } - wdim width () { + override wdim width () { return w; } - wdim height() { + override wdim height() { return h; } - wdabs xPos () { + override wdabs xPos () { return x; } - wdabs yPos () { + override wdabs yPos () { return y; } - deprecated void getCurrentSize (out wdim cw, out wdim ch) { - cw = w; - ch = h; - } - /* Set size: minimal size is (mw,mh). Note that both resizable and fixed widgets should allow * enlarging, so in both cases this is a correct implementation. */ - void setWidth (wdim nw, int) { + override void setWidth (wdim nw, int) { debug if (nw < mw) logger.warn ("Widget width set below minimal size"); w = (nw >= mw ? nw : mw); } - void setHeight (wdim nh, int) { + override void setHeight (wdim nh, int) { debug if (nh < mh) logger.warn ("Widget height set below minimal size"); h = (nh >= mh ? nh : mh); } - void setPosition (wdim nx, wdim ny) { + override void setPosition (wdim nx, wdim ny) { x = nx; y = ny; } @@ -116,29 +111,29 @@ //BEGIN Events /* This method is only called when the location is over this widget; hence for all widgets * without children this method is valid. */ - IChildWidget getWidget (wdim cx, wdim cy) { + override IChildWidget getWidget (wdim cx, wdim cy) { debug assert (cx >= x && cx < x + w && cy >= y && cy < y + h, "getWidget: not on widget (code error)"); return this; } /* Dummy event method (suitable for all widgets which don't respond to events). */ - int clickEvent (wdabs cx, wdabs cy, ubyte b, bool state) { + override int clickEvent (wdabs cx, wdabs cy, ubyte b, bool state) { return 0; } /* Dummy functions: suitable for widgets with no text input. */ - void keyEvent (ushort, char[]) {} - void keyFocusLost () {} + override void keyEvent (ushort, char[]) {} + override void keyFocusLost () {} // Currently only applies to popup widgets. - void highlight (bool state) {} + override void highlight (bool state) {} // Only useful to widgets creating popups. - void popupRemoved () {} + override void popupRemoved () {} //END Events /* Basic draw method: draw the background (all widgets should do this). */ - void draw () { + override void draw () { mgr.renderer.drawWidgetBack (x,y, w,h); } @@ -200,7 +195,7 @@ super (mgr, id, data); } - bool setup (uint n, uint flags) { + override bool setup (uint n, uint flags) { bool c = false; foreach (w; subWidgets) { debug assert (w); @@ -209,7 +204,7 @@ return c; } - bool saveChanges () { + override bool saveChanges () { bool c = false; foreach (w; subWidgets) c |= w.saveChanges; @@ -226,12 +221,12 @@ super (mgr, id, data); } - bool setup (uint n, uint flags) { + override bool setup (uint n, uint flags) { debug assert (subWidget); return subWidget.setup (n,flags); } - bool saveChanges () { + override bool saveChanges () { return subWidget.saveChanges; } @@ -262,8 +257,8 @@ super (mgr, id, data); } - bool isWSizable () { return true; } - bool isHSizable () { return true; } + override bool isWSizable () { return true; } + override bool isHSizable () { return true; } } /** For pressable buttons. @@ -276,12 +271,12 @@ } /// May be over-ridden. Pushed is true if the button has been pushed and not released. - void draw () { + override void draw () { mgr.renderer.drawButton (x,y, w,h, pushed); } /// Handles the down-click - int clickEvent (wdabs, wdabs, ubyte b, bool state) { + override int clickEvent (wdabs, wdabs, ubyte b, bool state) { if (b == 1 && state == true) { pushed = true; mgr.requestRedraw;