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.picture 12.11.08 0.0.A.
11 *
12 * Author: Alexander Krivonogov ( gentee )
13 *
14 ******************************************************************************/
15 /* Компонента vProgressBar, порождена от vCtrl
16 События
17 */
18 type vProgressBar <inherit = vCtrl>
19 {
20 //Hidden fields
21 int pMaximum
22 int pMinimum
23 int pPosition
24 uint pOrientation
25 }
26
27 define <export>{
28 //Orientation values:
29 pboHorizontal = 0 //Горизонтальное
30 pboVertical = 1 //Вертикальное размещение
31 }
32
33 /*------------------------------------------------------------------------------
34 Internal Methods
35 */
36 method vProgressBar.iUpdateRange()
37 {
38 .WinMsg( $PBM_SETRANGE32, .pMinimum, .pMaximum )
39 }
40
41 method vProgressBar.iUpdatePos()
42 {
43 .WinMsg( $PBM_SETPOS, .pPosition )
44 }
45
46 /*------------------------------------------------------------------------------
47 Properties
48 */
49 /* Свойство int vProgressBar.Minimum - Get Set
50 Минимальное значение
51 */
52 property int vProgressBar.Minimum()
53 {
54 return this.pMinimum
55 }
56
57 property vProgressBar.Minimum( int val)
58 {
59 if this.pMinimum != val
60 {
61 this.pMinimum = val
62 .iUpdateRange()
63 }
64 }
65
66 /* Свойство int vProgressBar.Maximum - Get Set
67 Максимальное значение
68 */
69 property int vProgressBar.Maximum()
70 {
71 return this.pMaximum
72 }
73
74 property vProgressBar.Maximum( int val)
75 {
76 if this.pMaximum != val
77 {
78 this.pMaximum = val
79 .iUpdateRange()
80 }
81 }
82
83 /* Свойство int vProgressBar.Position - Get Set
84 Текущее значение
85 */
86 property int vProgressBar.Position()
87 {
88 return this.pPosition
89 }
90
91 property vProgressBar.Position( int val)
92 {
93 if this.pPosition != val
94 {
95 this.pPosition = val
96 .iUpdatePos()
97 }
98 }
99
100
101 /* Свойство uint vProgressBar.Orientation - Get Set
102 Ориентация прогресс бара (возможные значения - pbo* )
103 */
104 property uint vProgressBar.Orientation()
105 {
106 return this.pOrientation
107 }
108
109 property vProgressBar.Orientation( uint val)
110 {
111 if this.pOrientation != val
112 {
113 this.pOrientation = val
114 .SetStyle( $PBS_VERTICAL, val == $pboVertical )
115 .iUpdateRange()
116 .iUpdatePos()
117 }
118 }
119
120
121 /*------------------------------------------------------------------------------
122 Virtual methods
123 */
124 /*Виртуальный метод vProgressBar vProgressBar.mCreateWin - Создание окна
125 */
126 method vProgressBar vProgressBar.mCreateWin <alias=vProgressBar_mCreateWin>()
127 {
128 uint style = $WS_CHILD | $WS_CLIPSIBLINGS;
129 if .pOrientation == $pboVertical : style |= $PBS_VERTICAL
130 .CreateWin( "msctls_progress32".ustr(), 0, style )
131 this->vCtrl.mCreateWin()
132 .iUpdateRange()
133 .iUpdatePos()
134 return this
135 }
136
137
138 /*------------------------------------------------------------------------------
139 Registration
140 */
141 method vProgressBar vProgressBar.init( )
142 {
143 this.pTypeId = vProgressBar
144 this.pMinimum = 0
145 this.pMaximum = 100
146 this.pPosition = 0
147 this.flgRePaint = 1
148 this.flgXPStyle = 1
149 return this
150 }
151
152 func init_vProgressBar <entry>()
153 {
154 regcomp( vProgressBar, "vProgressBar", vCtrl, $vCtrl_last,
155 %{ %{$mCreateWin, vProgressBar_mCreateWin }
156 },
157 0->collection )
158
159 ifdef $DESIGNING {
160 cm.AddComp( vProgressBar, 1, "Windows", "progressbar" )
161
162 cm.AddProps( vProgressBar, %{
163 "Minimum", int, 0,
164 "Maximum", int, 0,
165 "Position", int, 0,
166 "Orientation", uint, 0
167 })
168
169 cm.AddPropVals( vProgressBar, "Orientation", %{
170 "pboHorizontal", $pboHorizontal,
171 "pboVertical" , $pboVertical } )
172 }
173 }