@@ -12,23 +12,20 @@ import cs.system.windows.forms.Panel;
12
12
import haxe .ui .backend .winforms .StyleHelper ;
13
13
import haxe .ui .containers .Box ;
14
14
import haxe .ui .core .Component ;
15
- import haxe .ui .core .ImageDisplay ;
16
- import haxe .ui .core .TextDisplay ;
17
- import haxe .ui .core .TextInput ;
18
15
import haxe .ui .events .MouseEvent ;
19
16
import haxe .ui .events .UIEvent ;
20
17
import haxe .ui .styles .Style ;
21
- import haxe .ui .geom .Rectangle ;
22
18
23
- class ComponentBase {
19
+ class ComponentImpl extends ComponentBase {
24
20
private var _eventMap : Map <String , UIEvent -> Void > = new Map <String , UIEvent -> Void >();
25
21
26
22
public var control : Control ;
27
23
28
24
public function new () {
25
+ super ();
29
26
}
30
27
31
- public function handleCreate (native : Bool ) {
28
+ public override function handleCreate (native : Bool ) {
32
29
var className : String = Type .getClassName (Type .getClass (this ));
33
30
var nativeComponentClass : String = Toolkit .nativeConfig .query (' component[id= ${className }].@class' , ' System.Windows.Forms.Panel' , null );
34
31
@@ -44,15 +41,15 @@ class ComponentBase {
44
41
}
45
42
}
46
43
47
- private function handlePosition (left : Null <Float >, top : Null <Float >, style : Style ) {
44
+ private override function handlePosition (left : Null <Float >, top : Null <Float >, style : Style ) {
48
45
if (control == null ) {
49
46
return ;
50
47
}
51
48
52
49
control. Location = new Point (Std .int (left ), Std .int (top ));
53
50
}
54
51
55
- private function handleSize (width : Null <Float >, height : Null <Float >, style : Style ) {
52
+ private override function handleSize (width : Null <Float >, height : Null <Float >, style : Style ) {
56
53
if (control == null ) {
57
54
return ;
58
55
}
@@ -66,7 +63,7 @@ class ComponentBase {
66
63
control. Size = new Size (Std .int (width ), Std .int (height ));
67
64
}
68
65
69
- private function handleReady () {
66
+ private override function handleReady () {
70
67
if (Std .is (control , cs.system.windows.forms. TrackBar )) { // super crappy hack, trackbars _always_ have a grey background... if you can believe that!
71
68
var parent = findParent (cs.system.windows.forms. TabControl );
72
69
if (parent != null ) {
@@ -75,92 +72,17 @@ class ComponentBase {
75
72
}
76
73
}
77
74
78
- private function handleClipRect (value : Rectangle ) {
79
- }
80
-
81
- public function handlePreReposition () {
82
- }
83
-
84
- public function handlePostReposition () {
85
- }
86
-
87
- private function handleVisibility (show : Bool ) {
88
- }
89
-
90
- // ***********************************************************************************************************
91
- // Text related
92
- // ***********************************************************************************************************
93
- private var _textDisplay : TextDisplay ;
94
- public function createTextDisplay (text : String = null ): TextDisplay {
95
- if (_textDisplay == null ) {
96
- _textDisplay = new TextDisplay ();
97
- }
98
- if (text != null ) {
99
- _textDisplay .text = text ;
100
- }
101
- return _textDisplay ;
102
- }
103
-
104
- public function getTextDisplay (): TextDisplay {
105
- return createTextDisplay ();
106
- }
107
-
108
- public function hasTextDisplay (): Bool {
109
- return (_textDisplay != null );
110
- }
111
-
112
- private var _textInput : TextInput ;
113
- public function createTextInput (text : String = null ): TextInput {
114
- if (_textInput == null ) {
115
- _textInput = new TextInput ();
116
- }
117
- if (text != null ) {
118
- _textInput .text = text ;
119
- }
120
- return _textInput ;
121
- }
122
-
123
- public function getTextInput (): TextInput {
124
- return createTextInput ();
125
- }
126
-
127
- public function hasTextInput (): Bool {
128
- return (_textInput != null );
129
- }
130
-
131
- // ***********************************************************************************************************
132
- // Image related
133
- // ***********************************************************************************************************
134
- private var _imageDisplay : ImageDisplay ;
135
- public function createImageDisplay (): ImageDisplay {
136
- if (_imageDisplay == null ) {
137
- _imageDisplay = new ImageDisplay ();
138
- }
139
- return _imageDisplay ;
140
- }
141
-
142
- public function getImageDisplay (): ImageDisplay {
143
- return createImageDisplay ();
144
- }
145
-
146
- public function hasImageDisplay (): Bool {
147
- return (_imageDisplay != null );
148
- }
149
-
150
- public function removeImageDisplay () {
151
- if (_imageDisplay != null ) {
152
- _imageDisplay = null ;
153
- }
75
+ private override function handleVisibility (show : Bool ) {
154
76
}
155
77
156
78
// ***********************************************************************************************************
157
79
// Display tree
158
80
// ***********************************************************************************************************
159
- private function handleSetComponentIndex (child : Component , index : Int ) {
81
+ private override function handleSetComponentIndex (child : Component , index : Int ) {
160
82
161
83
}
162
84
163
- private function handleAddComponent (child : Component ): Component {
85
+ private override function handleAddComponent (child : Component ): Component {
164
86
if (Std .is (this .control , cs.system.windows.forms. TabControl )) {
165
87
var tabControl = cast (this .control , cs.system.windows.forms. TabControl );
166
88
@@ -191,20 +113,20 @@ class ComponentBase {
191
113
return child ;
192
114
}
193
115
194
- private function handleAddComponentAt (child : Component , index : Int ): Component {
116
+ private override function handleAddComponentAt (child : Component , index : Int ): Component {
195
117
return child ;
196
118
}
197
119
198
- private function handleRemoveComponent (child : Component , dispose : Bool = true ): Component {
120
+ private override function handleRemoveComponent (child : Component , dispose : Bool = true ): Component {
199
121
control. Controls . Remove (child .control );
200
122
return child ;
201
123
}
202
124
203
- private function handleRemoveComponentAt (index : Int , dispose : Bool = true ): Component {
125
+ private override function handleRemoveComponentAt (index : Int , dispose : Bool = true ): Component {
204
126
return null ;
205
127
}
206
128
207
- private function applyStyle (style : Style ) {
129
+ private override function applyStyle (style : Style ) {
208
130
if (control == null ) {
209
131
return ;
210
132
}
@@ -249,7 +171,7 @@ class ComponentBase {
249
171
// ***********************************************************************************************************
250
172
// Events
251
173
// ***********************************************************************************************************
252
- private function mapEvent (type : String , listener : UIEvent -> Void ) {
174
+ private override function mapEvent (type : String , listener : UIEvent -> Void ) {
253
175
switch (type ) {
254
176
case MouseEvent .CLICK :
255
177
if (_eventMap .exists (type ) == false ) {
@@ -270,7 +192,7 @@ class ComponentBase {
270
192
}
271
193
}
272
194
273
- private function unmapEvent (type : String , listener : UIEvent -> Void ) {
195
+ private override function unmapEvent (type : String , listener : UIEvent -> Void ) {
274
196
switch (type ) {
275
197
case MouseEvent .CLICK :
276
198
_eventMap .remove (type );
0 commit comments