1
2 type vBtnSys <inherit = vCtrl>
3 {
4 uint fPush
5 evEvent onclick
6 }
7
8 property vBtnSys.Push( uint val )
9 {
10 if val : val = 1
11 if this.fPush != val
12 {
13 this.fPush = val
14 .Invalidate()
15 }
16 }
17
18 property uint vBtnSys.Push()
19 {
20 return this.fPush
21 }
22
23 /*method uint vBtnSys.defproc( eventn ev )
24 {
25 switch ev.code
26 {
27 case $e_mouse
28 {
29 switch ev->eventmouse.evmtype
30 {
31 case $evmLDown
32 {
33 this.push = 1
34 SetCapture( this.hwnd )
35 this.onclick.run()
36 }
37 case $evmLUp
38 {
39 this.push = 0
40 ReleaseCapture()
41 }
42 }
43 }
44 }
45 return this->vctrl.defproc( ev )
46 }*/
47
48 method uint vBtnSys.wmpaint <alias=vBtnSys_wmpaint>( winmsg wmsg )
49 {
50 uint hdc
51 PAINTSTRUCT ps
52 RECT rect
53
54 hdc = BeginPaint( this.hwnd, ps )
55 rect.left = 0
56 rect.top = 0
57 rect.right = this.loc.width
58 rect.bottom = this.loc.height
59 DrawFrameControl( hdc, rect, 3, 1 | ?( this.fPush, 0x4200, 0 ))
60 EndPaint( this.hwnd, ps )
61 return 0
62 }
63
64 method uint vBtnSys.wmlbuttondown <alias=vBtnSys_wmlbuttondown>( winmsg wmsg )
65 {
66 this.Push = 1
67 SetCapture( this.hwnd )
68 this.onclick.run()
69 wmsg.flags = 1
70 return 0
71 }
72
73 method uint vBtnSys.wmlbuttonup <alias=vBtnSys_wmlbuttonup>( winmsg wmsg )
74 {
75 this.Push = 0
76 ReleaseCapture()
77 wmsg.flags = 1
78 return 0
79 }
80
81 method vBtnSys vBtnSys.mCreateWin <alias=vBtnSys_mCreateWin>()
82 {
83 .CreateWin( "GVForm".ustr(), 0,
84 $WS_CHILD | $WS_VISIBLE | $WS_CLIPCHILDREN | $WS_CLIPSIBLINGS | $WS_OVERLAPPED )
85 this->vCtrl.mCreateWin()
86 .WinMsg( $WM_SETFONT, GetStockObject( $DEFAULT_GUI_FONT ) )
87 return this
88 }
89
90 method vBtnSys vBtnSys.init( )
91 {
92 this.pTypeId = vBtnSys
93 this.Visible = 1
94 return this
95 }
96
97 func init_vBtnSys <entry>()
98 {
99 regcomp( vBtnSys, "vBtnSys", vCtrl, $vCtrl_last,
100 %{ %{$mCreateWin, vCustomBtn_mCreateWin}/*,
101 %{$mWinCmd, vBtn_mWinCmd},
102 %{$mLangChanged, vBtn_mLangChanged }*/},
103 %{ %{$WM_PAINT, vBtnSys_wmpaint },
104 %{$WM_LBUTTONDOWN, vBtnSys_wmlbuttondown },
105 %{$WM_LBUTTONUP, vBtnSys_wmlbuttonup }
106 } )
107 }
108
Редактировать