Mercurial > projects > mde
comparison mde/gui/WidgetManager.d @ 86:79d816b3e2d2
New InitStage system, Screen & Screen.Drawable, separate testing and guiDemo binaries.
This (and the previous) commit are the result of several quite significant changes to mde. All the unittests run, but it hasn't had a huge amount of testing so don't be surprised if bugs show up.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 12 Sep 2008 17:36:14 +0100 |
parents | 56c0ddd90193 |
children | b525ff28774b |
comparison
equal
deleted
inserted
replaced
85:56c0ddd90193 | 86:79d816b3e2d2 |
---|---|
48 * Currently mouse coordinates are passed to widgets untranslated. It may make sense to translate | 48 * Currently mouse coordinates are passed to widgets untranslated. It may make sense to translate |
49 * them and possibly drop events for some uses, such as if the gui is drawn to a texture. | 49 * them and possibly drop events for some uses, such as if the gui is drawn to a texture. |
50 * | 50 * |
51 * Aside from the IWidgetManager methods, this class should be thread-safe. | 51 * Aside from the IWidgetManager methods, this class should be thread-safe. |
52 *************************************************************************************************/ | 52 *************************************************************************************************/ |
53 class WidgetManager : WidgetLoader, Screen.Drawable { | 53 class WidgetManager : WidgetLoader, Screen.IDrawable { |
54 /** Construct a new widget manager. | 54 /** Construct a new widget manager. |
55 * | 55 * |
56 * params: | 56 * params: |
57 * fileName = Name of file specifying the gui, excluding path and extension. | 57 * fileName = Name of file specifying the gui, excluding path and extension. |
58 */ | 58 */ |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 /** Draw the gui. */ | 75 /** Draw the gui. */ |
76 void draw() { | 76 void draw() { |
77 debug logger.trace ("drawing; w,h = {},{}",w,h); | |
78 synchronized(mutex) | 77 synchronized(mutex) |
79 if (child) | 78 if (child) |
80 child.draw; | 79 child.draw; |
81 } | 80 } |
82 | 81 |
115 foreach (dg; motionCallbacks) | 114 foreach (dg; motionCallbacks) |
116 dg (cast(wdabs)cx, cast(wdabs)cy); | 115 dg (cast(wdabs)cx, cast(wdabs)cy); |
117 } | 116 } |
118 | 117 |
119 | 118 |
120 void sizeEvent (int nw, int nh) { // Drawable function | 119 void sizeEvent (int nw, int nh) { // IDrawable function |
121 mutex.lock; | 120 mutex.lock; |
122 scope(exit) mutex.unlock; | 121 scope(exit) mutex.unlock; |
123 | 122 |
124 w = cast(wdim) nw; | 123 w = cast(wdim) nw; |
125 h = cast(wdim) nh; | 124 h = cast(wdim) nh; |