Changeset 59:672b6b162a36

Show
Ignore:
Timestamp:
06/14/08 12:52:22 (7 months ago)
Author:
Diggory Hardy <diggory.hardy@gmail.com>
branch:
default
Message:

Added very basic (and currently useless) content support.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • mde/gui/IGui.d

    r58 r59  
    3232alias wdim  wdsize; /// ditto 
    3333 
    34 /// A pair of wdim variables, and strictly no other data (methods may be added if deemed useful). 
     34/** A pair of wdim variables, and strictly no other data (methods may be added if deemed useful). 
     35 * 
     36 * Potentially usable to return two wdim variables, e.g. width and height, from a function. 
     37 * However, the current usage of out variables looks like it's better. */ 
    3538struct wdimPair { 
    3639    wdim x, y;  /// data 
  • mde/gui/widget/createWidget.d

    r45 r59  
    2323import mde.gui.widget.layout; 
    2424import mde.gui.widget.miscWidgets; 
     25import mde.gui.widget.TextWidget; 
    2526 
    2627/** Create a widget of type data[0] (see enum WIDGET_TYPES) for _window window, with initialisation 
  • mde/gui/widget/miscWidgets.d

    r58 r59  
    2020import mde.gui.exception; 
    2121import mde.gui.renderer.IRenderer; 
    22  
    23 import mde.resource.font; 
    2422 
    2523import tango.io.Stdout; 
     
    102100    } 
    103101} 
    104  
    105 /// Basic text widget 
    106 class TextWidget : Widget 
    107 { 
    108     this (IWindow wind, int[] data) { 
    109         if (data.length != 2) throw new WidgetDataException; 
    110         if (font is null) font = FontStyle.get("default"); 
    111         font.updateBlock (str, textCache); 
    112         mw = cast(wdim) textCache.w; 
    113         mh = cast(wdim) textCache.h; 
    114         colour = Colour (cast(ubyte) (data[1] >> 16u), 
    115                          cast(ubyte) (data[1] >> 8u), 
    116                          cast(ubyte) data[1] ); 
    117         super (wind,data); 
    118     } 
    119      
    120     void draw () { 
    121         super.draw(); 
    122         font.textBlock (x,y, str, textCache, colour);   // test new-lines and unicode characters 
    123     } 
    124      
    125 protected: 
    126     const str = "Text Widget\nαβγ − ΑΒΓ"; 
    127     TextBlock textCache; 
    128     Colour colour; 
    129     static FontStyle font; 
    130 }