Mercurial > projects > mde
comparison mde/gui/WMScreen.d @ 132:264028f4115a
Cleaned up mde.imde and a couple of widget functions.
New mde.menus module to add default menus.
The input singleton is now created in mde.input.Input instead of mde.imde.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 23 Jan 2009 14:59:05 +0000 |
parents | 9cff74f68b84 |
children | 783969f4665c |
comparison
equal
deleted
inserted
replaced
131:9cff74f68b84 | 132:264028f4115a |
---|---|
24 import mde.gui.WidgetManager; | 24 import mde.gui.WidgetManager; |
25 import mde.gui.widget.Ifaces; | 25 import mde.gui.widget.Ifaces; |
26 import mde.gui.renderer.createRenderer; | 26 import mde.gui.renderer.createRenderer; |
27 | 27 |
28 import mde.setup.Screen; | 28 import mde.setup.Screen; |
29 import mde.input.Input; | |
29 | 30 |
30 import tango.util.log.Log : Log, Logger; | 31 import tango.util.log.Log : Log, Logger; |
31 | 32 |
32 private Logger logger; | 33 private Logger logger; |
33 static this () { | 34 static this () { |
59 // Doesn't need a lock - cannot conflict with other class functions. | 60 // Doesn't need a lock - cannot conflict with other class functions. |
60 super(file); | 61 super(file); |
61 | 62 |
62 Screen.addDrawable (this); | 63 Screen.addDrawable (this); |
63 // Events we want to know about: | 64 // Events we want to know about: |
64 imde.input.addMouseClickCallback(&clickEvent); | 65 input = Input.singleton; |
65 imde.input.addMouseMotionCallback(&motionEvent); | 66 input.addMouseClickCallback(&clickEvent) |
67 .addMouseMotionCallback(&motionEvent); | |
66 } | 68 } |
67 | 69 |
68 /** Draw the gui. */ | 70 /** Draw the gui. */ |
69 void draw() { | 71 void draw() { |
70 synchronized(mutex) { | 72 synchronized(mutex) { |
96 | 98 |
97 // Disable keyboard input if on another widget: | 99 // Disable keyboard input if on another widget: |
98 if (keyFocus && keyFocus !is underMouse) { | 100 if (keyFocus && keyFocus !is underMouse) { |
99 keyFocus.keyFocusLost; | 101 keyFocus.keyFocusLost; |
100 keyFocus = null; | 102 keyFocus = null; |
101 imde.input.setLetterCallback (null); | 103 input.setLetterCallback (null); |
102 } | 104 } |
103 // Finally, post the actual event: | 105 // Finally, post the actual event: |
104 if (underMouse.clickEvent (cast(wdabs)cx,cast(wdabs)cy,b,state) & 1) { | 106 if (underMouse.clickEvent (cast(wdabs)cx,cast(wdabs)cy,b,state) & 1) { |
105 // keyboard input requested | 107 // keyboard input requested |
106 keyFocus = underMouse; | 108 keyFocus = underMouse; |
107 imde.input.setLetterCallback (&underMouse.keyEvent); | 109 input.setLetterCallback (&underMouse.keyEvent); |
108 } | 110 } |
109 } | 111 } |
110 | 112 |
111 /** For mouse motion events. | 113 /** For mouse motion events. |
112 * | 114 * |
179 | 181 |
180 final override void preSave () { | 182 final override void preSave () { |
181 if (keyFocus) { | 183 if (keyFocus) { |
182 keyFocus.keyFocusLost; | 184 keyFocus.keyFocusLost; |
183 keyFocus = null; | 185 keyFocus = null; |
184 imde.input.setLetterCallback (null); | 186 input.setLetterCallback (null); |
185 } | 187 } |
186 } | 188 } |
189 | |
190 Input input; // input singleton | |
187 } | 191 } |