EnglishРусский  

   ..

   addustr.g

   app.g

   btn.g

   btnpic.g

   comp.g

   ctrl.g

   ctrlci.g

   dialogs.g

   dlgbtns.g

   edit.g

   events.g

   fonts.g

   form.g

   gray.g

   grey.g

   header.g

   images.g

   label.g

   labeled.g

   locustr.g

   menu.g

   panel.g

   picture.g

   styles.g

   tab.g

   tabitem.g

   tabpage.g

   timer.g

   toolbar.g

   tray.g

   url.g

   vis.g

   viswin.g

The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

source\lib\vis\dlgbtns.g
  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.dlgbtns 19.06.09 0.0.A.
 11 *
 12 * Author: Alexander Krivonogov ( gentee )
 13 *
 14 ******************************************************************************/
 15 
 16 include {
 17    "btnpic.g"
 18    "panel.g"
 19 }
 20 
 21 
 22 type vDlgBtns <inherit = vPanel>
 23 {
 24    uint    pIndent
 25    uint    pShowLine
 26    uint    pShowHelp
 27    uint    pShowApply
 28    uint    pShowCancel
 29    uint    pShowClose
 30    uint    pShowReady
 31    uint    pDisableNext
 32    uint    pWizard
 33    uint    pCurWizard 
 34    uint    pMaxWizard
 35    vPanel  pLine
 36    vBtnPic btnHelp
 37    vBtnPic btnCancel
 38    vBtnPic btnOk
 39    vBtnPic btnApply
 40    vBtnPic btnPrev
 41    vBtnPic btnNext
 42    vBtnPic btnClose
 43    evValUint OnApply
 44    evValUint OnWizard 
 45        
 46 }
 47 
 48 /*define {
 49 //Тип vDlgBtns.Wizard
 50    dbNone = 0 
 51    dbFirst = 0x01
 52    dbMedium = 0x11
 53    dbLast = 0x10
 54 }*/
 55 
 56 /*------------------------------------------------------------------------------
 57    Internal Methods
 58 */
 59 method vDlgBtns.iUpdate()
 60 {
 61    .pLine.Visible = .pShowLine
 62    .pLine.Left = .pIndent
 63    .pLine.Right = .pIndent
 64    
 65    .btnHelp.Visible = .pShowHelp
 66    .btnHelp.Left = .pIndent
 67    
 68    .btnApply.Visible = .pShowApply   
 69    
 70    .btnCancel.Visible = .pShowCancel 
 71     
 72    if .pWizard 
 73    {              
 74       .btnOk.Caption = "done".ustr()
 75       .btnPrev.Visible = 1
 76       .btnPrev.Enabled = .pCurWizard//.pWizard & 0x10
 77       .btnNext.Visible = .pShowReady || ( .pCurWizard < .pMaxWizard )//(.pWizard & 0x01) 
 78       .btnNext.Enabled = (!.pDisableNext) && ( .pCurWizard < .pMaxWizard )//(.pWizard & 0x01) && 
 79       .btnOk.Visible = .pShowReady || !( .pCurWizard < .pMaxWizard )//!(.pWizard & 0x01)
 80       //.btnOk.Enabled = !.pDisableNext
 81    }
 82    else
 83    {
 84       .btnOk.Caption = "ok".ustr()
 85       .btnNext.Visible = 0
 86       .btnPrev.Visible = 0      
 87       .btnOk.Visible = !.pShowClose
 88       .btnClose.Visible = .pShowClose
 89    }
 90    
 91    
 92    uint right
 93    if .pShowApply 
 94    {
 95       .btnApply.Right = right + .pIndent   
 96       right = .btnApply.Right + .btnApply.Width
 97    } 
 98    if .btnCancel.Visible
 99    {  
100       .btnCancel.Right = right + .pIndent   
101       right = .btnCancel.Right + .btnCancel.Width
102    }   
103    right += .pIndent
104    if .btnOk.Visible
105    {
106       .btnOk.Right = right     
107       right = .btnOk.Right + .btnOk.Width
108    }
109    elif .btnClose.Visible
110    {
111       .btnClose.Right = right
112       right = .btnClose.Right + .btnClose.Width
113    }
114    if .btnNext.Visible
115    {
116       .btnNext.Right = right   
117       right = .btnNext.Right + .btnNext.Width
118    }
119    if .btnPrev.Visible
120    {
121       .btnPrev.Right = right
122    }
123      
124 }
125    
126    
127 /*------------------------------------------------------------------------------
128    Properties
129 */
130 /* Свойство uint vDlgBtns.ShowHelp - Get Set
131 Показывать кнопку help
132 */
133 property uint vDlgBtns.ShowHelp 
134 {
135    return this.pShowHelp
136 }
137 
138 property vDlgBtns.ShowHelp( uint val )
139 {
140    if val != this.pShowHelp
141    { 
142       this.pShowHelp = val
143       .iUpdate()
144    } 
145 }   
146 
147 /* Свойство uint vDlgBtns.ShowApply - Get Set
148 Показывать кнопку apply
149 */
150 property uint vDlgBtns.ShowApply 
151 {
152    return this.pShowApply
153 }
154 
155 property vDlgBtns.ShowApply( uint val )
156 {
157    if val != this.pShowApply
158    { 
159       this.pShowApply = val
160       .iUpdate()
161    } 
162 }   
163 
164 /* Свойство uint vDlgBtns.ShowCancel - Get Set
165 Показывать кнопку cancel
166 */
167 property uint vDlgBtns.ShowCancel 
168 {
169    return this.pShowCancel
170 }
171 
172 property vDlgBtns.ShowCancel( uint val )
173 {
174    if val != this.pShowCancel
175    { 
176       this.pShowCancel = val
177       .iUpdate()
178    } 
179 }
180 
181 /* Свойство uint vDlgBtns.ShowClose - Get Set
182 Показывать кнопку close вместо cancel
183 */
184 property uint vDlgBtns.ShowClose 
185 {
186    return this.pShowClose
187 }
188 
189 property vDlgBtns.ShowClose( uint val )
190 {
191    if val != this.pShowClose
192    { 
193       this.pShowClose = val
194       .iUpdate()
195    } 
196 }         
197 
198 /* Свойство uint vDlgBtns.ShowLine - Get Set
199 Показывать кнопку help
200 */
201 property uint vDlgBtns.ShowLine
202 {
203    return this.pShowLine
204 }
205 
206 property vDlgBtns.ShowLine( uint val )
207 {
208    if val != this.pShowLine
209    { 
210       this.pShowLine = val
211       .iUpdate()
212    } 
213 }
214 
215 /* Свойство uint vDlgBtns.ShowReady - Get Set
216 Показывать кнопку готово если включен Wizard
217 */
218 property uint vDlgBtns.ShowReady
219 {
220    return this.pShowReady
221 }
222 
223 property vDlgBtns.ShowReady( uint val )
224 {
225    if val != this.pShowReady
226    { 
227       this.pShowReady = val
228       .iUpdate()
229    } 
230 }
231 
232 /* Свойство uint vDlgBtns.Wizard - Get Set
233 Показывать кнопки Назад Далее Готово
234 */
235 property uint vDlgBtns.Wizard
236 {
237    return this.pWizard
238 }
239 
240 property vDlgBtns.Wizard( uint val )
241 {
242    if val != this.pWizard
243    { 
244       this.pWizard = val
245       .iUpdate()
246    } 
247 }
248 
249 /* Свойство uint vDlgBtns.CurWizard - Get Set
250 Текущее положение Wizard
251 */
252 property uint vDlgBtns.CurWizard
253 {
254    return this.pCurWizard
255 }
256 
257 property vDlgBtns.CurWizard( uint val )
258 {
259    val == min( val, .pMaxWizard )
260    if val != this.pCurWizard
261    {  
262       this.pCurWizard = val
263       .iUpdate()
264       evparValUint evp
265       evp.val = .pCurWizard
266       .OnWizard.Run(evp, this)
267    } 
268 }
269 
270 /* Свойство uint vDlgBtns.MaxWizard - Get Set
271 Текущее положение Wizard
272 */
273 property uint vDlgBtns.MaxWizard
274 {
275    return this.pMaxWizard
276 }
277 
278 property vDlgBtns.MaxWizard( uint val )
279 {
280    if val != this.pMaxWizard
281    { 
282       this.pMaxWizard = val
283       .iUpdate()
284    } 
285 }
286 
287 /* Свойство uint vDlgBtns.DisableNext - Get Set
288 Показывать кнопки Назад Далее Готово
289 */
290 property uint vDlgBtns.DisableNext
291 {
292    return this.pDisableNext
293 }
294 
295 property vDlgBtns.DisableNext( uint val )
296 {
297    if val != this.pDisableNext
298    { 
299       this.pDisableNext = val
300       .iUpdate()
301    } 
302 }
303 
304 /* Свойство uint vDlgBtns.Indent - Get Set
305 Значение отступа
306 */
307 property uint vDlgBtns.Indent
308 {
309    return this.pIndent
310 }
311 
312 property vDlgBtns.Indent( uint val )
313 {
314    if val != this.pIndent
315    { 
316       this.pIndent = val
317       .iUpdate()
318    } 
319 }
320 
321 /*------------------------------------------------------------------------------
322    Event Processor
323 */
324 method uint vDlgBtns.Ok <alias=vDlgBtns_Ok>( evparEvent evn )
325 {   
326    if !.OnApply.id || .OnApply.Run(evn) : .GetMainForm()->vForm.Result = 1
327    return 0
328 }
329 
330 method uint vDlgBtns.Wizard <alias=vDlgBtns_Wizard>( evparEvent evn )
331 {   
332    evparValUint evp
333    uint val = .pCurWizard
334    if evn.sender == &.btnNext : val++
335    else : val--
336    .CurWizard = val 
337    //evp.val = .pCurWizard
338    //if !.pCurWizard : .Wizard = $dbFirst
339    //else : .Wizard = $dbMedium 
340    //.OnWizard.Run(evp, this) 
341    return 0
342 }
343 
344 method uint vDlgBtns.Cancel <alias=vDlgBtns_Cancel>( evparEvent evn )
345 {
346    .GetMainForm()->vForm.Result = -1   
347    return 0
348 }
349 
350 method uint vDlgBtns.Help <alias=vDlgBtns_Help>( evparEvent evn )
351 {   
352    .GetForm()->vCtrl.Help()
353    return 0
354 }
355 
356 method uint vDlgBtns.Apply <alias=vDlgBtns_Apply>( evparEvent evn )
357 {
358    .OnApply.Run( evn )   
359    return 0
360 }
361 
362 /*------------------------------------------------------------------------------
363    Registration
364 */
365 
366 method vDlgBtns vDlgBtns.init( )
367 {
368    this.pTypeId = vDlgBtns
369    .pAlign =  $alhClient | $alvBottom
370    .loc.height = 60
371    .pBorder = $brdNone
372    .pShowHelp = 1
373    .pShowLine = 1   
374    .pShowCancel = 1
375    .pIndent = 15
376    return this 
377 }  
378 
379 method vDlgBtns vDlgBtns.mCreateWin <alias=vDlgBtns_mCreateWin>()
380 {   
381    uint indent = 5
382    collection ccaption = %{ "prev", "next", "ok", "cancel", "help", "apply", "close" }
383    collection cimage = %{ "", "", "main\\bok", "main\\bcancel", "main\\bhelp", "main\\brefresh", "main\\bcancel" }
384    collection cbtn = %{ &.btnPrev, &.btnNext, &.btnOk, &.btnCancel, &.btnHelp, &.btnApply, &.btnClose }
385    collection cevent = %{ vDlgBtns_Wizard, vDlgBtns_Wizard, vDlgBtns_Ok, vDlgBtns_Cancel, vDlgBtns_Help, vDlgBtns_Apply, vDlgBtns_Cancel }
386    uint i, left 
387    this->vPanel.mCreateWin()
388    fornum i=0, *cbtn
389    {
390       uint btn as cbtn[i]->vBtnPic      
391       btn.Caption = ccaption[i]->str.ustr()
392       btn.Image = cimage[i]->str.ustr()
393       btn.VertAlign = $alvCenter      
394       btn.Owner = this
395       btn.Height = 30 
396       btn.OnClick.Set( &this, cevent[i] )
397       if &btn != &.btnHelp :  btn.HorzAlign = $alhRight      
398    }
399    
400    .pLine.Top = 0   
401    .pLine.Border = $brdLowered
402    .pLine.Caption = "".ustr()
403    .pLine.HorzAlign = $alhLeftRight
404    .pLine.Owner = this
405    .pLine.Height = 2
406    .Caption = "".ustr()
407    .iUpdate()
408    return this 
409 }
410 
411 func init_vDlgBtns <entry>()
412 {
413    
414    regcomp( vDlgBtns, "vDlgBtns", vPanel, $vCtrl_last,        
415          %{ %{ $mCreateWin, vDlgBtns_mCreateWin },
416             %{ $mSetName,   0 } },
417       0->collection )                        
418       
419 ifdef $DESIGNING {
420    cm.AddComp( vDlgBtns, 1, "Windows", "dlgbtns" )
421    cm.AddProps( vDlgBtns, %{ 
422             "ShowLine" , uint, 0,
423             "ShowHelp" , uint, 0,
424             "ShowApply", uint, 0,
425             "ShowCancel", uint, 0,
426             "ShowClose", uint, 0,
427             "ShowReady", uint, 0,
428             "DisableNext", uint, 0,
429             "Wizard", uint, 0,
430             "Indent"   , uint, 0,
431             "CurWizard", uint, 0,
432             "MaxWizard", uint, 0
433              } )
434     cm.AddEvents( vDlgBtns, %{
435 "OnApply"    , "evparEvent",
436 "OnWizard"   , "evparValUint"
437    } )
438    
439 /*   cm.AddPropVals( vDlgBtns, "Wizard", %{
440 "dbNone"    ,$dbNone,
441 "dbFirst"   ,$dbFirst,          
442 "dbMedium"  ,$dbMedium,   
443 "dbLast"    ,$dbLast
444    })    */
445 }
446 }