diff mde/gui/widget/Widget.d @ 36:57d000574d75

Enabled drawing on demand, and made the polling interval configurable. Renamed mde.global to mde.imde. Enabled drawing on demand. Allowed options to take double values. Made the main loop's polling interval (sleep duration) settable from config files. committer: Diggory Hardy <diggory.hardy@gmail.com>
author Diggory Hardy <diggory.hardy@gmail.com>
date Fri, 02 May 2008 17:38:43 +0100
parents 6b4116e6355c
children 052df9b2fe07
line wrap: on
line diff
--- a/mde/gui/widget/Widget.d	Fri May 02 16:20:35 2008 +0100
+++ b/mde/gui/widget/Widget.d	Fri May 02 17:38:43 2008 +0100
@@ -114,6 +114,7 @@
     void clickEvent (ushort, ushort, ubyte b, bool state) {
         if (b == 1 && state == true) {
             pushed = true;
+            window.gui.requestRedraw;
             window.gui.addClickCallback (&clickWhileHeld);
             window.gui.addMotionCallback (&motionWhileHeld);
         }
@@ -124,11 +125,15 @@
             Stdout ("Button clicked!").newline;
         
         pushed = false;
+        window.gui.requestRedraw;
         window.gui.removeCallbacks (cast(void*) this);
     }
     void motionWhileHeld (ushort cx, ushort cy) {
+        bool oldPushed = pushed;
         if (cx >= x && cx < x+w && cy >= y && cy < y+h) pushed = true;
         else pushed = false;
+        if (oldPushed != pushed)
+            window.gui.requestRedraw;
     }
 }
 //END Widgets