Changeset 66:f54ae4fc2b2f

Show
Ignore:
Timestamp:
07/02/08 12:10:07 (6 months ago)
Author:
Diggory Hardy <diggory.hardy@gmail.com>
branch:
default
Message:

Replaced IWidget.getMinimalSize(out w,out h) with minWidth() and minHeight().

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • codeDoc/todo.txt

    r31 r66  
    66 
    77GUI: 
    8 ->  Basic OpenGL code to: 
    9     ->* create orthographic projection 
    10     ->* draw boxes 
    11     ->  maybe more (text, textures, ...) 
    12 ->* Windows with size & position 
    138->  Widgets: 
     9    ->  rethink how widgets are created and receive creation data, so that they don't have to be created by the Window 
    1410    ->* minimum size but expandable, auto-set 
    15         ->  no ability to resize yet except from config files 
    1611    ->* grid "layout" widgets 
    1712    ->  scripted widgets 
    1813    ->  decent rendering/theme system 
    19 ->  Text rendering 
    20     -> text library? 
     14    ->  lists from content lists 
     15->  Content: 
     16    ->  lists 
  • mde/gui/widget/Ifaces.d

    r65 r66  
    130130    bool isHSizable (); /// ditto 
    131131     
    132     /** Calculate the minimal size the widget could be shrunk to (or its fixed size), taking into 
    133      * account child-widgets or other contents. */ 
    134     void getMinimalSize (out wdim w, out wdim h); 
     132    /** The minimal size the widget could be shrunk to (or its fixed size). 
     133     * 
     134     * Takes into account child-widgets and any other contents. */ 
     135    wdim minWidth (); 
     136    wdim minHeight ();  /// ditto 
    135137     
    136138    /** Get the current size of the widget. */ 
  • mde/gui/widget/Widget.d

    r65 r66  
    6363     
    6464    /* Return minimal/fixed size. */ 
    65     void getMinimalSize (out wdim a, out wdim b) { 
    66         a = mw; 
    67         b = mh; 
     65    wdim minWidth () { 
     66        return mw; 
     67    } 
     68    wdim minHeight () { 
     69        return mh; 
    6870    } 
    6971     
  • mde/gui/widget/Window.d

    r65 r66  
    9292         
    9393        // Calculate mw/mh and xw/yh (cached data): 
    94         widget.getMinimalSize (mw, mh); 
    95         mw += border.l + border.r; 
    96         mh += border.t + border.b; 
     94        mw = widget.minWidth  + border.l + border.r; 
     95        mh = widget.minHeight + border.t + border.b; 
    9796         
    9897        xw = x+w; 
     
    255254    } 
    256255     
    257     void getMinimalSize (out wdim wM, out wdim hM) { 
    258         // mw/mh are calculated by finalise(); 
    259         wM = mw; 
    260         hM = mh; 
     256    wdim minWidth () { 
     257        return mw; 
     258    } 
     259    wdim minHeight () { 
     260        return mh; 
    261261    } 
    262262    void getCurrentSize (out wdim cw, out wdim ch) { 
  • mde/gui/widget/layout.d

    r65 r66  
    3636* 
    3737* The grid has no border but has spacing between widgets. */ 
     38/* TODO: 
     39        separate positioning & sub-widget handling from creation/saving 
     40        other types of layouts (e.g. lists from content) 
     41*/ 
    3842class GridLayoutWidget : Widget 
    3943{ 
     
    138142    } 
    139143     
    140     /* Calculates the minimal size from all rows and columns of widgets. */ 
    141     void getMinimalSize (out wdim mw, out wdim mh) { 
    142         mw = this.mw; 
    143         mh = this.mh; 
    144     } 
    145      
    146144    void setWidth (wdim nw, int dir) { 
    147145        if (nw == w) return; 
     
    224222        col.minWidth = new wdim[cols]; 
    225223        row.minWidth = new wdim[rows]; 
    226         wdim ww, wh;     // sub-widget minimal sizes 
    227224        foreach (i,widget; subWidgets) { 
    228             widget.getMinimalSize (ww, wh); 
    229              
    230225            // Increase dimensions if current minimal size is larger: 
    231226            myIt n = i % cols;  // column 
    232             if (col.minWidth[n] < ww) col.minWidth[n] = ww; 
     227            wdim md = widget.minWidth; 
     228            if (col.minWidth[n] < md) col.minWidth[n] = md; 
    233229            n = i / cols;       // row 
    234             if (row.minWidth[n] < wh) row.minWidth[n] = wh; 
     230            md = widget.minHeight; 
     231            if (row.minWidth[n] < md) row.minWidth[n] = md; 
    235232        } 
    236233