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\url.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.url 05.02.08 0.0.A.
 11 *
 12 * Author: Alexander Krivonogov ( gentee )
 13 *
 14 ******************************************************************************/
 15 
 16 include { 
 17    "header.g"
 18 }
 19 
 20 /* Компонента vURL, порождена от vHeader
 21 События   
 22 */
 23 type vURL <inherit = vHeader>
 24 {
 25 //Hidden fields
 26 /*   ustr     pImage   
 27    PicText  pPicText
 28 
 29    locustr  pCaption*/   
 30    locustr  pUrlCaption 
 31    locustr  pURL
 32    uint     pColorUnvis 
 33    uint     pColorVis
 34    uint     pChangeColor
 35    uint     flgVisited
 36    uint     flgClick
 37    uint     hFont   
 38    
 39 //Events   
 40    evEvent   OnClick   
 41 }
 42 
 43 extern {
 44    method vURL.mFontChanged ()
 45 }
 46 
 47 
 48 /*------------------------------------------------------------------------------
 49    Internal Methods
 50 */
 51 /*Внутренний метод vHeader.iUpdateUrl 
 52 Определяет реальный заголовок
 53 */
 54 method vURL.iUpdateUrl
 55 {
 56    this->vHeader.Caption = ?( *.pUrlCaption.Value, .pUrlCaption.Value, .pURL.Value )   
 57 } 
 58 
 59 /*------------------------------------------------------------------------------
 60    Properties
 61 */
 62 /* Свойство str vURL.Caption - Get Set
 63 Устанавливает или получает заколовок ссылки
 64 */
 65 property ustr vURL.Caption <result>
 66 {
 67    result = this.pUrlCaption.Value
 68 }
 69 
 70 property vURL.Caption( ustr val )
 71 {
 72    if val != this.pUrlCaption.Value
 73    {       
 74       this.pUrlCaption.Value = val   
 75       .iUpdateUrl()          
 76    } 
 77 }
 78 
 79 /* Свойство str vURL.ChangeColor - Get Set
 80 Устанавливает или получает флаг изменять цвет после клика
 81 */
 82 property uint vURL.ChangeColor 
 83 {
 84    return this.pChangeColor
 85 }
 86 
 87 property vURL.ChangeColor( uint val )
 88 {
 89    if val != this.pChangeColor
 90    {       
 91       this.pChangeColor = val
 92    }   
 93 }
 94 
 95 /* Свойство str vURL.URL - Get Set
 96 Устанавливает или получает строку запуска
 97 */
 98 property ustr vURL.URL <result>
 99 {
100    result = this.pURL.Value
101 }
102 
103 property vURL.URL( ustr val )
104 {
105    if val != this.pURL.Value
106    {        
107       this.pURL.Value = val   
108       .iUpdateUrl()
109    } 
110 }
111 
112 /*------------------------------------------------------------------------------
113    Windows messages
114 */
115 /*Обработка WM_PAINT - отрисовка ссылки
116 */
117 method uint vURL.wmpaint <alias=vURL_wmpaint>(winmsg wmsg)
118 {
119    uint hdc
120    PAINTSTRUCT lp   
121    hdc = BeginPaint( this.hwnd, lp )
122    
123    RECT r
124    uint hbrush = .Virtual( $mClColor, &wmsg )
125    if hbrush || !isThemed
126    {      
127       if !hbrush : hbrush = $COLOR_BTNFACE + 1   
128       r.left = 0
129       r.top = 0
130       r.right = this.loc.width
131       r.bottom = this.loc.height   
132       FillRect( hdc, r, hbrush )
133    }
134    elif isThemed 
135    {
136       pDrawThemeParentBackground->stdcall( this.hwnd, hdc, 0 );
137    }   
138    SetTextColor( hdc, ?(.pChangeColor && .flgVisited, .pColorVis, .pColorUnvis ))
139    SetBkMode( hdc, $TRANSPARENT )
140    
141    SelectObject( hdc, .pPicText.hFont )
142    .pPicText.Draw( hdc, 0, 0 )
143    
144    EndPaint( this.hwnd, lp )   
145 	return 1	   
146 }
147 
148 /*------------------------------------------------------------------------------
149    Virtual methods
150 */
151 
152 /*Виртуальный метод vURL.mMouse - События от мыши
153 */
154 method uint vURL.mMouse <alias=vURL_mMouse>( evparMouse em )
155 {
156    if em.evmtype == $evmLDown
157    {   
158       SetCapture( .hwnd )
159       .flgClick = 1
160    }
161    elif em.evmtype == $evmLUp
162    {         
163       ReleaseCapture()
164       if .flgClick 
165       {  
166          .flgClick = 0
167          .flgVisited = 1
168          POINT pt
169          RECT rect      
170          GetCursorPos( pt ) 
171          GetWindowRect( .hwnd, rect )
172          if PtInRect( rect, pt.x, pt.y )         
173          {
174             evparEvent ev
175             ev.sender = &this
176             .OnClick.run( ev )
177             if *.pURL.Text(this)
178             {
179                shell( .pURL.Text(this).str() )
180             }
181             .Invalidate()            
182          }
183       }
184    }   
185    return 1 
186 }
187 
188 /*Виртуальный метод vURL vURL.mCreateWin - Создание окна
189 */
190 method vURL vURL.mCreateWin <alias=vURL_mCreateWin>()
191 {    
192    //this->vHeader.mCreateWin()
193    .CreateWin( "GVUrl".ustr(), 0, $SS_NOTIFY | $WS_CHILD | $WS_CLIPSIBLINGS )
194    this->vCtrl.mCreateWin()
195    //this.prevwndproc = -1
196    this.pPicText.Ctrl = this
197       
198    //.mFontChanged()     
199    return this
200 }
201 
202 /*Виртуальный метод vURL vURL.mDestroyWin - Удаление окна
203 */
204 method vURL.mDestroyWin <alias=vURL_mDestroyWin> ()
205 {
206    this->vCtrl.mDestroyWin()
207    DeleteObject( .hFont )
208 }
209 
210 /*Виртуальный метод vURL vURL.mFontChanged - изменение шрифта окна
211 */
212 method vURL.mFontChanged <alias=vURL_mFontChanged> ()
213 {  
214    this->vCtrl.mFontChanged()
215    DeleteObject( .hFont )   
216       
217    LOGFONT lf
218    GetObject( this.WinMsg( $WM_GETFONT ), sizeof( LOGFONT ), &lf)
219    lf.lfUnderline=1   
220    .hFont = CreateFontIndirect( lf )
221    .pPicText.hFont = .hFont   
222    //.iUpdateSize()
223    .pPicText.iCalc()
224 }
225 
226 /*------------------------------------------------------------------------------
227    Registration
228 */
229 method vURL vURL.init( )
230 {
231    this.pTypeId = vURL
232    //this.flgRePaint = 1
233    this.loc.width = 100
234    this.loc.height = 100
235    this.pColorVis = 0x800080
236    this.pColorUnvis = 0xFF0000
237    this.pPicText.pAutoSize = 1
238    this.pPicText.pContHorzAlign = $ptLeft
239    this.pPicText.pContVertAlign = $ptTop
240    this.pChangeColor = 1
241    return this 
242 }  
243 
244 func init_vURL <entry>()
245 {  
246    WNDCLASSEX visclass
247    ustr classname = "GVUrl"
248    visclass.cbSize      = sizeof( WNDCLASSEX )
249    GetClassInfo( 0, "STATIC".ustr().ptr(), visclass )       
250    
251    visclass.hInstance   = GetModuleHandle( 0 )
252    visclass.hCursor     = LoadCursor( 0, $IDC_HAND )
253    //visclass.hbrBackground = 16
254    visclass.lpszClassName = classname.ptr()   
255    uint hclass = RegisterClassEx( &visclass )
256    
257    regcomp( vURL, "vURL", vHeader, $vCtrl_last,
258       %{ %{$mCreateWin,   vURL_mCreateWin },         
259          %{$mMouse,       vURL_mMouse },
260          %{$mFontChanged, vURL_mFontChanged },
261          %{$mDestroyWin,  vURL_mDestroyWin }
262       },
263       //0->collection 
264       %{ %{ $WM_PAINT, vURL_wmpaint } 
265       }      
266  )
267 
268 ifdef $DESIGNING {      
269    cm.AddComp( vURL, 1, "Additional", "url" )
270    
271    cm.AddProps( vURL, %{
272 "Caption"      , ustr, 0,
273 "URL"          , ustr, $PROP_LOADAFTERCHILD,
274 "ChangeColor"  , uint, 0
275    })
276    
277    cm.AddEvents( vURL, %{
278 "OnClick"      , "evparEvent"
279    })
280 }
281 }