Changeset 202

Show
Ignore:
Timestamp:
07/27/10 00:31:49 (2 years ago)
Author:
JoeCoder
Message:

Added yage.gui.controls unimplemented classes for ideas how to create ui controls.
Added Surface.this(parent) constructor.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/yage/gui/style.d

    r194 r202  
    266266 
    267267    // Cursor 
    268     Material cursor; /// TODO 
     268    Material cursor; /// TODO: Unimplemented 
    269269    float cursorSize=float.nan; /// in pixels, float.nan to default to size of image. 
    270270     
     
    280280    TextDecoration textDecoration = TextDecoration.NONE; /// ditto 
    281281    CSSValue lineHeight; /// ditto 
    282     CSSValue letterSpacing; /// ditto 
     282    CSSValue letterSpacing; /// TODO: Unimplemented 
    283283     
    284284    /** 
     
    287287 
    288288    // Other 
    289     float opacity = 1; // 0 to 1. 
     289    float opacity = 1; /// 
    290290     
    291291    union 
  • trunk/src/yage/gui/surface.d

    r201 r202  
    2828 * margin, padding, a border, and a background texture, including textures from a camera.  
    2929 * Surfaces will exist in a hierarchical structure, with each having a parent and an array of children.  
    30  * Surfacs are positioned relative to their parent.  
     30 * They are positioned relative to their parent.  
    3131 * A style struct defines most of the styles associated with the Surface. */ 
    3232class Surface : Tree!(Surface) 
    3333{    
    34     Style style; 
     34    Style style; /// Controls positioning and appearance of the Surface via CSS-like properties. 
     35    TextBlock textBlock; /// Provides low-level access to this Surface's text.  Normally, setHtml() is all that's needed. 
     36    TextCursor textCursor; /// 
    3537         
    3638    bool editable = false; /// The text of this surface is editable. 
     39    bool multiLine = true; /// TODO 
    3740    bool mouseChildren = true; /// Allow the mouse to interact with this Surface's children. 
    3841    int mouseX, mouseY; /// Current position of the mouse cursor.  (Read-only for now) 
    39     TextCursor textCursor; /// 
    4042     
    4143    /// Callback functions 
     
    6163     
    6264    protected Vec2f offset;         // pixel distance of the topleft corner from parent's top left, a relative offset 
    63     protected Vec2f size;           // pixel outer width/height, which includes borders and padding. 
    64      
     65    protected Vec2f size;           // pixel outer width/height, which includes borders and padding.     
    6566    public Vec2f offsetAbsolute;    // pixel distance of top left from the window's top left at 0, 0, an absolute offset 
    6667     
    6768    protected bool mouseIn;         // used to track mouseover/mouseout 
    68     protected bool mouseMoved;      // used for click() event. 
    69      
     69    protected bool mouseMoved;      // used for click() event.   
    7070    protected bool resizeDirty = true; 
    7171    protected bool textDirty = true; 
    7272     
    7373    protected SurfaceGeometry geometry; // geometry used to render this surface 
    74     public TextBlock textBlock; 
    75      
     74         
    7675    protected static Style defaultStyle; // Used as a cache by getDefaultStyle()     
    7776    protected static Surface grabbedSurface; // surface that has captured the mouse 
     
    8079    /** 
    8180     * Create a new Surface at 0, 0 with 0 width and height. */ 
    82     this(
     81    this(Surface parent=null
    8382    {   geometry = new SurfaceGeometry(); 
    8483        updateDimensions(getComputedStyle()); 
    85         if (!focusSurface
    86             focus(); 
     84        if (parent
     85            parent.addChild(this); 
    8786    } 
    8887     
     
    135134    } 
    136135 
    137      
    138      
    139      
    140136    /** 
    141137     * Find the surface at the given coordinates. 
     
    216212        return cs; 
    217213    } 
    218  
    219214     
    220215    /** 
  • trunk/src/yage/gui/textblock.d

    r201 r202  
    114114            for (; position<lines[line].letters.length && 0 < xy.x; position++) 
    115115                xy.x -= lines[line].letters[position].advanceX; 
    116              
    117             /* 
    118             int position, x; 
    119             while(true) 
    120             {   y += lines[line].letters[position].advanceX; 
    121                 if (position>=lines[line].letters.length-1 || x > xy.x) 
    122                     break; 
    123                 position++; 
    124             } 
    125              */ 
    126116             
    127117            return lineToCursor(line, position);