diff 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
line wrap: on
line diff
--- a/mde/gui/widget/Ifaces.d	Wed Nov 12 13:18:51 2008 +0000
+++ b/mde/gui/widget/Ifaces.d	Fri Nov 14 12:44:32 2008 +0000
@@ -103,8 +103,6 @@
      * gui. */
     void addMotionCallback (void delegate (wdabs cx, wdabs cy) dg);
     
-    // FIXME: keyboard callback (letter only, for text input? Also used for setting keybindings though...)
-    
     /** Remove all event callbacks on this widget (according to the delegate's .ptr). */
     // Note: don't try to pass a reference and cast to void* in the function; it's a different address.
     void removeCallbacks (void* frame);
@@ -236,13 +234,23 @@
      * Note: use global coordinates (x,y) not coordinates relative to the widget. */
     IChildWidget getWidget (wdim x, wdim y);
     
-    /** Receive a mouse click event.
+    /** Receive a mouse click event at cx,cy from button b (1-5 correspond to L,M,B, wheel up,down)
+     * which is a down-click if state is true.
+     *
+     * Widget may assume coordinates are on the widget (caller must check).
      *
-     * See mde.input.input.Input.MouseClickCallback for parameters. However, cx and cy are adjusted
-     * to the Widget's local coordinates.
+     * The return value has the following flags: 1 to request keyboard input. */
+    int clickEvent (wdabs cx, wdabs cy, ubyte b, bool state);
+    
+    /** Receives keyboard events when requested.
      *
-     * Widget may assume coordinates are on the widget (caller must check). */
-    void clickEvent (wdabs cx, wdabs cy, ubyte b, bool state);
+     * Params:
+     *	sym	SDLKey key sym, useful for keys with no character code such as arrow keys
+     *	letter	The character input, in UTF-8 */
+    void keyEvent (ushort sym, char[] letter);
+    
+    /** Called when keyboard input focus is lost. */
+    void keyFocusLost ();
 //END Events
     
     /** Draw, using the stored values of x and y.