Mercurial > projects > mde
comparison mde/gui/widget/createWidget.d @ 99:5de5810e3516
Implemented an editable TextContent widget; it's now possible to edit text options using the GUI.
The widget supports moving the text entry-point using arrows and home/end, but there's no visual indicator or edit-point setting using the mouse.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 14 Nov 2008 12:44:32 +0000 |
parents | 49e7cfed4b34 |
children | 71f0f1f83620 |
comparison
equal
deleted
inserted
replaced
98:49e7cfed4b34 | 99:5de5810e3516 |
---|---|
26 // Widgets to create: | 26 // Widgets to create: |
27 import mde.gui.widget.layout; | 27 import mde.gui.widget.layout; |
28 import mde.gui.widget.miscWidgets; | 28 import mde.gui.widget.miscWidgets; |
29 import mde.gui.widget.TextWidget; | 29 import mde.gui.widget.TextWidget; |
30 import mde.gui.widget.miscContent; | 30 import mde.gui.widget.miscContent; |
31 import mde.gui.widget.textContent; | |
31 import mde.gui.widget.Floating; | 32 import mde.gui.widget.Floating; |
32 import tango.util.log.Log : Log, Logger; | 33 import tango.util.log.Log : Log, Logger; |
33 | 34 |
34 private Logger logger; | 35 private Logger logger; |
35 static this () { | 36 static this () { |
80 }+/ | 81 }+/ |
81 | 82 |
82 private: | 83 private: |
83 /// Widget types. | 84 /// Widget types. |
84 enum WIDGET_TYPE : int { | 85 enum WIDGET_TYPE : int { |
85 FUNCTION = 0x2000, // Function called instead of widget created (no "Widget" appended to fct name) | 86 FUNCTION = 0x2000, // Function called instead of widget created (no "Widget" appended to fct name) |
86 TAKES_CONTENT = 0x4000, // Flag indicates widget's this should be passed an IContent reference. | 87 TAKES_CONTENT = 0x4000, // Flag indicates widget's this should be passed an IContent reference. |
87 PARENT = 0x8000, // widget can have children; not used by code (except in data files) | 88 PARENT = 0x8000, // widget can have children; not used by code (except in data files) |
88 | 89 |
89 // Use widget names rather than usual capitals convention | 90 // Use widget names rather than usual capitals convention |
90 Unnamed = 0x0, // Only for use by widgets not created with createWidget | 91 Unnamed = 0x0, // Only for use by widgets not created with createWidget |
91 | 92 |
92 // blank: 0x1 | 93 // blank: 0x1 |
93 FixedBlank = 0x1, | 94 FixedBlank = 0x1, |
94 SizableBlank = 0x2, | 95 SizableBlank = 0x2, |
95 Debug = 0xF, | 96 Debug = 0xF, |
96 | 97 |
97 // buttons: 0x10 | 98 // buttons: 0x10 |
98 Button = 0x10, | 99 Button = 0x10, |
99 | 100 |
100 // labels: 0x20 | 101 // labels: 0x20 |
101 ContentLabel = TAKES_CONTENT | 0x20, | 102 ContentLabel = TAKES_CONTENT | 0x20, |
102 TextLabel = 0x21, | 103 TextLabel = 0x21, |
103 | 104 |
104 // content editables: 0x30 | 105 // content editables: 0x30 |
105 editContent = FUNCTION | TAKES_CONTENT | 0x30, | 106 editContent = FUNCTION | TAKES_CONTENT | 0x30, |
106 DisplayContent = TAKES_CONTENT | 0x30, | 107 DisplayContent = TAKES_CONTENT | 0x30, |
107 BoolContent = TAKES_CONTENT | 0x31, | 108 BoolContent = TAKES_CONTENT | 0x31, |
109 TextContent = TAKES_CONTENT | 0x32, | |
108 | 110 |
109 GridLayout = TAKES_CONTENT | PARENT | 0x100, | 111 GridLayout = TAKES_CONTENT | PARENT | 0x100, |
110 TrialContentLayout = PARENT | 0x110, | 112 TrialContentLayout = PARENT | 0x110, |
111 | 113 |
112 FloatingArea = PARENT | 0x200, | 114 FloatingArea = PARENT | 0x200, |
113 } | 115 } |
114 | 116 |
115 //const char[][int] WIDGET_NAMES; | 117 //const char[][int] WIDGET_NAMES; |
116 | 118 |
117 // Only used for binarySearch algorithm generation; must be ordered by numerical values. | 119 // Only used for binarySearch algorithm generation; must be ordered by numerical values. |
122 "Button", | 124 "Button", |
123 "TextLabel", | 125 "TextLabel", |
124 "ContentLabel", | 126 "ContentLabel", |
125 "DisplayContent", | 127 "DisplayContent", |
126 "BoolContent", | 128 "BoolContent", |
129 "TextContent", | |
127 "editContent", | 130 "editContent", |
128 "TrialContentLayout", | 131 "TrialContentLayout", |
129 "FloatingArea", | 132 "FloatingArea", |
130 "GridLayout"]; | 133 "GridLayout"]; |
131 | 134 |