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\app.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.app 17.07.07 0.0.A.
 11 *
 12 * Author: Alexander Krivonogov ( gentee )
 13 *
 14 ******************************************************************************/
 15 /* Компонента vApp, порождена от vComp, существует только одна глобальная 
 16 переменная этого типа
 17 События
 18    
 19 */
 20 import "Kernel32.dll"{
 21    InitializeCriticalSection( uint )
 22    EnterCriticalSection( uint )
 23    LeaveCriticalSection( uint )
 24 }
 25 
 26 global {
 27    uint cs
 28 }
 29 
 30 define {
 31    VIRTMAX = 100
 32 }
 33 
 34 
 35 include {   
 36    "viswin.g"
 37    "images.g"
 38    "comp.g"   
 39    "fonts.g"
 40    "styles.g"
 41    "htmlhelp.g"
 42 }
 43 
 44 
 45 type vApp <inherit=vComp>{
 46    uint cursorArrow
 47    uint cursorDrag
 48    uint cursorNoDrag
 49    uint cursorSizeNS
 50    uint cursorSizeWE
 51    language       Lng
 52    ImageManager   ImgM   
 53    FontManager    FntM
 54    Styles         StyleM
 55    HelpManager    HelpM
 56    arr LoadForms of uint
 57    uint showmodalcnt
 58    evValUstr      OnHelp
 59 } 
 60 
 61 
 62 global {
 63    vApp App
 64    vApp DesApp        
 65 }
 66 
 67 
 68 ifdef $DESIGNING {
 69 global {   
 70    
 71 }
 72 }
 73 
 74 ifdef $DESIGNING
 75 {
 76 include{
 77 $"..\\..\\programs\\visedit\\manprops.g"
 78 }
 79 
 80 }
 81 
 82 func init_vComp <entry>
 83 {
 84    regcomp( vComp, "vComp", 0, $vComp_last,
 85       %{ %{$mNull,   vComp_mNull},
 86          %{$mInsert, vComp_mInsert },
 87          %{$mRemove, vComp_mRemove },
 88          %{$mPreDel, vComp_mPreDel },
 89          %{$mSetOwner, vComp_mSetOwner },
 90          %{$mLangChanged, vComp_mLangChanged },
 91          %{$mSetIndex, vComp_mSetIndex }
 92       },        
 93       0->collection )
 94       
 95 ifdef $DESIGNING {
 96    cm.AddComp( vComp )         
 97    cm.AddProps( vComp, %{ 
 98 "Name"     , str,  0,
 99 "Tag"      , uint, 0,
100 "AutoLang" , uint, 0      
101    })   
102 }      
103 }
104 
105 extern {
106    method Image vComp.GetImage( ustr pImage )
107    //method Image vComp.GetImage( ustr pImage, uint disabled )
108    method vApp.SettingChange()
109 }
110 
111 include {
112    "locustr.g"
113    "form.g"
114 }
115 
116 /*------------------------------------------------------------------------------
117    Public methods
118 */
119 
120 /*Метод Run
121 Запустить визуальное приложение
122 */
123 method vApp.Run( /*vform form*/ )
124 {   
125    MSG msg
126    //print( "app.run 1\n")
127    
128    while GetMessage( &msg, 0, 0, 0 )
129    {  
130       TranslateMessage( &msg )
131       DispatchMessage( &msg )    
132    }
133    //print( "app.run 2\n") 
134 }
135 
136 /*------------------------------------------------------------------------------
137    Virtual methods
138 */
139 
140 method vApp.mInsert <alias=vApp_mInsert>( vForm form )
141 {     
142    if form.TypeIs( vForm )
143    {      
144       this->vComp.mInsert( form )
145       /*form.pOwner = 0*/
146       //form.Virtual( $mSetOwner, &this )
147       if !form.hwnd : form.Virtual( $mCreateWin )
148    }
149 }
150 
151 /*------------------------------------------------------------------------------
152    Registration
153 */
154 
155 method vApp vApp.init()
156 {   
157    this.pTypeId = vApp  
158 
159    .cursorArrow = LoadCursor( 0, $IDC_ARROW )
160    .cursorNoDrag = LoadCursor( 0, $IDC_NO )
161    .cursorSizeNS = LoadCursor( 0, $IDC_SIZENS )
162    .cursorSizeWE = LoadCursor( 0, $IDC_SIZEWE )
163    
164    ICONINFO pi
165    RECT r
166    uint hdc = CreateCompatibleDC( 0 )                     
167    GetIconInfo( this.cursorArrow, pi )  
168    uint osb = SelectObject( hdc, pi.hbmMask )   
169    
170    uint i   
171    fornum i= 0,2
172    {
173       r.left   = 15 + i
174       r.right  = 32 - i
175       r.top    = 15 + i
176       r.bottom = 32 - i
177       FrameRect( hdc, r, CreateSolidBrush( 0 ))
178    }   
179    SelectObject( hdc, osb )      
180    DeleteDC( hdc )   
181    .cursorDrag = CreateIconIndirect( pi )      
182    DeleteObject( pi.hbmMask )   
183    DeleteObject( pi.hbmColor )
184    .FntM.Default()
185 
186 /*   fornum i=0, 64
187    {
188       fornum j=0, 32
189       {
190          //print ( "\(hex2strl( GetPixel( sdc, i, j) )) " )
191          switch GetPixel( sdc, j, i) 
192          {
193             case 0         : print( "0" )
194             case 0xFFFFFF  : print( "X" )
195             case 0xFFFFFFFF: print( "F" )
196             default : print( "." )
197          }
198          
199       }
200       print( "\n" )
201    }*/          
202    return this
203 }
204 
205 method vApp.SettingChange()
206 {      
207    loadthemefuncs()
208    themeinit()
209    .StyleM.Update()
210    return
211 }
212 
213 method vApp.delete()
214 {
215    //print( "app delete\n" )
216 }
217 
218 method Image vComp.GetImage( ustr pImage/*, uint disabled*/ )
219 {
220 ifdef $DESIGNING { 
221    uint curcomp as this
222    while !curcomp.p_designing && &curcomp.Owner
223    {         
224       curcomp as curcomp.Owner
225       if &curcomp == &App || &curcomp == &DesApp: break
226    }
227    if ( curcomp.p_designing ) 
228    {       
229       return DesApp.ImgM.GetImage( pImage )   
230    }
231 }
232    return App.ImgM.GetImage( pImage )
233 }
234 /*
235 method Image vComp.GetImage( ustr pImage )
236 {
237    return GetImage( pImage, 0 )
238 }*/
239 
240 method ImageList vComp.GetImageList( ustr pImage, uint ptrNumIml )
241 {
242 ifdef $DESIGNING { 
243    if ( this.p_designing ) {    
244    return DesApp.ImgM.GetImageList( pImage, ptrNumIml )
245    
246 }
247 }
248    return App.ImgM.GetImageList( pImage, ptrNumIml )
249 }
250 
251 method vApp.Load()
252 {
253    themeinit()
254    
255    uint i
256    fornum i, *.LoadForms
257    {            
258       .LoadForms[i]->vForm.pTypeDef = &gettypedef( .LoadForms[i]->vForm.pTypeId )
259       .LoadForms[i]->vForm.Virtual( $mLoad )
260    }
261 }
262 
263 
264 method vApp.mLangChanged <alias=vApp_mLangChanged> ( )
265 {
266    this->vComp.mLangChanged()
267    uint i
268    fornum i, *.LoadForms
269    {            
270       if !.LoadForms[i]->vForm.pOwner
271       {      
272          .LoadForms[i]->vForm.Virtual( $mLangChanged )
273       }
274    }
275 } 
276 
277 func init_vApp <entry>()
278 {  
279    regcomp( vApp, "vApp", vComp, $vComp_last,      
280       %{ %{$mInsert, vApp_mInsert},
281          %{$mLangChanged, vApp_mLangChanged}
282       },
283       0->collection )
284    App.pTypeDef = &gettypedef( App.pTypeId ) 
285    //InitCommonControls()
286    INITCOMMONCONTROLSEX iccex
287    iccex.dwICC = 0x1FF//ICC_DATE_CLASSES | ICC_WIN95_CLASSES;
288    iccex.dwSize = sizeof(INITCOMMONCONTROLSEX)    
289    InitCommonControlsEx( iccex )   
290    
291    //  cs = mem_alloc( 1024 )
292    uint hmem = GlobalAlloc( $GMEM_MOVEABLE, 1024 )
293    cs = GlobalLock( hmem )
294    //cs = GlobalAlloc( 0/*$GMEM_MOVEABLE/, 1024 )
295    InitializeCriticalSection( cs )
296 }
297