EnglishРусский  

   ..

   addustr.g

   app.g

   btn.g

   btnpic.g

   comp.g

   ctrl.g

   dialogs.g

   edit.g

   events.g

   fonts.g

   form.g

   gray.g

   grey.g

   images.g

   label.g

   labeled.g

   locustr.g

   menu.g

   panel.g

   picture.g

   s.txt

   styles.g

   tab.g

   tabitem.g

   tabpage.g

   toolbar.g

   tray.g

   url.g

   vis.g

   viswin.g

Ads

Perfect Automation tool
All-In-One: Script editor, Launcher, Scheduler, Keyboard & Mouse Recorder. Try now!

CreateInstall
Freeware and commercial installers.

Cell Phone Batteries
Batteries Plus offers batteries for laptop, camcorder, cell phone, camera.

Gentee needs your help!
How to advertise with us
 
laptop battery

source\lib\vis\labeled.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.labeled 17.07.07 0.0.A.
 11 *
 12 * Author: Alexander Krivonogov ( gentee )
 13 *
 14 ******************************************************************************/
 15 
 16 include {
 17    "edit.g"
 18    "btnpic.g"
 19    "combobox.g"
 20    "label.g"
 21 }
 22 
 23 
 24 type vLabelCon <inherit = vLabel>
 25 {
 26    uint pLabelPos
 27    uint pAddColon
 28    uint LabeledCtrl
 29 }
 30 
 31 /* Компонента vLabeledEditOld, порождена от vEdit
 32 */
 33 /*type vLabeledEditOld <inherit = vEdit>
 34 {
 35    vLabelCon LabelCon      
 36 }*/
 37 
 38 type vLabeledComboBox <inherit = vComboBox>
 39 {  
 40    vLabelCon LabelCon     
 41 }
 42 
 43 type vLabeledEdit <inherit = vCtrl>
 44 {
 45    vLabelCon LabelCon    
 46    vEdit     Edit
 47    //vBtnPic   Btn1
 48    //vBtnPic   Btn2
 49    ustr      pBtn1Image
 50    ustr      pBtn2Image
 51    
 52    locustr      pBtn1Hint
 53    locustr      pBtn2Hint
 54    
 55    uint      pBtn1
 56    uint      pBtn2
 57    
 58    uint      pLEStyle
 59    
 60    evEvent   OnBtn1Click
 61    evEvent   OnBtn2Click   
 62    evEvent   OnChange   
 63    evEvent   OnFocus 
 64 }
 65 
 66 define {
 67 //Положение подписи LabelPos
 68    lpLeft    = 0 
 69    lpAbove   = 1
 70    
 71 //Стили LabeledEdit.LEStyle   
 72    lsSimple = 0
 73    lsOneBtn = 1
 74    lsTwoBtns = 2   
 75 }
 76 
 77 extern {
 78    method vLabelCon.ConPosChanging()
 79 }
 80 /*------------------------------------------------------------------------------
 81    Properties
 82 */
 83 /* Свойство str vLabeledEditOld.Caption - Get Set
 84 Усотанавливает или получает заколовок панели
 85 */
 86 /*property ustr vLabeledEditOld.Caption <result>
 87 {
 88    result = .LabelCon.Caption  
 89 }
 90 
 91 property vLabeledEditOld.Caption( ustr val )
 92 {
 93    .LabelCon.Caption = val    
 94 }*/
 95 
 96 property ustr vLabeledComboBox.Caption <result>
 97 {
 98    result = .LabelCon.Caption  
 99 }
