Changeset 202
- Timestamp:
- 07/27/10 00:31:49 (2 years ago)
- Files:
-
- trunk/src/yage/gui/controls.d (added)
- trunk/src/yage/gui/style.d (modified) (3 diffs)
- trunk/src/yage/gui/surface.d (modified) (5 diffs)
- trunk/src/yage/gui/textblock.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/yage/gui/style.d
r194 r202 266 266 267 267 // Cursor 268 Material cursor; /// TODO 268 Material cursor; /// TODO: Unimplemented 269 269 float cursorSize=float.nan; /// in pixels, float.nan to default to size of image. 270 270 … … 280 280 TextDecoration textDecoration = TextDecoration.NONE; /// ditto 281 281 CSSValue lineHeight; /// ditto 282 CSSValue letterSpacing; /// ditto282 CSSValue letterSpacing; /// TODO: Unimplemented 283 283 284 284 /** … … 287 287 288 288 // Other 289 float opacity = 1; // 0 to 1.289 float opacity = 1; /// 290 290 291 291 union trunk/src/yage/gui/surface.d
r201 r202 28 28 * margin, padding, a border, and a background texture, including textures from a camera. 29 29 * Surfaces will exist in a hierarchical structure, with each having a parent and an array of children. 30 * Surfacsare positioned relative to their parent.30 * They are positioned relative to their parent. 31 31 * A style struct defines most of the styles associated with the Surface. */ 32 32 class Surface : Tree!(Surface) 33 33 { 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; /// 35 37 36 38 bool editable = false; /// The text of this surface is editable. 39 bool multiLine = true; /// TODO 37 40 bool mouseChildren = true; /// Allow the mouse to interact with this Surface's children. 38 41 int mouseX, mouseY; /// Current position of the mouse cursor. (Read-only for now) 39 TextCursor textCursor; ///40 42 41 43 /// Callback functions … … 61 63 62 64 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. 65 66 public Vec2f offsetAbsolute; // pixel distance of top left from the window's top left at 0, 0, an absolute offset 66 67 67 68 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. 70 70 protected bool resizeDirty = true; 71 71 protected bool textDirty = true; 72 72 73 73 protected SurfaceGeometry geometry; // geometry used to render this surface 74 public TextBlock textBlock; 75 74 76 75 protected static Style defaultStyle; // Used as a cache by getDefaultStyle() 77 76 protected static Surface grabbedSurface; // surface that has captured the mouse … … 80 79 /** 81 80 * Create a new Surface at 0, 0 with 0 width and height. */ 82 this( )81 this(Surface parent=null) 83 82 { geometry = new SurfaceGeometry(); 84 83 updateDimensions(getComputedStyle()); 85 if ( !focusSurface)86 focus();84 if (parent) 85 parent.addChild(this); 87 86 } 88 87 … … 135 134 } 136 135 137 138 139 140 136 /** 141 137 * Find the surface at the given coordinates. … … 216 212 return cs; 217 213 } 218 219 214 220 215 /** trunk/src/yage/gui/textblock.d
r201 r202 114 114 for (; position<lines[line].letters.length && 0 < xy.x; position++) 115 115 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 */126 116 127 117 return lineToCursor(line, position);
