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\panel.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.panel 17.07.07 0.0.A.
 11 *
 12 * Author: Alexander Krivonogov ( gentee )
 13 *
 14 ******************************************************************************/
 15 /* Компонента vPanel, порождена от vCtrl
 16 События   
 17 */
 18 type vPanel <inherit = vCtrl>
 19 {
 20 //Hidden fields
 21    locustr  pCaption  
 22    uint     pBorder
 23 }
 24 
 25 define <export>{
 26 //Стили рамки панели Border
 27    brdNone       = 0
 28    brdRaised     = 1   
 29    brdLowered    = 2
 30    brdDblRaised  = 3
 31    brdDblLowered = 4
 32    brdGroupBox   = 5   
 33 }
 34 
 35 /*------------------------------------------------------------------------------
 36    Internal Methods
 37 */
 38 /* Метод iUpdateCaption
 39 Связывает заголовок панели с визуальным отображением
 40 */
 41 method vPanel.iUpdateCaption
 42 {
 43    SetWindowText( this.hwnd, this.pCaption.Text( this ).ptr() )  
 44 }
 45 
 46 
 47 /*------------------------------------------------------------------------------
 48    Properties
 49 */
 50 /* Свойство str vPanel.Caption - Get Set
 51 Усотанавливает или получает заколовок панели
 52 */
 53 property ustr vPanel.Caption <result>
 54 {
 55    result = this.pCaption.Value
 56 }
 57 
 58 property vPanel.Caption( ustr val )
 59 {
 60    if val != this.pCaption.Value
 61    { 
 62       this.pCaption.Value = val
 63       .iUpdateCaption()
 64    } 
 65 }
 66 
 67 /* Свойство uint Border - Get Set
 68 Усотанавливает или определяет рамку панели
 69 Возможны следующие варианты:
 70 brdNone        - нет рамки,
 71 brdRaised      - рамка выпуклая,
 72 brdLowered     - рамка вдавленная,
 73 brdDblRaised   - рамка двойная выпуклая,
 74 brdDblLowered  - рамка двойная вдавленная,
 75 brdGroupBox    - в виде группы элементов
 76 */
 77 property uint vPanel.Border()
 78 {
 79    return this.pBorder
 80 }
 81 
 82 property vPanel.Border( uint val )
 83 {  
 84    uint style
 85    
 86    if this.pBorder != val
 87    {
 88       if val == $brdGroupBox || this.pBorder == $brdGroupBox
 89       {
 90          this.pBorder = val
 91          .Virtual( $mReCreateWin ) 
 92       }
 93       else
 94       {
 95          this.pBorder = val         
 96          style = GetWindowLong( this.hwnd, $GWL_EXSTYLE )
 97          style &= ~( $WS_EX_STATICEDGE | $WS_EX_WINDOWEDGE | $WS_EX_CLIENTEDGE | 
 98                      $WS_EX_DLGMODALFRAME)
 99          switch val
100          {         
101             case $brdLowered, $brdRaised :  style |= $WS_EX_STATICEDGE             	
102             case $brdDblRaised :  style |= $WS_EX_DLGMODALFRAME   
103             case $brdDblLowered :  style |= $WS_EX_CLIENTEDGE         
104          }
105          SetWindowLong( this.hwnd, $GWL_EXSTYLE, style )      
106          SetWindowPos( this.hwnd, 0, 0, 0, 0, 0, $SWP_FRAMECHANGED | 
107                      $SWP_NOACTIVATE | $SWP_NOZORDER | $SWP_NOMOVE | $SWP_NOSIZE )      
108       }   
109    }     
110 }
111 
112 /*------------------------------------------------------------------------------
113    Virtual methods
114 */
115 /*Виртуальный метод vPanel vPanel.mCreateWin - Создание окна
116 */
117 method vPanel vPanel.mCreateWin <alias=vPanel_mCreateWin>()
118 {
119    if .pBorder == $brdGroupBox
120    {       
121       .CreateWin( "BUTTON".ustr(), /*$WS_EX_CONTROLPARENT*//*0x00010000*/0/*$WS_EX_TRANSPARENT*/, 
122         $BS_GROUPBOX | $WS_CHILD | $WS_CLIPCHILDREN | $WS_CLIPSIBLINGS | $WS_OVERLAPPED )
123       //setxpstyle( this.hwnd )         
124    }
125    else   
126    {
127       uint exstyle //= $WS_EX_CONTROLPARENT
128       switch .pBorder
129       {  
130          case $brdLowered, $brdRaised:  exstyle |= $WS_EX_STATICEDGE             	
131          case $brdDblRaised  :  exstyle |= $WS_EX_DLGMODALFRAME   
132          case $brdDblLowered :  exstyle |= $WS_EX_CLIENTEDGE         
133       }
134       .CreateWin( "STATIC".ustr(), exstyle, 
135          $SS_NOTIFY | $WS_CHILD | $WS_CLIPCHILDREN | $WS_CLIPSIBLINGS | $WS_OVERLAPPED )
136      //.CreateWin( "STATIC".ustr(), exstyle, $WS_CHILD | //$WS_CLIPCHILDREN | 
137      //$WS_CLIPSIBLINGS | $WS_OVERLAPPED )//| 0x004 )    
138    }
139    
140    this->vCtrl.mCreateWin()   
141    .iUpdateCaption()
142 /*   LOGFONT lf 
143    with lf
144    {
145       .lfHeight = 10 
146       .lfWidth  = 20
147       .lfEscapement =0
148       .lfOrientation =0
149       .lfWeight = 400
150       .lfItalic =0
151       .lfUnderline=0 
152       .lfStrikeOut =0
153       .lfCharSet =0
154       .lfOutPrecision=0 
155       .lfClipPrecision =0
156       .lfQuality =1
157       .lfPitchAndFamily=0 
158       mcopy( &.lfFaceName, "Times".ustr().ptr(), 10) 
159    }
160 
161       uint f = CreateFontIndirect( lf )
162       print( "font \(f)\n" )
163    this.WinMsg( $WM_SETFONT, f )  */                                                         
164    return this
165 }
166 
167 /*Виртуальный метод vPanel.mSetName - Установка заголовка в режиме проектирования
168 */
169 method uint vPanel.mSetName <alias=vPanel_mSetName>( str newname )
170 {
171 ifdef $DESIGNING {   
172    if !.p_loading && .Caption == .Name
173    {      
174       .Caption = newname.ustr()
175    }
176 }   
177    return 1 
178 }
179 
180 /*Виртуальный метод uint vCustomBtn.mLangChanged - Изменение текущего языка
181 */
182 method vPanel.mLangChanged <alias=vPanel_mLangChanged>()
183 {
184    //.Virtual( $mUpdateCaption )
185    this->vCtrl.mLangChanged()
186    .iUpdateCaption()  
187 }
188 
189 /*Виртуальный метод uint vPanel.wmpaint - отрисовка панели 
190 */
191 method uint vPanel.wmpaint <alias=vPanel_wmpaint>(winmsg wmsg)
192 {  
193    if .pBorder == $brdGroupBox
194    {    
195    	uint hdc
196    	PAINTSTRUCT lp   
197       hdc = BeginPaint( this.hwnd, lp )
198       RECT r
199       r.left = 0
200       r.top = 0
201       r.right = this.loc.width
202       r.bottom = this.loc.height   
203       FillRect( hdc, r, $COLOR_BTNFACE + 1 )                       
204    	EndPaint( this.hwnd, lp )
205       .Invalidate()                  
206    }   
207 	return 0	   
208 }
209 
210 /*Виртуальный метод uint vPanel.wmncpaint - отрисовка неклиенсткой части панели 
211 */
212 method uint vPanel.wmncpaint <alias=vPanel_wmncpaint>(winmsg wmsg)
213 {  
214    if .pBorder == $brdRaised
215    {        
216    	uint hdc   	   
217       //dc = GetDCEx( this.hwnd, wmsg.wpar, $DCX_WINDOW | $DCX_INTERSECTRGN )
218       //GetDCEx не работает
219       PAINTSTRUCT lp         
220       hdc = GetWindowDC( this.hwnd )
221             
222       RECT r
223       GetWindowRect( this.hwnd, r )
224       r.right = r.right - r.left
225       r.bottom = r.bottom - r.top
226       r.left = 0
227       r.top = 0            
228       DrawEdge( hdc, r, 4, 0xf )
229    	ReleaseDC( this.hwnd, hdc )      
230       wmsg.flags = 1      
231    }   
232 	return 0	   
233 }
234 
235 /*method uint vPanel.wmclcolorbtn <alias=vPanel_wmclcolorbtn>(winmsg wmsg )
236 {
237    if isThemed 
238    {
239       pDrawThemeParentBackground->stdcall( getctrl(wmsg.lpar).hwnd, wmsg.wpar, 0 )
240       wmsg.flags = 1
241       return GetStockObject(5)
242    }
243    return 0
244 }
245 
246 method uint vPanel.wmerasebkgnd <alias=vPanel_wmerasebkgnd>( winmsg wmsg )
247 {
248    if isThemed
249    {   
250       pDrawThemeParentBackground->stdcall( this.hwnd, wmsg.wpar, 0 )
251       wmsg.flags = 1
252       return 1
253    }
254    return 0   
255 }*/
256 /*------------------------------------------------------------------------------
257    Registration
258 */
259 method vPanel vPanel.init( )
260 {
261    this.pTypeId = vPanel
262    this.pCanContain = 1
263    this.flgXPStyle = 1
264    this.pBorder = $brdRaised  
265    this.loc.width = 100
266    this.loc.height = 100
267    return this 
268 }  
269 
270 func init_vPanel <entry>()
271 {  
272    regcomp( vPanel, "vPanel", vCtrl, $vCtrl_last,
273       %{ %{$mCreateWin, vPanel_mCreateWin },
274          %{$mSetName,   vPanel_mSetName },
275          %{$mLangChanged,  vPanel_mLangChanged }
276       },
277       %{ %{ $WM_PAINT, vPanel_wmpaint },
278          %{ $WM_NCPAINT, vPanel_wmncpaint }}/*,
279          //%{$WM_CTLCOLORSTATIC, vPanel_wmclcolorbtn },
280          //%{$WM_ERASEBKGND, vPanel_wmerasebkgnd }}*/ )
281 
282 ifdef $DESIGNING {      
283    cm.AddComp( vPanel, 1, "Windows", "panel" )
284    
285    cm.AddProps( vPanel, %{ 
286 //"TabOrder", uint, 0,
287 "Caption" , ustr, 0,
288 "Border"  , uint, 0
289    })            
290 
291    cm.AddPropVals( vPanel, "Border", %{  
292 "brdNone"         ,  $brdNone      ,
293 "brdRaised"       ,  $brdRaised ,
294 "brdLowered"      ,  $brdLowered   ,       
295 "brdDblRaised"    ,  $brdDblRaised ,
296 "brdDblLowered"   ,  $brdDblLowered,
297 "brdGroupBox"     ,  $brdGroupBox
298    })
299 }
300 }