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

Реклама

Инсталлятор CreateInstall
Бесплатные и коммерческие инсталляторы

source\lib\vis\tabitem.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.tabpage 24.07.07 0.0.A.
 11 *
 12 * Author: Alexander Krivonogov ( gentee )
 13 *
 14 ******************************************************************************/
 15 
 16 
 17 
 18 /*------------------------------------------------------------------------------
 19    Internal Methods
 20 */
 21 /*Метод vTabItem.iUpdate()
 22 Обновить оконное представление
 23 */
 24 method vTabItem.iUpdate()
 25 {
 26    TCITEM tci
 27    tci.mask = $TCIF_TEXT | $TCIF_IMAGE
 28    /* | $TCIF_PARAM
 29    tci.lParam = &this*/
 30    tci.pszText = this.pCaption.Text(this).ptr()
 31    tci.iImage = .pImageIndex   
 32    .Owner->vTab.WinMsg( $TCM_SETITEMW, .pWinIndex, &tci )
 33    //InvalidateRect( .Owner->vTab.hwnd, 0->RECT, 0 )
 34    .Owner->vTab.Invalidate()
 35    UpdateWindow( .Owner->vTab.hwnd )   
 36 }
 37 
 38 /*------------------------------------------------------------------------------
 39    Properties
 40 */
 41 /* Свойство ustr Caption - Get Set
 42 Устанавливает или получает заголовок закладки
 43 */
 44 property locustr vTabItem.Caption <result>
 45 {
 46    result = .pCaption.Value
 47 }
 48 
 49 property vTabItem.Caption( ustr val )
 50 {   
 51    .pCaption.Value = val
 52    .iUpdate()       
 53 }
 54 
 55 
 56 /* Свойство uint Index - Get Set
 57 Устанавливает или получает индекс закладки
 58 */
 59 property uint vTabItem.Index
 60 {
 61    return this.TabOrder  
 62 }
 63 
 64 property vTabItem.Index( uint val )
 65 {           
 66    if this.Owner && this.Owner->vCtrl.TypeIs( vTab )
 67    {
 68       if .pIndex != val//.cidx != val
 69       {
 70          uint i         
 71          //uint curenabled = .pEnabled
 72          //this.Enabled = 0
 73          this.TabOrder = val
 74          //this.Enabled = 1
 75          this.mSetEnabled()      
 76          this.iUpdate()
 77          uint ctrls as this.Owner->vCtrl.Comps//ctrls    
 78          fornum i, this.Owner->vCtrl.pCtrls/**ctrls*/
 79          {
 80             if ctrls[i]->vCtrl.Visible : break
 81          }
 82          
 83          this.Owner->vTab.CurIndex = i
 84       }      
 85    }      
 86 }
 87 
 88 /* Свойство ustr vTab.ImageId - Get Set
 89 Устанавливает или получает картинку
 90 */
 91 property ustr vTabItem.ImageId <result>
 92 {
 93    result = this.pImageId
 94 }
 95 
 96 property vTabItem.ImageId( ustr val )
 97 {
 98    if val != this.pImageId
 99    { 
100       this.pImageId = val
101       
102       if &.Owner && .Owner->vTab.ptrImageList
103       {              
104          this.pImageIndex = .Owner->vTab.ptrImageList->ImageList.GetImageIdx( .Owner->vTab.iNumIml, val, 0 )         
105       }
106       else : this.pImageIndex = -1    
107       .iUpdate()
108       
109    }   
110 }
111 
112 /*------------------------------------------------------------------------------
113    Virtual Methods
114 */
115 
116 method vTabItem vTabItem.mCreateWin <alias=vTabItem_mCreateWin>()
117 {
118    //getch()
119    this.CreateWin( /*"GVTransparent".ustr()*//*"Static".ustr()/*"#32770".ustr()*/ "GVForm".ustr(), /*0x00010400*/0, /* |*/
120                      /*0x50000000/*0x50010444*/  $WS_CHILD | $WS_CLIPSIBLINGS | $WS_CLIPCHILDREN )   
121    this.prevwndproc = -1
122    this->vCtrl.mCreateWin()   
123    //setxpstyle( this.hwnd )
124    //SendMessage( this.hwnd, $WM_SETFONT, GetStockObject( $DEFAULT_GUI_FONT ),0 )      
125 //   setxpstyle( this.hwnd )
126    //ShowWindow( this.hwnd, 1)
127    return this
128 }
129 
130 /*method uint vTabItem.mPosChanging <alias=vTabItem_mPosChanging>( evparEvent ev )
131 {  
132    this->vCtrl.mPosChanging( ev )         
133    if this.Owner.TypeIs( vTab )
134    {           
135       uint evp as ev->eventpos         
136       evp.loc = this.Owner->vTab.pAdjLoc                     
137       if evp.move //&& evp.loc != this.loc
138       {
139          print( "adj \(evp.loc.left), \(evp.loc.top), \(evp.loc.width), \(evp.loc.height)\n" )
140          this.onposchanging.run( evp )
141         // this.SetLocation( evp.loc.left, evp.loc.top, evp.loc.width, evp.loc.height )            
142          /*SetWindowPos( this.hwnd, 0, 
143                evp.loc.left, evp.loc.top, evp.loc.width, evp.loc.height, 
144                $SWP_NOACTIVATE | $SWP_NOZORDER )            
145          RedrawWindow( this.hwnd, 0->RECT, 0, 0x507)
146    //   }
147    }
148    
149    return 0        
150 }*/
151 
152 method vTabItem.mSetVisible <alias=vTabItem_mSetVisible>( )
153 {  
154    if this.pVisible
155    {
156       uint owner = &this.GetMainForm()->vForm.ActiveControl 
157       while owner
158       {
159          if &owner->vComp.Owner == &this.Owner
160          {
161             //this.GetMainForm()->vForm.nexttab( 1 )
162             //this.nexttab(1)
163             this.SetFocus()
164             this.GetMainForm()->vForm.nexttab( 0 )
165             break
166          }
167          owner = &owner->vComp.Owner
168       }
169    }   
170    ShowWindow( this.hwnd, ?( this.pVisible, $SW_SHOWNOACTIVATE, $SW_HIDE ))
171 }
172 
173 method vTabItem.mSetEnabled <alias=vTabItem_mSetEnabled>( )
174 {
175    uint i
176    /*if .pEnabled != val
177    {*/
178       if !.pEnabled
179       {
180          .Owner->vCtrl.WinMsg( $TCM_DELETEITEM, .pWinIndex )
181          fornum i = .pIndex + 1, this.Owner->vCtrl.pCtrls//.cidx + 1, this.Owner->vCtrl.pCtrls
182          {
183             uint item as .Owner->vCtrl./*ctrls*/Comps[i]->vTabItem
184             if item.Enabled 
185             {
186                item.pWinIndex--
187             }
188          }
189          .pWinIndex = -1
190          if .Owner->vTab.CurIndex == .pIndex//.cidx 
191          {           
192             .Owner->vTab.CurIndex = .pIndex - 1//.cidx - 1            
193          }
194       }
195       else
196       {      
197          TCITEM tci
198          //tci.mask= $TCIF_TEXT | $TCIF_IMAGE
199          //tci.iImage = -1
200          uint i, winindex         
201          fornum i = 0, .pIndex//.cidx
202          {
203             uint item as .Owner->vCtrl./*ctrls*/Comps[i]->vTabItem            
204             if item.Enabled
205             {
206                winindex++
207             }
208          }
209          .pWinIndex = winindex
210          fornum i = .pIndex + 1, this.Owner->vCtrl.pCtrls//.cidx + 1, this.Owner->vCtrl.pCtrls
211          {
212             uint item as .Owner->vCtrl./*ctrls*/Comps[i]->vTabItem
213             if item.Enabled 
214             {
215                item.pWinIndex++
216             }
217          }
218          /*tci.mask = $TCIF_PARAM
219          tci.lParam = &this
220          print( "param1 = \(tci.lParam)\n" )*/
221          .Owner->vCtrl.WinMsg( $TCM_INSERTITEMW, .pWinIndex, &tci )
222          .iUpdate()
223          if .Owner->vTab.CurIndex == -1
224          {
225             .Owner->vTab.CurIndex = 0  
226          }
227          //this->vCtrl.mSetEnabled()
228       }
229       this->vCtrl.mSetEnabled()
230       .Owner->vTab.iCalcAdj()
231    //}
232 }
233 
234 /*Виртуальный метод uint vTabItem.mLangChanged - Изменение текущего языка
235 */
236 method vTabItem.mLangChanged <alias=vTabItem_mLangChanged>()
237 {   
238    .iUpdate()
239    this->vCtrl.mLangChanged()  
240 }
241 /*method vTabItem.mSetOwner <alias = vTabItem_mSetOwner> ( vComp newowner )
242 {   
243    if newowner && newowner.TypeIs( vTab )
244    {
245       this->vCtrl.mSetOwner( newowner )  
246       TCITEM tci               
247       .Owner->vTab.WinMsg( $TCM_INSERTITEMW, 0, &tci )
248       .Owner->vTab.iCalcAdj()
249       .iUpdate()    
250       eventpos evp
251       evp.code = $e_poschanging 
252       evp.move = 1
253       .Virtual( $mPosChanging, &evp )            
254    } 
255    else
256    {
257       .pOwner = 0
258    }
259 }*/
260 
261 /*------------------------------------------------------------------------------
262    Registration
263 */
264 method vTabItem vTabItem.init( )
265 {    
266    this.pTypeId = vTabItem
267    
268    this.pCanContain = 1
269    this.pVisible = 0
270    ///this.pEnabled = 0
271    this.flgXPStyle = 1
272    
273    /*WNDCLASSEX visclass
274    ustr classname = "GVTransparent"   
275    with visclass
276    {
277       .cbSize      = sizeof( WNDCLASSEX )
278       //.style       = $CS_HREDRAW | $CS_VREDRAW
279       .lpfnWndProc = callback( &myproc, 4 )
280       .cbClsExtra  = 0
281       .cbWndExtra  = 0
282       .hInstance   = GetModuleHandle( 0 )
283       .hIcon       = 0
284       .hCursor     = LoadCursor( 0, $IDC_ARROW )
285       .hbrBackground = 16
286       .lpszMenuName  = 0
287       .lpszClassName = classname.ptr()
288       .hIconSm     = 0
289    }
290    uint hclass = RegisterClassEx( &visclass )*/ 
291    return this 
292 }  
293 
294 /*method vTabItem.getprops( uint typeid, compMan cm )
295 {
296    this->vCtrl.getprops( typeid, cm)
297    cm.addprops( typeid, 
298 %{ "caption"     , str, 0})                         
299 }*/
300 /*
301 method vTabItem.getevents()
302 {
303    %{"onclick"}
304 }
305 */
306 
307 func init_vTabItem <entry>()
308 {
309    regcomp( vTabItem, "vTabItem", vCtrl, $vCtrl_last,
310       %{ %{$mCreateWin,    vTabItem_mCreateWin },
311          //%{$mPosChanging,  vTabItem_mPosChanging },
312          %{$mSetEnabled,   vTabItem_mSetEnabled },
313          %{$mSetVisible,   vTabItem_mSetVisible },
314          %{$mLangChanged,  vTabItem_mLangChanged }
315       },
316       /*%{
317       //%{$WM_CTLCOLORBTN, vTabItem_wmclcolorbtn },
318       %{$WM_CTLCOLORSTATIC, vTabItem_wmclcolorbtn },
319       %{$WM_ERASEBKGND, vTabItem_wmerasebkgnd }}*/
320       0->collection )
321 } 
322 
Редактировать