Changeset 76:65780e0e48e6

Show
Ignore:
Timestamp:
07/28/08 13:49:18 (6 months ago)
Author:
Diggory Hardy <diggory.hardy@gmail.com>
branch:
default
Message:

Re-enabled click event passing in the gui to make ButtonWidget? work.

Bugfix (pass void* not class reference).
Change to allow compilation with dmd 1.027 (don't use DefaultData?'s Arg!() template).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • mde/font/font.d

    r74 r76  
    107107                 
    108108                // get fallback name 
    109                 char[]* p = "fallback" in reader.dataset.header.Arg!(char[])
     109                char[]* p = "fallback" in reader.dataset.header._charA
    110110                if (p is null) 
    111111                    throw new fontException ("No fallback font style specified"); 
  • mde/gui/WidgetData.d

    r75 r76  
    9393            // Read from the HEADER: 
    9494            // Get the renderer 
    95             char[]* p = "Renderer" in reader.dataset.header.Arg!(char[])
     95            char[]* p = "Renderer" in reader.dataset.header._charA
    9696            if (p is null || *p is null) { 
    9797                logger.warn ("No renderer specified: using \"Simple\""); 
     
    102102             
    103103            // Get which section to use 
    104             p = "Design" in reader.dataset.header.Arg!(char[])
     104            p = "Design" in reader.dataset.header._charA
    105105            if (p is null || *p is null) { 
    106106                logger.warn ("No gui design specified: trying \"Default\""); 
  • mde/gui/WidgetManager.d

    r75 r76  
    9191            if (dg (cast(wdabs)cx, cast(wdabs)cy, b, state)) return; 
    9292         
    93         /+ 
     93        // NOTE: do we need to test if the click was on the gui (and thus child)? 
     94        IChildWidget widg = child.getWidget (cast(wdabs)cx,cast(wdabs)cy); 
     95        if (widg !is null) 
     96            widg.clickEvent (cast(wdabs)cx,cast(wdabs)cy,b,state); 
     97        /+ FIXME: remove 
    9498        foreach (i,w; windows) { 
    9599            IWidget widg = w.getWidget (cast(wdabs)cx,cast(wdabs)cy); 
     
    151155        motionCallbacks[dg.ptr] = dg; 
    152156    } 
    153     void removeCallbacks (IChildWidget frame) { 
    154         clickCallbacks.remove(cast(void*) frame); 
    155         motionCallbacks.remove(cast(void*) frame); 
     157    void removeCallbacks (void* frame) { 
     158        clickCallbacks.remove(frame); 
     159        motionCallbacks.remove(frame); 
    156160    } 
    157161    //END IWidgetManager methods 
  • mde/gui/widget/Ifaces.d

    r75 r76  
    109109     
    110110    // User input: 
    111     /** Add a mouse click callback: delegate will be called for all mouse click events recieved. 
     111    /** Add a mouse click callback. 
     112     *  
     113     * This is a delegate this will be called for all mouse click events recieved by the gui, not 
     114     * simply all click events on the widget (as clickEvent recieves). 
    112115     * 
    113116     * The delegate should return true if it accepts the event and no further processing is 
     
    118121    void addClickCallback (bool delegate (wdabs cx, wdabs cy, ubyte b, bool state) dg); 
    119122     
    120     /** Add a mouse motion callback: delegate will be called for all motion events recieved. */ 
     123    /** Add a mouse motion callback: delegate will be called for all motion events recieved by the 
     124     * gui. */ 
    121125    void addMotionCallback (void delegate (wdabs cx, wdabs cy) dg); 
    122126     
     
    124128     
    125129    /** Remove all event callbacks on this widget (according to the delegate's .ptr). */ 
    126     void removeCallbacks (IChildWidget frame); 
     130    // Note: don't try to pass a reference and cast to void* in the function; it's a different address. 
     131    void removeCallbacks (void* frame); 
    127132} 
    128133 
     
    237242     * 
    238243     * Note: use global coordinates (x,y) not coordinates relative to the widget. */ 
    239     IWidget getWidget (wdim x, wdim y); 
     244    IChildWidget getWidget (wdim x, wdim y); 
    240245     
    241246    /** Receive a mouse click event. 
  • mde/gui/widget/Widget.d

    r75 r76  
    7878    /* This method is only called when the location is over this widget; hence for all widgets 
    7979     * without children this method is valid. */ 
    80     IWidget getWidget (wdim,wdim) { 
     80    IChildWidget getWidget (wdim,wdim) { 
    8181        return this; 
    8282    } 
  • mde/gui/widget/miscWidgets.d

    r75 r76  
    8686            pushed = false; 
    8787            mgr.requestRedraw; 
    88             mgr.removeCallbacks (this); 
     88            mgr.removeCallbacks (cast(void*) this); 
    8989             
    9090            return true;