100 
101 property vLabeledComboBox.Caption( ustr val )
102 {
103    .LabelCon.Caption = val    
104 }
105 
106 property ustr vLabeledEdit.Caption <result>
107 {
108    result = .LabelCon.Caption  
109 }
110 
111 property vLabeledEdit.Caption( ustr val )
112 {
113    .LabelCon.Caption = val    
114 }
115 
116 method vLabelCon.mSetCaption <alias=vLabelCon_mSetCaption>( ustr caption )
117 {   
118    if caption[ *caption - 1 ] != ':'
119    {
120       caption += ":"
121    }
122    this->vLabel.mSetCaption( caption )  
123 }
124 
125 property uint vLabelCon.AddColon
126 {
127    return .pAddColon  
128 }
129 
130 property vLabelCon.AddColon( uint val )
131 {
132    if .pAddColon != val
133    {
134       .pAddColon = val
135       
136    }
137 }
138 
139 
140 property uint vLabelCon.LabelPos
141 {
142    return .pLabelPos  
143 }
144 
145 property vLabelCon.LabelPos( uint val )
146 {
147    if .pLabelPos != val
148    {
149       .pLabelPos = val
150       if val == $lpLeft
151       {
152          .HorzAlign = $alhRight
153       }
154       else
155       {         
156          .HorzAlign = $alhLeft
157          //.iUpdateSize()
158       }
159       .ConPosChanging()    
160    }   
161 }
162 
163 
164 /*property uint vLabeledEditOld.LabelPos
165 {
166    return .LabelCon.LabelPos  
167 }
168 
169 property vLabeledEditOld.LabelPos( uint val )
170 {
171    .LabelCon.LabelPos = val   
172 }*/
173 
174 property uint vLabeledComboBox.LabelPos
175 {
176    return .LabelCon.LabelPos  
177 }
178 
179 property vLabeledComboBox.LabelPos( uint val )
180 {
181    .LabelCon.LabelPos  = val   
182 }  
183 
184 property uint vLabeledEdit.LabelPos
185 {
186    return .LabelCon.LabelPos  
187 }
188 
189 property vLabeledEdit.LabelPos( uint val )
190 {
191    .LabelCon.LabelPos  = val   
192 }  
193 
194 
195 property uint vLabeledComboBox.AddColon
196 {
197    return .LabelCon.AddColon  
198 }
199 
200 property vLabeledComboBox.AddColon( uint val )
201 {
202    .LabelCon.AddColon  = val   
203 }  
204 
205 property uint vLabeledEdit.AddColon
206 {
207    return .LabelCon.AddColon  
208 }
209 
210 property vLabeledEdit.AddColon( uint val )
211 {
212    .LabelCon.AddColon  = val   
213 }  
214 
215 property ustr vLabeledEdit.Text <result>
216 {
217    result = .Edit.Text  
218 }
219 
220 property vLabeledEdit.Text( ustr val )
221 {
222    .Edit.Text  = val   
223 }
224 
225 property uint vLabeledEdit.Password
226 {   
227    return  .Edit.pPassword
228 }
229 
230 property vLabeledEdit.Password( uint val )
231 {
232    .Edit.Password = val   
233 }
234 
235 property uint vLabeledEdit.Multiline
236 {   
237    return  .Edit.Multiline
238 }
239 
240 property vLabeledEdit.Multiline( uint val )
241 {
242    .Edit.Multiline = val   
243 }
244 
245 property uint vLabeledEdit.ScrollBars
246 {   
247    return  .Edit.ScrollBars
248 }
249 
250 property vLabeledEdit.ScrollBars( uint val )
251 {
252    .Edit.ScrollBars = val   
253 }
254 
255 property uint vLabeledEdit.MaxLen
256 {
257    return .Edit.MaxLen  
258 }
259 
260 property vLabeledEdit.MaxLen( uint val )
261 {
262    .Edit.MaxLen = val   
263 }
264 
265 property ustr vLabeledEdit.Btn1Image <result>
266 {   
267    result = .pBtn1Image  
268 }
269 
270 property vLabeledEdit.Btn1Image( ustr val )
271 {
272    if .pBtn1Image != val
273    {
274       .pBtn1Image = val
275       if .pBtn1
276       {
277          .pBtn1->vBtnPic.Image = val
278       }  
279    }   
280 }
281 
282 property ustr vLabeledEdit.Btn2Image <result>
283 {   
284    result = .pBtn2Image  
285 }
286 
287 property vLabeledEdit.Btn2Image( ustr val )
288 {
289    if .pBtn2Image != val
290    {
291       .pBtn2Image = val
292       if .pBtn2
293       {
294          .pBtn2->vBtnPic.Image = val
295       }  
296    }   
297 }
298 
299 
300 
301 property ustr vLabeledEdit.Btn1Hint <result>
302 {   
303    result = .pBtn1Hint  
304 }
305 
306 property vLabeledEdit.Btn1Hint( ustr val )
307 {
308    if .pBtn1Hint != val
309    {
310       .pBtn1Hint = val
311       if .pBtn1
312       {
313          .pBtn1->vBtnPic.Hint = val
314       }  
315    }   
316 }
317 
318 property ustr vLabeledEdit.Btn2Hint <result>
319 {   
320    result = .pBtn2Hint  
321 }
322 
323 property vLabeledEdit.Btn2Hint( ustr val )
324 {
325    if .pBtn2Hint != val
326    {
327       .pBtn2Hint = val
328       if .pBtn2
329       {
330          .pBtn2->vBtnPic.Hint = val
331       }  
332    }   
333 }
334 
335 property uint vLabeledEdit.LEStyle()
336 {
337    return .pLEStyle
338 }
339 
340 property vLabeledEdit.LEStyle( uint val )
341 {
342    if .pLEStyle != val
343    {
344       .pLEStyle = val
345       .Virtual( $mReCreateWin )
346    }
347 }
348 
349 /*------------------------------------------------------------------------------
350    Virtual methods
351 */
352 method vLabelCon.ConCreateWin( vCtrl LabeledCtrl )
353 {    
354    .LabeledCtrl = &LabeledCtrl
355    .AutoSize = 1   
356    .TextVertAlign = $talvCenter   
357    .HorzAlign = $alhRight   
358    .AddColon = 1
359    
360 }
361 
362 method vLabelCon.ConSetOwner()
363 { 
364    .Owner = .LabeledCtrl->vCtrl.Owner
365 }
366 
367 method vLabelCon.ConSetName( str newname )
368 {
369    ifdef $DESIGNING {      
370    if !*.Caption || .Caption == newname.ustr()
371    {
372       .Caption = newname.ustr()
373    }
374 }  
375    return 
376 }
377 
378 method vLabelCon.ConPosChanging()
379 {    
380    if .LabeledCtrl
381    {
382       if .pLabelPos == $lpLeft
383       {   
384          .Top = .LabeledCtrl->vCtrl.Top
385          .Height = .LabeledCtrl->vCtrl.Height         
386          .Right = .LabeledCtrl->vCtrl.Owner->vCtrl.clloc.width - .LabeledCtrl->vCtrl.Left + 5               
387       }
388       else   
389       {
390          .Left = .LabeledCtrl->vCtrl.Left + 5
391          //Label.Width = this.Width
392          .Top = .LabeledCtrl->vCtrl.Top - .Height - 3         
393       }
394    }
395 }
396 
397 /*method vLabeledEditOld vLabeledEditOld.mCreateWin <alias=vLabeledEditOld_mCreateWin>()
398 {  
399    this->vEdit.mCreateWin()   
400    this.LabelCon.ConCreateWin( this )      
401    return this
402 }
403 
404 method vLabeledEditOld.mSetOwner <alias=vLabeledEditOld_mSetOwner>( vComp newowner )
405 {
406    this->vEdit.mSetOwner( newowner )
407    this.LabelCon.ConSetOwner( )
408 }
409 
410 method uint vLabeledEditOld.mSetName <alias=vLabeledEditOld_mSetName>( str newname )
411 {
412    this.LabelCon.ConSetName( newname )
413    return 1 
414 }
415 
416 method vLabeledEditOld.mPosChanging <alias=vLabeledEditOld_mPosChanging>( eventpos evp )
417 {  
418    this->vEdit.mPosChanging( evp )
419    this.LabelCon.ConPosChanging()
420 }
421 */
422 method vLabeledComboBox vLabeledComboBox.mCreateWin <alias=vLabeledComboBox_mCreateWin>()
423 {  
424    this->vComboBox.mCreateWin()
425    this.LabelCon.ConCreateWin( this )   
426    return this
427 }
428 
429 
430 method vLabeledComboBox.mSetOwner <alias=vLabeledComboBox_mSetOwner>( vComp newowner )
431 {
432    this->vComboBox.mSetOwner( newowner )
433    this.LabelCon.ConSetOwner( )
434 }
435 
436 method uint vLabeledComboBox.mSetName <alias=vLabeledComboBox_mSetName>( str newname )
437 {
438    this.LabelCon.ConSetName( newname )
439    return 1 
440 }
441 
442 method vLabeledComboBox.mPosChanging <alias=vLabeledComboBox_mPosChanging>( eventpos evp )
443 {  
444    this->vComboBox.mPosChanging( evp )
445    this.LabelCon.ConPosChanging()
446 }
447 
448 
449 method uint vLabeledEdit.EditChange <alias=vLabeledEdit_EditChange>( evparEvent evn )
450 {
451    evn.sender = &this
452    return .OnChange.Run( evn )
453 }
454 
455 method uint vLabeledEdit.EditFocus <alias=vLabeledEdit_EditFocus>( evparValUint evn )
456 {
457    evn.sender = &this
458    return .OnFocus.Run( evn )
459 }
460 
461 
462 method uint vLabeledEdit.Btn1Click <alias=vLabeledEdit_Btn1Click>( evparEvent evn )
463 {
464    evn.sender = &this
465    return .OnBtn1Click.Run( evn )
466 }
467 
468 method uint vLabeledEdit.Btn2Click <alias=vLabeledEdit_Btn2Click>( evparEvent evn )
469 {
470    evn.sender = &this
471    return .OnBtn2Click.Run( evn )
472 }
473 
474 method vLabeledEdit vLabeledEdit.mCreateWin <alias=vLabeledEdit_mCreateWin>()
475 {
476    .CreateWin( "STATIC".ustr(), 0, 
477          $SS_NOTIFY | $WS_CHILD | $WS_VISIBLE | $WS_CLIPCHILDREN | $WS_CLIPSIBLINGS | $WS_OVERLAPPED )
478    this->vCtrl.mCreateWin()         
479    this.LabelCon.ConCreateWin( this )
480    this.pCanContain = 1
481    /*if !&this.Edit.Owner
482    {*/
483    this.Edit.Owner = this
484    this.Edit.Virtual( $mReCreateWin )   
485    this.Edit.Visible = 1
486    this.Edit.Left = 0
487    this.Edit.Top = 0
488    this.Edit.VertAlign = $alvClient
489    this.Edit.Width = 100
490    this.Edit.OnChange.Set( this, vLabeledEdit_EditChange )
491    this.Edit.OnFocus.Set( this, vLabeledEdit_EditFocus )
492    //}
493    if this.pBtn1 
494    {
495       this.pBtn1->vBtnPic.DestroyComp()
496       this.pBtn1 = 0
497    }
498    if this.pBtn2 
499    {
500       this.pBtn2->vBtnPic.DestroyComp()
501       this.pBtn2 = 0
502    }
503    
504    uint i
505    fornum i = 0, min( .pLEStyle, $lsTwoBtns )
506    {
507       uint btn 
508       btn as this.CreateComp( vBtnPic )->vBtnPic
509       btn.Top = 0
510       btn.VertAlign = $alvClient   
511       btn.HorzAlign = $alhRight
512       btn.Width = 100
513       btn.Right = 0
514       btn.pCanContain = 0
515       btn.Flat = 1
516       if i
517       {
518          btn.OnClick.Set( this, vLabeledEdit_Btn2Click )
519          btn.Image = .pBtn2Image
520          btn.Hint = .pBtn2Hint
521          this.pBtn2 = &btn                     
522       }
523       else
524       {  
525          btn.OnClick.Set( this, vLabeledEdit_Btn1Click )
526          btn.Image = .pBtn1Image
527          btn.Hint = .pBtn1Hint
528          this.pBtn1 = &btn
529       }
530       
531    }     
532    
533    eventpos evp
534    evp.loc = this.loc
535    evp.move = 0
536    .Virtual( $mPosChanging, evp ) 
537        
538    return this
539 }
540 
541 method vLabeledEdit.mSetOwner <alias=vLabeledEdit_mSetOwner>( vComp newowner )
542 {
543    this->vCtrl.mSetOwner( newowner )
544    this.LabelCon.ConSetOwner( )
545 }
546 
547 method uint vLabeledEdit.mSetName <alias=vLabeledEdit_mSetName>( str newname )
548 {
549    this.LabelCon.ConSetName( newname )
550    return 1 
551 }
552 
553 method vLabeledEdit.mPosChanging <alias=vLabeledEdit_mPosChanging>( eventpos evp )
554 {  
555    uint rightedit
556    this->vCtrl.mPosChanging( evp )   
557    if this.pBtn1
558    {
559       this.pBtn1->vBtnPic.Width = this.pBtn1->vBtnPic.Height
560       rightedit = 2 + this.pBtn1->vBtnPic.Width
561       if this.pBtn2
562       {         
563          this.pBtn2->vBtnPic.Width = this.pBtn1->vBtnPic.Height       
564          this.pBtn1->vBtnPic.Right = this.pBtn1->vBtnPic.Width
565          rightedit += this.pBtn2->vBtnPic.Width 
566       }      
567    }
568    this.Edit.Width = .Width - rightedit 
569    this.LabelCon.ConPosChanging()
570 }
571 /*------------------------------------------------------------------------------
572    Registration
573 */
574 /*method vLabeledEditOld vLabeledEditOld.init( )
575 {     
576    this.pTypeId = vLabeledEditOld          
577    return this 
578 }*/
579 
580 method vLabelCon vLabelCon.init( )
581 {
582    this.pTypeId = vLabelCon   
583    return this 
584 }  
585 
586 method vLabeledComboBox vLabeledComboBox.init( )
587 {     
588    this.pTypeId = vLabeledComboBox        
589    return this 
590 }
591 
592 method vLabeledEdit vLabeledEdit.init( )
593 {     
594    this.pTypeId = vLabeledEdit
595    return this 
596 }    
597 
598 func init_vLabeledEditOld <entry>()
599 {
600    /*regcomp( vLabeledEditOld, "vLabeledEditOld", vEdit, $vCtrl_last, 
601       %{ %{ $mCreateWin,    vLabeledEditOld_mCreateWin },
602          %{ $mSetOwner,     vLabeledEditOld_mSetOwner },
603          %{ $mSetName,     vLabeledEditOld_mSetName },
604          %{ $mPosChanging, vLabeledEditOld_mPosChanging }
605        },
606       0->collection )*/
607    regcomp( vLabelCon, "vLabelCon", vLabel, $vCtrl_last, 
608       %{ %{ $mSetCaption,    vLabelCon_mSetCaption } },
609       0->collection )
610          
611       
612    regcomp( vLabeledEdit, "vLabeledEdit", vCtrl, $vCtrl_last, 
613       %{ %{ $mCreateWin,    vLabeledEdit_mCreateWin },
614          %{ $mSetOwner,     vLabeledEdit_mSetOwner },
615          %{ $mSetName,     vLabeledEdit_mSetName },
616          %{ $mPosChanging, vLabeledEdit_mPosChanging }
617        },
618       0->collection )      
619       
620    regcomp( vLabeledComboBox, "vLabeledComboBox", vComboBox, $vCtrl_last, 
621       %{ %{ $mCreateWin,    vLabeledComboBox_mCreateWin },
622          %{ $mSetOwner,     vLabeledComboBox_mSetOwner },
623          %{ $mSetName,     vLabeledComboBox_mSetName },
624          %{ $mPosChanging, vLabeledComboBox_mPosChanging }
625        },
626       0->collection )      
627                                  
628       
629 ifdef $DESIGNING {
630    //cm.AddComp( vLabeledEditOld, 1, "Windows", "labeled" )
631    cm.AddComp( vLabeledComboBox, 1, "Windows", "labeled" )
632    cm.AddComp( vLabeledEdit, 1, "Windows", "labeled" )
633    
634    uint propcol as %{
635 "Caption"   , ustr , 0,
636 "LabelPos"  , uint , 0,
637 "AddColon"  , uint , 0
638    } 
639    uint lpcol as %{ 
640 "lpLeft",    $lpLeft,
641 "lpAbove",   $lpAbove
642    }   
643    
644    //cm.AddProps( vLabeledEditOld, propcol )   
645    cm.AddProps( vLabeledComboBox, propcol )   
646    cm.AddProps( vLabeledEdit, propcol@
647          %{ "Text"     , ustr , 0,
648             "Password" , uint , 0,
649             "MaxLen"   , uint , 0,
650             "Btn1Image", ustr , 0,
651             "Btn2Image", ustr , 0,
652             "Btn1Hint", ustr , 0,
653             "Btn2Hint", ustr , 0,
654             "LEStyle", uint, 0,
655             "Multiline", uint, 0,
656             "ScrollBars", uint, 0
657              } )
658    cm.AddEvents( vLabeledEdit, %{
659 "OnBtn1Click"   , "evparEvent",
660 "OnBtn2Click"   , "evparEvent",
661 "OnChange"      , "evparEvent"
662    })                
663  
664    //cm.AddPropVals( vLabeledEditOld, "LabelPos", lpcol )
665    cm.AddPropVals( vLabeledComboBox, "LabelPos", lpcol )
666    cm.AddPropVals( vLabeledEdit, "LabelPos", lpcol )      
667    
668    cm.AddPropVals( vLabeledEdit, "LEStyle",
669 %{ "lsSimple",  $lsSimple, 
670    "lsOneBtn",  $lsOneBtn, 
671    "lsTwoBtns", $lsTwoBtns })
672 }
673 }
Edit