1 /******************************************************************************
2 *
3 * Copyright (C) 2004-2007, The Gentee Group. All rights reserved.
4 * This file is part of the Gentee open source project - http://www.gentee.com.
5 *
6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT").
7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS
8 * ACCEPTANCE OF THE AGREEMENT.
9 *
10 * ID: vis.virtctrl 02.04.08 0.0.A.
11 *
12 * Author: Alexander Krivonogov ( gentee )
13 *
14 ******************************************************************************/
15 /* Компонента vVirtCtrl, порождена от vComp
16 Виртуальный элемент управления (не имеет своего окна)
17 События
18
19 */
20
21 include
22 {
23 "comp.g"
24 }
25
26 operator vloc =( vloc l r )
27 {
28 mcopy( &l, &r, sizeof(vloc) )
29 return l
30 }
31
32 operator uint ==( vloc l r )
33 {
34 return l.left == r.left && l.top == r.top && l.width == r.width && l.height == r.height
35 }
36
37 type vVirtCtrl <inherit = vComp>
38 {
39 //Hidden Fields
40 vloc loc
41 uint pVisible
42 uint pEnabled
43 locustr pHint
44
45 //uint cidx //Индекс контрола
46 }
47
48 define <export>{
49 mPosChanging = $vComp_last
50 mChildPosChanged
51 mPosUpdate
52 mCreateWin
53
54 mSetEnabled
55 mSetVisible
56 mSetHint
57 mSetCaption
58 mSetImage
59
60
61 vVirtCtrl_last
62 }
63 /*------------------------------------------------------------------------------
64 Propirties
65 */
66
67 property int vVirtCtrl.Left
68 {
69 .Virtual( $mPosUpdate )
70 return this.loc.left
71 }
72
73 property vVirtCtrl.Left( int val )
74 {
75 if val != this.loc.left
76 {
77 eventpos ep
78 this.loc.left = val
79 ep.loc = this.loc
80 ep.loc.left = val
81 ep.move = 1
82 ep.code = $e_poschanging
83 .Virtual( $mPosChanging, ep )
84 }
85 }
86
87 property int vVirtCtrl.Top
88 {
89 .Virtual( $mPosUpdate )
90 return this.loc.top
91 }
92
93 property vVirtCtrl.Top( int val )
94 {
95 if val != this.loc.top
96 {
97 eventpos ep
98 this.loc.top = val
99 ep.loc = this.loc
100 ep.loc.top = val
101 ep.move = 1
102 ep.code = $e_poschanging
103 .Virtual( $mPosChanging, ep )
104 }
105 }
106
107 property int vVirtCtrl.Width
108 {
109 .Virtual( $mPosUpdate )
110 return this.loc.width
111 }
112
113 property vVirtCtrl.Width( int val )
114 {
115 if val < 0 : val = 0
116 if val != this.loc.width
117 {
118 eventpos ep
119 ep.loc = this.loc
120 ep.loc.width = val
121 ep.move = 1
122 ep.code = $e_poschanging
123 .Virtual( $mPosChanging, ep )
124 }
125 }
126
127 property int vVirtCtrl.Height
128 {
129 .Virtual( $mPosUpdate )
130 return this.loc.height
131 }
132
133
134 property vVirtCtrl.Height( int val )
135 {
136 if val < 0 : val = 0
137 if val != this.loc.height
138 {
139 eventpos ep
140 ep.loc = this.loc
141 ep.loc.height = val
142 ep.move = 1
143 ep.code = $e_poschanging
144 .Virtual( $mPosChanging, ep )
145 }
146 }
147
148
149 method vVirtCtrl.SetLocation( uint left top width height )
150 {
151 eventpos ep
152 ep.loc = this.loc
153 ep.loc.left = left
154 ep.loc.top = top
155 ep.loc.width = width
156 ep.loc.height = height
157 ep.move = 1
158 ep.code = $e_poschanging
159 .Virtual( $mPosChanging, ep )
160 }
161
162
163 /* Свойство uint Visible - Get Set
164 Видимость элемента управления
165 */
166 property vVirtCtrl.Visible( uint val )
167 {
168 if val != this.pVisible
169 {
170 this.pVisible = val
171 .Virtual( $mSetVisible )
172 if &this.Owner()
173 {
174 this.Owner->vVirtCtrl.Virtual( $mChildPosChanged, this )
175 }
176 }
177 }
178
179 property uint vVirtCtrl.Visible
180 {
181 return this.pVisible
182 }
183
184
185 /* Свойство uint Visible - Get Set
186 Доступность элемента управления
187 */
188 property vVirtCtrl.Enabled( uint val )
189 {
190 if val != this.pEnabled
191 {
192 this.pEnabled = val
193 .Virtual( $mSetEnabled )
194 }
195 }
196
197 property uint vVirtCtrl.Enabled
198 {
199 return this.pEnabled
200 }
201
202
203 /* Свойство ustr vVirtCtrl.Hint - Get Set
204 Всплывающая подсказка
205 */
206 property ustr vVirtCtrl.Hint <result>
207 {
208 result = this.pHint.Value
209 }
210
211 property vVirtCtrl.Hint( ustr val )
212 {
213 if val != this.pHint.Value
214 {
215 this.pHint.Value = val
216 .Virtual( $mSetHint )
217 }
218 }
219
220
221 /*Виртуальный метод uint vCustomBtn.mLangChanged - Изменение текущего языка
222 */
223 method vVirtCtrl.mLangChanged <alias=vVirtCtrl_mLangChanged>()
224 {
225 .Virtual( $mSetHint )
226 this->vComp.mLangChanged()
227 }
228
229
230
231 /*------------------------------------------------------------------------------
232 Registration
233 */
234
235
236 method vVirtCtrl vVirtCtrl.init()
237 {
238 this.pTypeId = vVirtCtrl
239 this.pVisible = 1
240 this.pEnabled = 1
241 return this
242 }
243 /*
244 func init_vVirtCtrl <entry>()
245 {
246
247 regcomp( vVirtCtrl, "vVirtCtrl", vComp, $vVirtCtrl_last,
248 %{ %{$mLangChanged, vVirtCtrl_mLangChanged },
249 %{$mSetIndex, vVirtCtrl_mSetIndex } },
250 0->collection )
251 ifdef $DESIGNING {
252 cm.AddComp( vVirtCtrl )
253 cm.AddProps( vVirtCtrl, %{
254 "Visible" , uint, $PROP_LOADAFTERCREATE,//0,//$PROP_LOADAFTERCHILD,
255 "Enabled" , uint, 0,
256 "Hint" , ustr, 0
257 })
258
259
260 }
261
262 //print( "reg vform 2\n" )
263 }
264 */
Редактировать