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

   scrollwin.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\scrollwin.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.form 15.10.07 0.0.A.
 11 *
 12 * Author: Alexander Krivonogov ( gentee )
 13 *
 14 ******************************************************************************/
 15 /* Компонента vScrollBox, порождена от vCtrl
 16 События
 17    
 18 */
 19 
 20 include {
 21    "panel.g"   
 22 }
 23 
 24 type vScrollBox <inherit = vCtrl>
 25 {
 26    vPanel panel
 27 }
 28 
 29 
 30 method vScrollBox.mPosChanged <alias=vScrollBox_mPosChanged>( eventn ev )
 31 {
 32    SCROLLINFO si
 33  /*  si.cbSize = sizeof(SCROLLINFO)
 34    si.fMask = $SIF_RANGE 
 35    GetScrollInfo( .hwnd, $SB_VERT, si )
 36      */
 37    si.fMask = $SIF_PAGE 
 38    si.nPage = this.clloc.height               
 39    SetScrollInfo( .hwnd, $SB_VERT, si, 1 )
 40       
 41    this->vCtrl.mPosChanged( ev )
 42 }
 43 
 44 method uint vScrollBox.wmscroll <alias=vScrollBox_wmscroll> ( winmsg wmsg )
 45 {
 46    //print( "scroll 1 \(wmsg.wpar)\n" )
 47    //if (wmsg.wpar & 0xFFFF) == $SB_ENDSCROLL
 48    {
 49       //print( "scroll 2\n" )
 50       switch wmsg.msg 
 51       {  
 52          case $WM_VSCROLL
 53          {  
 54             uint newpos
 55             SCROLLINFO si
 56             si.cbSize = sizeof(SCROLLINFO)
 57             si.fMask = $SIF_POS | $SIF_PAGE | $SIF_TRACKPOS           
 58             GetScrollInfo( .hwnd, $SB_VERT, si )
 59             newpos = si.nPos
 60             switch wmsg.wpar & 0xFFFF
 61             {
 62                case $SB_LINEUP : newpos -= 10
 63                case $SB_LINEDOWN : newpos += 10
 64                case $SB_PAGEUP : newpos -= si.nPage
 65                case $SB_PAGEDOWN : newpos += si.nPage
 66                case $SB_TOP    : newpos = si.nMax
 67                case $SB_BOTTOM : newpos = si.nMin
 68                case $SB_THUMBPOSITION, $SB_THUMBTRACK 
 69                {  
 70                   newpos = si.nTrackPos
 71                }
 72             }            
 73             si.fMask = $SIF_POS
 74             si.nPos = newpos
 75             .panel.Top = -newpos
 76             //print( "scroll 4 \(si.nPos)\n" )                        
 77             SetScrollInfo( .hwnd, $SB_VERT, si, 1 )
 78             
 79             wmsg.flags = 1
 80          }
 81       }
 82    }
 83    return 0
 84 }
 85 
 86 method vScrollBox vScrollBox.mCreateWin <alias=vScrollBox_mCreateWin>()
 87 {
 88    uint style = $WS_CHILD | $WS_VISIBLE | $WS_CLIPCHILDREN | $WS_CLIPSIBLINGS | 
 89                 $WS_OVERLAPPED | $WS_VSCROLL | $WS_HSCROLL 
 90    .CreateWin( /*"GvScrollBox".ustr()*/"GvForm".ustr(), 0, style )
 91    SCROLLINFO si
 92    si.cbSize = sizeof(SCROLLINFO)
 93    si.fMask = $SIF_RANGE 
 94    si.nMin = 0
 95    si.nMax = 1000              
 96    SetScrollInfo( .hwnd, $SB_VERT, si, 1 )
 97    this.prevwndproc = -1      
 98    this->vCtrl.mCreateWin()  
 99    .panel.Owner = this                                                 
100    return this
101 }
102 
103 
104 
105 /*------------------------------------------------------------------------------
106    Registration
107 */
108 method vScrollBox vScrollBox.init( )
109 {
110    this.pTypeId = vScrollBox
111    this.pCanContain = 1
112    //this.pBorder = $brdLowered   
113    this.loc.width = 100
114    this.loc.height = 100
115    this.panel.pAlign = $alhClient | $alvClient   
116    this.panel.pBorder = 0
117    return this 
118 }  
119 
120 
121 
122 
123 func init_vScrollBox <entry>()
124 {
125    /*WNDCLASSEX visclass
126    ustr classname = "GvScrollBox"    
127    with visclass
128    {
129       .cbSize      = sizeof( WNDCLASSEX )
130       //.style       = $CS_HREDRAW | $CS_VREDRAW
131       .lpfnWndProc = callback( &myproc, 4 )      
132       .hInstance   = GetModuleHandle( 0 )      
133       .hCursor     = LoadCursor( 0, $IDC_ARROW )
134       .hbrBackground = 1      
135       .lpszClassName = classname.ptr()      
136    } 
137    uint hclass = RegisterClassEx( &visclass )
138 */  
139    regcomp( vScrollBox, "vScrollBox", vCtrl, $vCtrl_last,
140       %{ %{$mCreateWin, vScrollBox_mCreateWin }, 
141          %{$mPosChanged, vScrollBox_mPosChanged }
142       },
143       %{ %{$WM_VSCROLL, vScrollBox_wmscroll },
144          %{$WM_HSCROLL, vScrollBox_wmscroll }
145       } )
146       
147 ifdef $DESIGNING {
148    cm.AddComp( vScrollBox, 1, "Windows" )
149    cm.AddProps( vScrollBox,  %{ 
150 "Caption"  , ustr,  0
151    })     
152 }
153       
154 }
155 
156 
Редактировать