Mercurial > projects > mde
comparison mde/gui/widget/Ifaces.d @ 99:5de5810e3516
Implemented an editable TextContent widget; it's now possible to edit text options using the GUI.
The widget supports moving the text entry-point using arrows and home/end, but there's no visual indicator or edit-point setting using the mouse.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 14 Nov 2008 12:44:32 +0000 |
parents | dbf332403c6e |
children | 42e241e7be3e |
comparison
equal
deleted
inserted
replaced
98:49e7cfed4b34 | 99:5de5810e3516 |
---|---|
100 void addClickCallback (bool delegate (wdabs cx, wdabs cy, ubyte b, bool state) dg); | 100 void addClickCallback (bool delegate (wdabs cx, wdabs cy, ubyte b, bool state) dg); |
101 | 101 |
102 /** Add a mouse motion callback: delegate will be called for all motion events recieved by the | 102 /** Add a mouse motion callback: delegate will be called for all motion events recieved by the |
103 * gui. */ | 103 * gui. */ |
104 void addMotionCallback (void delegate (wdabs cx, wdabs cy) dg); | 104 void addMotionCallback (void delegate (wdabs cx, wdabs cy) dg); |
105 | |
106 // FIXME: keyboard callback (letter only, for text input? Also used for setting keybindings though...) | |
107 | 105 |
108 /** Remove all event callbacks on this widget (according to the delegate's .ptr). */ | 106 /** Remove all event callbacks on this widget (according to the delegate's .ptr). */ |
109 // Note: don't try to pass a reference and cast to void* in the function; it's a different address. | 107 // Note: don't try to pass a reference and cast to void* in the function; it's a different address. |
110 void removeCallbacks (void* frame); | 108 void removeCallbacks (void* frame); |
111 } | 109 } |
234 * (x,y). | 232 * (x,y). |
235 * | 233 * |
236 * Note: use global coordinates (x,y) not coordinates relative to the widget. */ | 234 * Note: use global coordinates (x,y) not coordinates relative to the widget. */ |
237 IChildWidget getWidget (wdim x, wdim y); | 235 IChildWidget getWidget (wdim x, wdim y); |
238 | 236 |
239 /** Receive a mouse click event. | 237 /** Receive a mouse click event at cx,cy from button b (1-5 correspond to L,M,B, wheel up,down) |
240 * | 238 * which is a down-click if state is true. |
241 * See mde.input.input.Input.MouseClickCallback for parameters. However, cx and cy are adjusted | 239 * |
242 * to the Widget's local coordinates. | 240 * Widget may assume coordinates are on the widget (caller must check). |
243 * | 241 * |
244 * Widget may assume coordinates are on the widget (caller must check). */ | 242 * The return value has the following flags: 1 to request keyboard input. */ |
245 void clickEvent (wdabs cx, wdabs cy, ubyte b, bool state); | 243 int clickEvent (wdabs cx, wdabs cy, ubyte b, bool state); |
244 | |
245 /** Receives keyboard events when requested. | |
246 * | |
247 * Params: | |
248 * sym SDLKey key sym, useful for keys with no character code such as arrow keys | |
249 * letter The character input, in UTF-8 */ | |
250 void keyEvent (ushort sym, char[] letter); | |
251 | |
252 /** Called when keyboard input focus is lost. */ | |
253 void keyFocusLost (); | |
246 //END Events | 254 //END Events |
247 | 255 |
248 /** Draw, using the stored values of x and y. | 256 /** Draw, using the stored values of x and y. |
249 * | 257 * |
250 * Maybe later enforce clipping of all sub-widget drawing, particularly for cases where only | 258 * Maybe later enforce clipping of all sub-widget drawing, particularly for cases where only |