Changeset 51 for trunk/luigi/gui.d

Show
Ignore:
Timestamp:
04/28/07 17:09:55 (2 years ago)
Author:
baxissimo
Message:

Various small fixes and improvements.
event.d: added is_left_press et al properties (I found myselft getting confused as to whether 'left_down' mean it was a left down event or just that left was generally down. Maybe that should become left_is_down...

gui.d: made mixins refer to fully qualified names. Fixes problems with mixing-in in a different context.

theme stuff: Fixed dxut to not crash when presented with an unknown subclass.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/luigi/gui.d

    r50 r51  
    267267template WidgetMixin() 
    268268{ 
    269     alias typeof(this) T; 
    270     static assert(is(T:Widget), "WidgetMixin should be derived from Widget"); 
     269    alias typeof(this) WidgetType; 
     270    static assert(is(WidgetType:luigi.gui.Widget),  
     271                  "WidgetMixin should be derived from Widget"); 
    271272         
    272273    /**  
     
    284285    Returns: A pointer to 'this', with the proper derived type. 
    285286    */ 
    286     T arranged_(VArg...)(VArg varg) 
     287    WidgetType arranged_(VArg...)(VArg varg) 
    287288    { 
    288289        //static assert(is(T:Widget), "arranger_add requires a Widget as argument 0"); 
     
    296297template PanelMixin() 
    297298{ 
    298     alias typeof(this) T; 
    299     static assert(is(T:Panel), "PanelMixin should be derived from Panel"); 
     299    alias typeof(this) PanelType; 
     300    static assert(is(PanelType:luigi.gui.Panel),  
     301                  "PanelMixin should be derived from Panel"); 
    300302         
    301303    /** Add the widget to this panel. 
     
    312314    W add_widget(W)(W widget) 
    313315    { 
    314         static assert(is(W:Widget), "add_widget requires a Widget as argument"); 
     316        static assert(is(W:luigi.gui.Widget), "add_widget requires a Widget as argument"); 
    315317        add(widget); 
    316318        return widget; 
     
    331333    W add_arranged(W, Varg...)(W widget, Varg args) 
    332334    { 
    333         static assert(is(W:Widget), "add_arranged requires a Widget as argument"); 
     335        static assert(is(W:luigi.gui.Widget), 
     336                      "add_arranged requires a Widget as argument"); 
    334337        add(widget); 
    335338        assert(arranger, "add_arranged called with no arranger set"); 
     
    345348{ 
    346349    mixin WidgetMixin; 
     350 
     351    // Some handy aliases everyone should have 
     352    // This makes it so you can refer to these inside a Widget subclass 
     353    // without worry 
     354    alias luigi.base.Size Size; 
     355    alias luigi.base.Rect Rect; 
     356    alias luigi.base.Point Point; 
     357 
    347358 
    348359    this() {} 
     
    19701981 
    19711982    int checked_item(int v) { 
    1972         writefln("checked item(%d), cur = %d", v, m_checkedItem); 
    19731983        if (v == m_checkedItem) { return m_checkedItem; } 
    19741984        m_checkedItem = v;