wrb 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README +28 -0
- data/Rakefile +66 -0
- data/bin/wrb +41 -0
- data/bin/wrb.bat +6 -0
- data/ext/rwin/aatree.c +192 -0
- data/ext/rwin/aatree.h +55 -0
- data/ext/rwin/extconf.rb +47 -0
- data/ext/rwin/rw_api.c +2058 -0
- data/ext/rwin/rw_devices.c +215 -0
- data/ext/rwin/rw_gdiplus.h +278 -0
- data/ext/rwin/rw_graphics.c +1583 -0
- data/ext/rwin/rw_resources.c +1988 -0
- data/ext/rwin/rw_ubfuncs.c +281 -0
- data/ext/rwin/rw_windows.c +1936 -0
- data/ext/rwin/rwin.c +451 -0
- data/ext/rwin/rwin.h +442 -0
- data/lib/rwin.rb +820 -0
- data/lib/wrb.rb +20 -0
- data/lib/wrb/applications/frmdesigner/angle.cur +0 -0
- data/lib/wrb/applications/frmdesigner/angle2.cur +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Button.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Button.rb +34 -0
- data/lib/wrb/applications/frmdesigner/controls/Checkbox.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Checkbox.rb +10 -0
- data/lib/wrb/applications/frmdesigner/controls/Combobox.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Combobox.rb +88 -0
- data/lib/wrb/applications/frmdesigner/controls/ComboboxEx.rb +97 -0
- data/lib/wrb/applications/frmdesigner/controls/Comboboxex.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/DateTimePicker.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/DateTimePicker.rb +11 -0
- data/lib/wrb/applications/frmdesigner/controls/Edit.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Edit.rb +8 -0
- data/lib/wrb/applications/frmdesigner/controls/Groupbox.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Groupbox.rb +9 -0
- data/lib/wrb/applications/frmdesigner/controls/Hotkeyctrl.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Hotkeyctrl.rb +9 -0
- data/lib/wrb/applications/frmdesigner/controls/Imagelist.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Imagelist.rb +115 -0
- data/lib/wrb/applications/frmdesigner/controls/Listbox.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Listbox.rb +77 -0
- data/lib/wrb/applications/frmdesigner/controls/Listview.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Listview.rb +157 -0
- data/lib/wrb/applications/frmdesigner/controls/Menu.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Menu.rb +198 -0
- data/lib/wrb/applications/frmdesigner/controls/Menubar.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Menubar.rb +9 -0
- data/lib/wrb/applications/frmdesigner/controls/MonthCalender.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Monthcalender.rb +9 -0
- data/lib/wrb/applications/frmdesigner/controls/Panel.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Panel.rb +30 -0
- data/lib/wrb/applications/frmdesigner/controls/Progressbar.rb +10 -0
- data/lib/wrb/applications/frmdesigner/controls/Radiobutton.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Radiobutton.rb +13 -0
- data/lib/wrb/applications/frmdesigner/controls/Rebar.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Rebar.rb +162 -0
- data/lib/wrb/applications/frmdesigner/controls/Splitter.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Splitter.rb +66 -0
- data/lib/wrb/applications/frmdesigner/controls/Static.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Static.rb +9 -0
- data/lib/wrb/applications/frmdesigner/controls/Statusbar.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Statusbar.rb +103 -0
- data/lib/wrb/applications/frmdesigner/controls/Tabctrl.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Tabctrl.rb +136 -0
- data/lib/wrb/applications/frmdesigner/controls/Timer.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Timer.rb +36 -0
- data/lib/wrb/applications/frmdesigner/controls/Toolbar.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Toolbar.rb +165 -0
- data/lib/wrb/applications/frmdesigner/controls/Trackbar.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Trackbar.rb +34 -0
- data/lib/wrb/applications/frmdesigner/controls/Treeview.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Treeview.rb +107 -0
- data/lib/wrb/applications/frmdesigner/controls/Updown.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/Updown.rb +31 -0
- data/lib/wrb/applications/frmdesigner/controls/default.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/progressbar.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/controls/unselect.bmp +0 -0
- data/lib/wrb/applications/frmdesigner/fddialogs.rb +87 -0
- data/lib/wrb/applications/frmdesigner/fdesign.rb +1315 -0
- data/lib/wrb/applications/frmdesigner/fdmodules.rb +1394 -0
- data/lib/wrb/applications/frmdesigner/fdparseform.rb +197 -0
- data/lib/wrb/applications/frmdesigner/img13.bmp +0 -0
- data/lib/wrb/base.rb +1294 -0
- data/lib/wrb/combocommon.rb +77 -0
- data/lib/wrb/commctrlconst.rb +139 -0
- data/lib/wrb/commdlg.rb +77 -0
- data/lib/wrb/components/animate.rb +114 -0
- data/lib/wrb/components/bitmap.rb +116 -0
- data/lib/wrb/components/button.rb +134 -0
- data/lib/wrb/components/canvas.rb +266 -0
- data/lib/wrb/components/checkbox.rb +118 -0
- data/lib/wrb/components/choosecolordlg.rb +87 -0
- data/lib/wrb/components/choosefontdlg.rb +142 -0
- data/lib/wrb/components/clipboard.rb +174 -0
- data/lib/wrb/components/combobox.rb +282 -0
- data/lib/wrb/components/comboboxex.rb +574 -0
- data/lib/wrb/components/cursor.rb +91 -0
- data/lib/wrb/components/datetimepicker.rb +197 -0
- data/lib/wrb/components/ddeclient.rb +180 -0
- data/lib/wrb/components/ddeserver.rb +131 -0
- data/lib/wrb/components/dialog.rb +228 -0
- data/lib/wrb/components/edit.rb +412 -0
- data/lib/wrb/components/font.rb +35 -0
- data/lib/wrb/components/form.rb +65 -0
- data/lib/wrb/components/groupbox.rb +122 -0
- data/lib/wrb/components/header.rb +479 -0
- data/lib/wrb/components/hotkeyctrl.rb +72 -0
- data/lib/wrb/components/icon.rb +109 -0
- data/lib/wrb/components/imagelist.rb +396 -0
- data/lib/wrb/components/inifile.rb +97 -0
- data/lib/wrb/components/listbox.rb +149 -0
- data/lib/wrb/components/listview.rb +1467 -0
- data/lib/wrb/components/menu.rb +592 -0
- data/lib/wrb/components/menubar.rb +84 -0
- data/lib/wrb/components/monthcalender.rb +164 -0
- data/lib/wrb/components/openfilenamedlg.rb +147 -0
- data/lib/wrb/components/pager.rb +199 -0
- data/lib/wrb/components/panel.rb +103 -0
- data/lib/wrb/components/picture.rb +55 -0
- data/lib/wrb/components/printdlg.rb +148 -0
- data/lib/wrb/components/printdlgex.rb +117 -0
- data/lib/wrb/components/printer.rb +97 -0
- data/lib/wrb/components/progressbar.rb +140 -0
- data/lib/wrb/components/radiobutton.rb +49 -0
- data/lib/wrb/components/rebar.rb +830 -0
- data/lib/wrb/components/registry.rb +408 -0
- data/lib/wrb/components/richedit.rb +1181 -0
- data/lib/wrb/components/savefilenamedlg.rb +27 -0
- data/lib/wrb/components/scintilla.rb +1298 -0
- data/lib/wrb/components/scrollbar.rb +239 -0
- data/lib/wrb/components/splitter.rb +494 -0
- data/lib/wrb/components/static.rb +198 -0
- data/lib/wrb/components/statusbar.rb +490 -0
- data/lib/wrb/components/tabctrl.rb +686 -0
- data/lib/wrb/components/timer.rb +117 -0
- data/lib/wrb/components/toolbar.rb +1107 -0
- data/lib/wrb/components/tooltip.rb +651 -0
- data/lib/wrb/components/trackbar.rb +298 -0
- data/lib/wrb/components/treeview.rb +845 -0
- data/lib/wrb/components/updown.rb +198 -0
- data/lib/wrb/ddeml.rb +241 -0
- data/lib/wrb/documents/animate.html +46 -0
- data/lib/wrb/documents/bitmap.html +69 -0
- data/lib/wrb/documents/button.html +78 -0
- data/lib/wrb/documents/canvas.html +137 -0
- data/lib/wrb/documents/checkbox.html +77 -0
- data/lib/wrb/documents/choosecolordlg.html +29 -0
- data/lib/wrb/documents/choosefontdlg.html +31 -0
- data/lib/wrb/documents/clipboard.html +31 -0
- data/lib/wrb/documents/combobox.html +117 -0
- data/lib/wrb/documents/comboboxex.html +139 -0
- data/lib/wrb/documents/control.html +53 -0
- data/lib/wrb/documents/cursor.html +45 -0
- data/lib/wrb/documents/datetimepicker.html +70 -0
- data/lib/wrb/documents/ddeclient.html +33 -0
- data/lib/wrb/documents/ddeserver.html +26 -0
- data/lib/wrb/documents/dialog.html +78 -0
- data/lib/wrb/documents/edit.html +169 -0
- data/lib/wrb/documents/empty.html +11 -0
- data/lib/wrb/documents/favicon.png +0 -0
- data/lib/wrb/documents/font.html +38 -0
- data/lib/wrb/documents/form.html +63 -0
- data/lib/wrb/documents/groupbox.html +57 -0
- data/lib/wrb/documents/header.html +85 -0
- data/lib/wrb/documents/hotkeyctrl.html +42 -0
- data/lib/wrb/documents/icon.html +45 -0
- data/lib/wrb/documents/imagelist.html +101 -0
- data/lib/wrb/documents/images/button.png +0 -0
- data/lib/wrb/documents/images/checkbox.png +0 -0
- data/lib/wrb/documents/images/combobox.png +0 -0
- data/lib/wrb/documents/images/comboboxex.png +0 -0
- data/lib/wrb/documents/images/datetimepicker.png +0 -0
- data/lib/wrb/documents/images/edit.png +0 -0
- data/lib/wrb/documents/images/groupbox.png +0 -0
- data/lib/wrb/documents/images/hotkeyctrl.png +0 -0
- data/lib/wrb/documents/images/listbox.png +0 -0
- data/lib/wrb/documents/images/listview.png +0 -0
- data/lib/wrb/documents/images/menu.png +0 -0
- data/lib/wrb/documents/images/menubar.png +0 -0
- data/lib/wrb/documents/images/monthcalender.png +0 -0
- data/lib/wrb/documents/images/progressbar.png +0 -0
- data/lib/wrb/documents/images/radiobutton.png +0 -0
- data/lib/wrb/documents/images/rebar.png +0 -0
- data/lib/wrb/documents/images/richedit.png +0 -0
- data/lib/wrb/documents/images/splitter.png +0 -0
- data/lib/wrb/documents/images/static.png +0 -0
- data/lib/wrb/documents/images/statusbar.png +0 -0
- data/lib/wrb/documents/images/tabctrl.png +0 -0
- data/lib/wrb/documents/images/toolbar.png +0 -0
- data/lib/wrb/documents/images/tooltip.png +0 -0
- data/lib/wrb/documents/images/trackbar.png +0 -0
- data/lib/wrb/documents/images/treeview.png +0 -0
- data/lib/wrb/documents/images/updown.png +0 -0
- data/lib/wrb/documents/index.html +155 -0
- data/lib/wrb/documents/inifile.html +36 -0
- data/lib/wrb/documents/license.txt +22 -0
- data/lib/wrb/documents/listbox.html +96 -0
- data/lib/wrb/documents/listview.html +277 -0
- data/lib/wrb/documents/make_doc.rb +596 -0
- data/lib/wrb/documents/menu.html +144 -0
- data/lib/wrb/documents/menubar.html +54 -0
- data/lib/wrb/documents/monthcalender.html +48 -0
- data/lib/wrb/documents/openfilenamedlg.html +36 -0
- data/lib/wrb/documents/pager.html +63 -0
- data/lib/wrb/documents/panel.html +32 -0
- data/lib/wrb/documents/picture.html +48 -0
- data/lib/wrb/documents/printdlg.html +35 -0
- data/lib/wrb/documents/printdlgex.html +35 -0
- data/lib/wrb/documents/printer.html +40 -0
- data/lib/wrb/documents/progressbar.html +69 -0
- data/lib/wrb/documents/radiobutton.html +51 -0
- data/lib/wrb/documents/rebar.html +143 -0
- data/lib/wrb/documents/registry.html +36 -0
- data/lib/wrb/documents/richedit.html +232 -0
- data/lib/wrb/documents/samples/editimg.bmp +0 -0
- data/lib/wrb/documents/samples/editimg.iml +0 -0
- data/lib/wrb/documents/samples/fileimg.bmp +0 -0
- data/lib/wrb/documents/samples/fileimg.iml +0 -0
- data/lib/wrb/documents/samples/sample_button.rb +21 -0
- data/lib/wrb/documents/samples/sample_checkbox.rb +18 -0
- data/lib/wrb/documents/samples/sample_combobox.rb +18 -0
- data/lib/wrb/documents/samples/sample_comboboxex.rb +23 -0
- data/lib/wrb/documents/samples/sample_datetimepicker.rb +11 -0
- data/lib/wrb/documents/samples/sample_edit.rb +25 -0
- data/lib/wrb/documents/samples/sample_groupbox.rb +19 -0
- data/lib/wrb/documents/samples/sample_hotkeyctrl.rb +12 -0
- data/lib/wrb/documents/samples/sample_listbox.rb +12 -0
- data/lib/wrb/documents/samples/sample_listview.rb +32 -0
- data/lib/wrb/documents/samples/sample_menu.rb +21 -0
- data/lib/wrb/documents/samples/sample_menubar.rb +23 -0
- data/lib/wrb/documents/samples/sample_monthcalender.rb +11 -0
- data/lib/wrb/documents/samples/sample_progressbar.rb +14 -0
- data/lib/wrb/documents/samples/sample_radiobutton.rb +14 -0
- data/lib/wrb/documents/samples/sample_rebar.rb +25 -0
- data/lib/wrb/documents/samples/sample_richedit.rb +60 -0
- data/lib/wrb/documents/samples/sample_splitter.rb +33 -0
- data/lib/wrb/documents/samples/sample_static.rb +15 -0
- data/lib/wrb/documents/samples/sample_statusbar.rb +17 -0
- data/lib/wrb/documents/samples/sample_tabctrl.rb +19 -0
- data/lib/wrb/documents/samples/sample_toolbar.rb +29 -0
- data/lib/wrb/documents/samples/sample_tooltip.rb +50 -0
- data/lib/wrb/documents/samples/sample_trackbar.rb +30 -0
- data/lib/wrb/documents/samples/sample_treeview.rb +19 -0
- data/lib/wrb/documents/samples/sample_updown.rb +18 -0
- data/lib/wrb/documents/samples/sampleimg16.iml +0 -0
- data/lib/wrb/documents/samples/sampleimg32.iml +0 -0
- data/lib/wrb/documents/samples/samplemg16.png +0 -0
- data/lib/wrb/documents/samples/samplemg32.png +0 -0
- data/lib/wrb/documents/samples/wrb.ico +0 -0
- data/lib/wrb/documents/savefilenamedlg.html +19 -0
- data/lib/wrb/documents/scrollbar.html +60 -0
- data/lib/wrb/documents/splitter.html +96 -0
- data/lib/wrb/documents/static.html +84 -0
- data/lib/wrb/documents/statusbar.html +110 -0
- data/lib/wrb/documents/tabctrl.html +151 -0
- data/lib/wrb/documents/timer.html +43 -0
- data/lib/wrb/documents/toolbar.html +181 -0
- data/lib/wrb/documents/tooltip.html +131 -0
- data/lib/wrb/documents/trackbar.html +107 -0
- data/lib/wrb/documents/treeview.html +210 -0
- data/lib/wrb/documents/updown.html +85 -0
- data/lib/wrb/documents/wincontrol.html +258 -0
- data/lib/wrb/documents/window.html +499 -0
- data/lib/wrb/documents/wrb.css +228 -0
- data/lib/wrb/gmem.rb +26 -0
- data/lib/wrb/imecommon.rb +59 -0
- data/lib/wrb/listcommon.rb +185 -0
- data/lib/wrb/lzss.rb +126 -0
- data/lib/wrb/scrollinfo.rb +142 -0
- data/lib/wrb/toplevelcommon.rb +634 -0
- metadata +315 -0
@@ -0,0 +1,198 @@
|
|
1
|
+
require 'wrb'
|
2
|
+
|
3
|
+
module WR
|
4
|
+
module RC
|
5
|
+
SS_LEFT = 0x00000000
|
6
|
+
SS_CENTER = 0x00000001
|
7
|
+
SS_RIGHT = 0x00000002
|
8
|
+
SS_ICON = 0x00000003
|
9
|
+
SS_BLACKRECT = 0x00000004
|
10
|
+
SS_GRAYRECT = 0x00000005
|
11
|
+
SS_WHITERECT = 0x00000006
|
12
|
+
SS_BLACKFRAME = 0x00000007
|
13
|
+
SS_GRAYFRAME = 0x00000008
|
14
|
+
SS_WHITEFRAME = 0x00000009
|
15
|
+
SS_USERITEM = 0x0000000A
|
16
|
+
SS_SIMPLE = 0x0000000B
|
17
|
+
SS_LEFTNOWORDWRAP = 0x0000000C
|
18
|
+
SS_OWNERDRAW = 0x0000000D
|
19
|
+
SS_BITMAP = 0x0000000E
|
20
|
+
SS_ENHMETAFILE = 0x0000000F
|
21
|
+
SS_ETCHEDHORZ = 0x00000010
|
22
|
+
SS_ETCHEDVERT = 0x00000011
|
23
|
+
SS_ETCHEDFRAME = 0x00000012
|
24
|
+
SS_TYPEMASK = 0x0000001F
|
25
|
+
SS_REALSIZECONTROL = 0x00000040
|
26
|
+
SS_NOPREFIX = 0x00000080
|
27
|
+
SS_NOTIFY = 0x00000100
|
28
|
+
SS_CENTERIMAGE = 0x00000200
|
29
|
+
SS_RIGHTJUST = 0x00000400
|
30
|
+
SS_REALSIZEIMAGE = 0x00000800
|
31
|
+
SS_SUNKEN = 0x00001000
|
32
|
+
SS_EDITCONTROL = 0x00002000
|
33
|
+
SS_ENDELLIPSIS = 0x00004000
|
34
|
+
SS_PATHELLIPSIS = 0x00008000
|
35
|
+
SS_WORDELLIPSIS = 0x0000C000
|
36
|
+
SS_ELLIPSISMASK = 0x0000C000
|
37
|
+
|
38
|
+
STM_SETICON = 0x0170
|
39
|
+
STM_GETICON = 0x0171
|
40
|
+
STM_SETIMAGE = 0x0172
|
41
|
+
STM_GETIMAGE = 0x0173
|
42
|
+
STM_MSGMAX = 0x0174
|
43
|
+
|
44
|
+
STN_CLICKED = 0
|
45
|
+
STN_DBLCLK = 1
|
46
|
+
STN_ENABLE = 2
|
47
|
+
STN_DISABLE = 3
|
48
|
+
|
49
|
+
IMAGE_BITMAP = 0
|
50
|
+
IMAGE_ICON = 1
|
51
|
+
IMAGE_CURSOR = 2
|
52
|
+
IMAGE_ENHMETAFILE = 3
|
53
|
+
end
|
54
|
+
|
55
|
+
#This control provides the user with informational text that typically require no response.
|
56
|
+
# <br>See also <a href="https://docs.microsoft.com/en-us/windows/desktop/Controls/
|
57
|
+
# window-controls"> Windows Control section of Microsoft Docs.</a>
|
58
|
+
class Static < WinControl
|
59
|
+
include ModStdCtrl
|
60
|
+
|
61
|
+
WinStyles = {
|
62
|
+
:left => SS_LEFT,
|
63
|
+
:center => SS_CENTER,
|
64
|
+
:right => SS_RIGHT,
|
65
|
+
:icon => SS_ICON,
|
66
|
+
:blackrect => SS_BLACKRECT,
|
67
|
+
:grayrect => SS_GRAYRECT,
|
68
|
+
:whiterect => SS_WHITERECT,
|
69
|
+
:blackframe => SS_BLACKFRAME,
|
70
|
+
:grayframe => SS_GRAYFRAME,
|
71
|
+
:whiteframe => SS_WHITEFRAME,
|
72
|
+
:useritem => SS_USERITEM,
|
73
|
+
:simple => SS_SIMPLE,
|
74
|
+
:leftnowordwrap => SS_LEFTNOWORDWRAP,
|
75
|
+
:ownerdraw => SS_OWNERDRAW,
|
76
|
+
:bitmap => SS_BITMAP,
|
77
|
+
:enhmetafile => SS_ENHMETAFILE,
|
78
|
+
:etchedhorz => SS_ETCHEDHORZ,
|
79
|
+
:etchedvert => SS_ETCHEDVERT,
|
80
|
+
:etchedframe => SS_ETCHEDFRAME,
|
81
|
+
:realsizecontrol => SS_REALSIZECONTROL,
|
82
|
+
:noprefix => SS_NOPREFIX,
|
83
|
+
:notify => SS_NOTIFY,
|
84
|
+
:centerimage => SS_CENTERIMAGE,
|
85
|
+
:rightjust => SS_RIGHTJUST,
|
86
|
+
:realsizeimage => SS_REALSIZEIMAGE,
|
87
|
+
:sunken => SS_SUNKEN,
|
88
|
+
:editcontrol => SS_EDITCONTROL,
|
89
|
+
:endellipsis => SS_ENDELLIPSIS,
|
90
|
+
:pathellipsis => SS_PATHELLIPSIS,
|
91
|
+
:wordellipsis => SS_WORDELLIPSIS,
|
92
|
+
# :typemask => SS_TYPEMASK,
|
93
|
+
# :ellipsismask => SS_ELLIPSISMASK
|
94
|
+
}
|
95
|
+
PreDefinedEvents = {
|
96
|
+
:clicked => [WM_COMMAND, STN_CLICKED, 'hi'],
|
97
|
+
:dblclk => [WM_COMMAND, STN_DBLCLK, 'hi'],
|
98
|
+
:enable => [WM_COMMAND, STN_ENABLE, 'hi'],
|
99
|
+
:disable => [WM_COMMAND, STN_DISABLE, 'hi']
|
100
|
+
}
|
101
|
+
|
102
|
+
# ( No default event )
|
103
|
+
DefaultEvents=[]
|
104
|
+
|
105
|
+
# def self.sym2style(*args) _sym2style(WinStyles, args); end
|
106
|
+
|
107
|
+
def initialize(*args)
|
108
|
+
super
|
109
|
+
@_classname = "STATIC"
|
110
|
+
@_acceptable_events = PreDefinedEvents.dup
|
111
|
+
end
|
112
|
+
#
|
113
|
+
def create()
|
114
|
+
super
|
115
|
+
self.icon = @_icon if @_icon
|
116
|
+
self.bitmap = @_bitmap if @_bitmap
|
117
|
+
self.cursor = @_cursor if @_cursor
|
118
|
+
end
|
119
|
+
|
120
|
+
# Retreives an Icon whicih asociated with this static control
|
121
|
+
def icon()
|
122
|
+
alive? ? APP.hrsc2ref(SendMessage(STM_GETIMAGE, IMAGE_ICON, 0)) : @_icon
|
123
|
+
end
|
124
|
+
# Associates an Icon with this static control.
|
125
|
+
def icon=(ico)
|
126
|
+
alive? ? SendMessage(STM_SETIMAGE, IMAGE_ICON, ico._hicon) : @_icon=ico
|
127
|
+
end
|
128
|
+
|
129
|
+
# Retreives a Bitmap whicih asociated with this static control
|
130
|
+
def bitmap()
|
131
|
+
alive? ? APP.hrsc2ref(SendMessage(STM_GETIMAGE, IMAGE_BITMAP, 0)) : @_bitmap
|
132
|
+
end
|
133
|
+
# Associates a Bitmap with this static control.
|
134
|
+
def bitmap=(bmp)
|
135
|
+
alive? ? SendMessage(STM_SETIMAGE, IMAGE_BITMAP, bmp._hddbitmap) : @_bitmap=bmp
|
136
|
+
end
|
137
|
+
|
138
|
+
# Retreives a Cursor whicih asociated with this static control
|
139
|
+
def cursor()
|
140
|
+
alive? ? APP.hrsc2ref(SendMessage(STM_GETIMAGE, IMAGE_CURSOR, 0)) : @_cursor
|
141
|
+
end
|
142
|
+
# Associates a Cursor with this static control.
|
143
|
+
def cursor=(cur)
|
144
|
+
alive? ? SendMessage(STM_SETIMAGE, IMAGE_CURSOR, bmp._hcursor) : @_cursor=cur
|
145
|
+
end
|
146
|
+
|
147
|
+
protected
|
148
|
+
def _apply_options(arg)
|
149
|
+
if st=WinStyles[arg]
|
150
|
+
@_style |= st
|
151
|
+
return nil
|
152
|
+
end
|
153
|
+
super
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
module WR
|
159
|
+
class MyForm < Form
|
160
|
+
class MyStatic < Static
|
161
|
+
def create()
|
162
|
+
super
|
163
|
+
self.style |= SS_OWNERDRAW
|
164
|
+
parent.register_event WM_DRAWITEM, '__mystatic_ownerdraw', 'xs', DRAWITEMSTRUCT, self
|
165
|
+
end
|
166
|
+
def __mystatic_ownerdraw(di)
|
167
|
+
return unless di.ctlID == self.idcmd
|
168
|
+
cv = Canvas.new(di.hDC)
|
169
|
+
cv.Transparent
|
170
|
+
cv.TextOut(0, 0, self.caption)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
|
175
|
+
def initialize()
|
176
|
+
resize 640, 480
|
177
|
+
_<< MyStatic[:st1, "Static", 0, 0, 64, 64, :icon]
|
178
|
+
_<< MyStatic[:st2, "Static", 0, 64, 64, 64, :bitmap]
|
179
|
+
_.st1.icon = Icon.fromfile('../resources/win32.ico')
|
180
|
+
_.st2.bitmap = Bitmap.fromfile('../resources/clip.bmp')
|
181
|
+
_<< MyStatic[:mstt1, "MyStatic", 0, 128, 100, 24, :ownerdraw]
|
182
|
+
register_event WM_PAINT, 'self_paint', 'c'
|
183
|
+
end
|
184
|
+
|
185
|
+
def created()
|
186
|
+
_.st1.icon = Icon.fromfile('../resources/win32.ico') # not work after created
|
187
|
+
dpp _st1.icon # not work after created
|
188
|
+
# _.st2.bitmap = Bitmap.fromfile('../resources/clip.bmp')
|
189
|
+
# dpp _st2.bitmap
|
190
|
+
end
|
191
|
+
|
192
|
+
def self_paint(cv)
|
193
|
+
cv.FillRect(0, 0, w, h, 0xffffff)
|
194
|
+
end
|
195
|
+
|
196
|
+
self.start
|
197
|
+
end
|
198
|
+
end if __FILE__ == $0
|
@@ -0,0 +1,490 @@
|
|
1
|
+
require 'wrb'
|
2
|
+
require 'wrb/commctrlconst'
|
3
|
+
|
4
|
+
module WR
|
5
|
+
module RC
|
6
|
+
SB_SETTEXTA = WM_USER+1
|
7
|
+
SB_GETTEXTA = WM_USER+2
|
8
|
+
SB_GETTEXTLENGTHA = WM_USER+3
|
9
|
+
SB_SETPARTS = WM_USER+4
|
10
|
+
SB_GETPARTS = WM_USER+6
|
11
|
+
SB_GETBORDERS = WM_USER+7
|
12
|
+
SB_SETMINHEIGHT = WM_USER+8
|
13
|
+
SB_SIMPLE = WM_USER+9
|
14
|
+
SB_GETRECT = WM_USER+10
|
15
|
+
SB_SETTEXTW = WM_USER+11
|
16
|
+
SB_GETTEXTLENGTHW = WM_USER+12
|
17
|
+
SB_GETTEXTW = WM_USER+13
|
18
|
+
SB_ISSIMPLE = WM_USER+14
|
19
|
+
SB_SETICON = WM_USER+15
|
20
|
+
SB_SETTIPTEXTA = WM_USER+16
|
21
|
+
SB_SETTIPTEXTW = WM_USER+17
|
22
|
+
SB_GETTIPTEXTA = WM_USER+18
|
23
|
+
SB_GETTIPTEXTW = WM_USER+19
|
24
|
+
SB_GETICON = WM_USER+20
|
25
|
+
SB_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT
|
26
|
+
SB_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT
|
27
|
+
|
28
|
+
if RWin::UNICODE
|
29
|
+
SB_SETTEXT = SB_SETTEXTW
|
30
|
+
SB_GETTEXT = SB_GETTEXTW
|
31
|
+
SB_GETTEXTLENGTH = SB_GETTEXTLENGTHW
|
32
|
+
SB_SETTIPTEXT = SB_SETTIPTEXTW
|
33
|
+
SB_GETTIPTEXT = SB_GETTIPTEXTW
|
34
|
+
else
|
35
|
+
SB_SETTEXT = SB_SETTEXTA
|
36
|
+
SB_GETTEXT = SB_GETTEXTA
|
37
|
+
SB_GETTEXTLENGTH = SB_GETTEXTLENGTHA
|
38
|
+
SB_SETTIPTEXT = SB_SETTIPTEXTA
|
39
|
+
SB_GETTIPTEXT = SB_GETTIPTEXTA
|
40
|
+
end
|
41
|
+
|
42
|
+
SBT_NOBORDERS = 0x0100
|
43
|
+
SBT_POPOUT = 0x0200
|
44
|
+
SBT_RTLREADING = 0x0400
|
45
|
+
SBT_TOOLTIPS = 0x0800
|
46
|
+
SBT_NOTABPARSING = 0x0800
|
47
|
+
SBT_OWNERDRAW = 0x1000
|
48
|
+
|
49
|
+
SBARS_SIZEGRIP = 0x100
|
50
|
+
SBARS_TOOLTIPS = 0x800
|
51
|
+
|
52
|
+
SB_SETBKCOLOR = CCM_SETBKCOLOR
|
53
|
+
|
54
|
+
SBN_FIRST = -880
|
55
|
+
SBN_SIMPLEMODECHANGE = SBN_FIRST - 0
|
56
|
+
|
57
|
+
SB_SIMPLEID = 0xff
|
58
|
+
end
|
59
|
+
|
60
|
+
# A horizontal window at the bottom of a parent window in which an application can display various kinds of status information.
|
61
|
+
# <br>See also <a href="https://docs.microsoft.com/en-us/windows/desktop/Controls/
|
62
|
+
# window-controls"> Windows Control section of Microsoft Docs.</a>
|
63
|
+
class Statusbar < WinControl
|
64
|
+
include ModParent
|
65
|
+
class Part # wrapper of index
|
66
|
+
include RC
|
67
|
+
# include ModUtil
|
68
|
+
SB_MAXTEXTSISE = 127
|
69
|
+
|
70
|
+
PartTypes ={
|
71
|
+
:noborders => SBT_NOBORDERS,
|
72
|
+
:popout => SBT_POPOUT,
|
73
|
+
:rtlreading => SBT_RTLREADING,
|
74
|
+
:notabparsing => SBT_NOTABPARSING,
|
75
|
+
:ownerdraw => SBT_OWNERDRAW
|
76
|
+
}
|
77
|
+
|
78
|
+
def initialize(*args)
|
79
|
+
@owner = args.shift if args[0].is_a?(Statusbar)
|
80
|
+
raise ArgumentError, "No index given" unless args[0].is_a?(Integer)
|
81
|
+
@_index = args.shift
|
82
|
+
return if args.empty?
|
83
|
+
typ = 0
|
84
|
+
while args.last.is_a?(Symbol)
|
85
|
+
if pt=PartTypes[args.pop]
|
86
|
+
typ |= pt
|
87
|
+
end
|
88
|
+
end #; dp "@%p", args
|
89
|
+
self.width = args.shift if args[0].is_a?(Integer)
|
90
|
+
txt, img, ty = args
|
91
|
+
typ |= ty.to_i
|
92
|
+
@_text, @_iimage, @_type = txt, img, typ
|
93
|
+
end
|
94
|
+
|
95
|
+
def index()
|
96
|
+
@_index
|
97
|
+
end
|
98
|
+
def index=(idx)
|
99
|
+
@_index = idx
|
100
|
+
end
|
101
|
+
|
102
|
+
def set_attributes_on_create(idx)
|
103
|
+
raise RuntimeError "Window not alive #{@owner}" unless @owner.alive?
|
104
|
+
@_index = idx
|
105
|
+
self.type = @_type if @_type
|
106
|
+
self.text = @_text if @_text
|
107
|
+
self.iimage = @_iimage if @_iimage
|
108
|
+
self.tiptext = @_tiptext if @_tiptext
|
109
|
+
end
|
110
|
+
|
111
|
+
def owner=(tgt)
|
112
|
+
@owner = tgt
|
113
|
+
end
|
114
|
+
|
115
|
+
def type()
|
116
|
+
if @owner.alive?
|
117
|
+
r = @owner.SendMessage(SB_GETTEXTLENGTH, @_index, 0)
|
118
|
+
r==0 ? @_type : HIWORD(r)
|
119
|
+
else
|
120
|
+
@_type
|
121
|
+
end
|
122
|
+
end
|
123
|
+
def type=(typ)
|
124
|
+
if @owner.alive?
|
125
|
+
if typ.is_a?(Symbol)
|
126
|
+
typ = PartTypes[typ] || 0
|
127
|
+
end
|
128
|
+
txt = self.text
|
129
|
+
@owner.SendMessage(SB_SETTEXT, @_index | typ, _I(txt))
|
130
|
+
@owner.refresh
|
131
|
+
else
|
132
|
+
@_type = typ
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def text()
|
137
|
+
if @owner.alive?
|
138
|
+
len = (@owner.SendMessage(SB_GETTEXTLENGTH, @_index, 0) & 0xff) + 1
|
139
|
+
buff = TCHAR[len]
|
140
|
+
len = @owner.SendMessage(SB_GETTEXT, @_index, buff);
|
141
|
+
len==0 ? @_text : buff.to_s[0, len & 0xff].rstrip
|
142
|
+
else
|
143
|
+
@_text
|
144
|
+
end
|
145
|
+
end
|
146
|
+
def text=(txt)
|
147
|
+
if @owner.alive?
|
148
|
+
style = SPLITPARAM(@owner.SendMessage(SB_GETTEXT, @_index, 0))[1]
|
149
|
+
@owner.SendMessage(SB_SETTEXT, @_index | style, _I(txt))
|
150
|
+
else
|
151
|
+
@_text = txt
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def width()
|
156
|
+
@owner.alive? ? @owner._get_width(@_index)||@_width : @_width
|
157
|
+
end
|
158
|
+
|
159
|
+
def width=(w)
|
160
|
+
@owner.alive? ? @owner._set_width(@_index, w) : @_width=w
|
161
|
+
end
|
162
|
+
|
163
|
+
def rect()
|
164
|
+
rect = RECT.new
|
165
|
+
@owner.SendMessage(SB_GETRECT, @_index, rect)
|
166
|
+
rect
|
167
|
+
end
|
168
|
+
|
169
|
+
def tiptext() # Causes SEGV if not defined tiptext
|
170
|
+
buff = TCHAR[SB_MAXTEXTSISE];
|
171
|
+
@owner.SendMessage(SB_GETTIPTEXT, MAKELPARAM(@_index, SB_MAXTEXTSISE), buff)
|
172
|
+
buff.to_s
|
173
|
+
end
|
174
|
+
def tiptext=(txt)
|
175
|
+
if txt.nil?
|
176
|
+
str = ""
|
177
|
+
else
|
178
|
+
str = API.encode_internal(txt)
|
179
|
+
raise ArgumentError, "text size must less than #{SB_MAXTEXTSISE}", caller(1) if str.size > SB_MAXTEXTSISE
|
180
|
+
end
|
181
|
+
if @owner.alive?
|
182
|
+
@owner.SendMessage(SB_SETTIPTEXT, @_index, str)
|
183
|
+
else
|
184
|
+
@_tiptext = str
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def icon()
|
189
|
+
@owner._get_icon(@_index)
|
190
|
+
end
|
191
|
+
def icon=(ico)
|
192
|
+
@owner._set_icon(@_index, ico)
|
193
|
+
end
|
194
|
+
|
195
|
+
def iimage()
|
196
|
+
return nil unless (ico=@owner.__send__(:_get_icon, @_index))
|
197
|
+
@owner.imagelist._icons.index{|i| ico._hicon == i}
|
198
|
+
end
|
199
|
+
def iimage=(idx) # NG, icon will be destroyed soon.
|
200
|
+
raise RuntimeError, "imagelist does not exists", caller(1) unless @owner.imagelist
|
201
|
+
ico = idx ? @owner.imagelist.icon(idx) : nil
|
202
|
+
@owner.imagelist.set_hicon(idx, ico._hicon) if idx
|
203
|
+
@owner.__send__(:_set_icon, @_index, ico)
|
204
|
+
end
|
205
|
+
|
206
|
+
def _part()
|
207
|
+
[@_width, @_text, @_iimage, @_type]
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
################### Main ###################
|
212
|
+
include ModCommCtrl
|
213
|
+
# include ModParent
|
214
|
+
|
215
|
+
WinStyles = {
|
216
|
+
:sizegrip => SBARS_SIZEGRIP,
|
217
|
+
:tooltips => SBARS_TOOLTIPS
|
218
|
+
}
|
219
|
+
|
220
|
+
PreDefinedEvents = {
|
221
|
+
:click => [WM_NOTIFY, NM_CLICK, 'xs', NMMOUSE],
|
222
|
+
:dblclk => [WM_NOTIFY, NM_DBLCLK, 'xs', NMMOUSE],
|
223
|
+
:rclick => [WM_NOTIFY, NM_RCLICK, 'xs', NMMOUSE],
|
224
|
+
:rdblclk => [WM_NOTIFY, NM_RDBLCLK, 'xs', NMMOUSE],
|
225
|
+
:simplemodechange => [WM_NOTIFY, SBN_SIMPLEMODECHANGE, 'i']
|
226
|
+
}
|
227
|
+
DefaultEvents = []
|
228
|
+
|
229
|
+
IARRAY = API.defstruct 'int[256]'
|
230
|
+
|
231
|
+
attr_reader :_icons
|
232
|
+
def initialize(*args)
|
233
|
+
super
|
234
|
+
@_classname = "msctls_statusbar32"
|
235
|
+
@_acceptable_events = PreDefinedEvents.dup
|
236
|
+
@_widths = []
|
237
|
+
@minus1pos = @_widths.index(-1)
|
238
|
+
@_parts = []
|
239
|
+
end
|
240
|
+
#
|
241
|
+
def create()
|
242
|
+
super
|
243
|
+
parent.register_event(WM_SIZE, '__statusbar_resize__', 'ii', self) # refrection
|
244
|
+
if @_simple
|
245
|
+
SendMessage(SB_SETTEXT, SB_SIMPLEID, _I(self.caption))
|
246
|
+
self.simple = @_simple;
|
247
|
+
end
|
248
|
+
@_parts.each_with_index{|v, i| insert(i, v)}
|
249
|
+
@_parts.clear
|
250
|
+
end
|
251
|
+
|
252
|
+
# Sets a caption of this status bar.<br>
|
253
|
+
# If simple mode displayd this, oherwise not.
|
254
|
+
def caption=(str)#; dp "@simple=%p, caption=%p", simple, caption
|
255
|
+
if simple
|
256
|
+
SendMessage(SB_SETTEXT, SB_SIMPLEID, _I(str))
|
257
|
+
else
|
258
|
+
super
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
# Inserts a part into this statusbar with specified index and argument.<br>
|
263
|
+
# Give an array of [width, text, image, type] or a Statusbar::Part as argument.
|
264
|
+
def insert(idx, arg) # dpp idx, arg, @_widths
|
265
|
+
if alive?
|
266
|
+
if arg.is_a? Array
|
267
|
+
width, txt, img, typ = arg #arg.shift
|
268
|
+
typ ||= 0
|
269
|
+
elsif arg.is_a? Part
|
270
|
+
width, txt, img, typ = arg._part
|
271
|
+
else
|
272
|
+
raise ArgumentError, "Argument must be an Array or Part but got #{arg.inspect}(#{arg.class})"
|
273
|
+
end
|
274
|
+
raise ArgumentError, "-1 value must be only 1 in the parts" if @minus1pos && width==-1
|
275
|
+
@_widths.insert(idx, width)
|
276
|
+
n = @_widths.size
|
277
|
+
@minus1pos = idx if width==-1
|
278
|
+
_set_parts(@_widths)
|
279
|
+
parts=[]
|
280
|
+
n.times{|i|
|
281
|
+
buff = TCHAR[Part::SB_MAXTEXTSISE]
|
282
|
+
ty = SendMessage(SB_GETTEXT, i, buff)
|
283
|
+
parts << [buff.to_s, SPLITPARAM(ty)]
|
284
|
+
}
|
285
|
+
#txt, img, typ = part._part
|
286
|
+
parts.insert(idx, [txt, [0, typ], img])
|
287
|
+
if @imagelist
|
288
|
+
if img
|
289
|
+
ico = @imagelist.icon(img)
|
290
|
+
@imagelist.set_hicon(img, ico._hicon)
|
291
|
+
else
|
292
|
+
ico = nil
|
293
|
+
end
|
294
|
+
_insert_icon(idx, ico)
|
295
|
+
end
|
296
|
+
parts.each_with_index{|v, i|
|
297
|
+
SendMessage(SB_SETTEXT, i | v[1][1], _I(v[0]))
|
298
|
+
SendMessage(SB_SETICON, i, @_icons[i] ? @_icons[i]._hicon : 0) if @_icons
|
299
|
+
}
|
300
|
+
else
|
301
|
+
@_parts.insert(idx, arg.is_a?(Part) ? arg : Part.new(self, idx, *arg))
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
# If index given, deletes specified index of pars, otherwise deletes this statusbar.
|
306
|
+
def delete(idx=nil)
|
307
|
+
return super() unless idx
|
308
|
+
n = @_widths.size
|
309
|
+
@_widths.delete_at(idx)
|
310
|
+
if alive?
|
311
|
+
parts=[]
|
312
|
+
n.times{|i|
|
313
|
+
buff = TCHAR[Part::SB_MAXTEXTSISE]
|
314
|
+
typ = SendMessage(SB_GETTEXT, i, buff)
|
315
|
+
parts << [buff, SPLITPARAM(typ)] # => [type, cch]
|
316
|
+
}
|
317
|
+
parts.delete_at(idx)
|
318
|
+
@_icons.delete_at(idx)
|
319
|
+
_set_parts(@_widths)
|
320
|
+
parts.each_with_index{|v, i|
|
321
|
+
SendMessage(SB_SETTEXT, i | v[1][1], _I(v[0]))
|
322
|
+
SendMessage(SB_SETICON, i, @_icons[i] ? @_icons[i]._hicon : 0)
|
323
|
+
}
|
324
|
+
else
|
325
|
+
@_parts.delete_at(idx)
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
# Retreives an information of specified index in this status bar.<br>
|
330
|
+
# Retruns a Statusbar::Part.
|
331
|
+
def [](idx)
|
332
|
+
if alive?
|
333
|
+
_check_index(idx)
|
334
|
+
Part.new(self, idx)
|
335
|
+
else
|
336
|
+
part = @_parts[idx]
|
337
|
+
part.index = idx
|
338
|
+
part
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
# []=(index, nums=1, *args)
|
343
|
+
# Inserts and replaces multiple parts by specified index and nums and args.
|
344
|
+
def []=(idx, *args)
|
345
|
+
n = args[0].is_a?(Integer) ? args.shift : 1
|
346
|
+
args = args[0]
|
347
|
+
n.times{delete(idx)}
|
348
|
+
if args[0].is_a?(Array) && args[0][0].is_a?(Integer)
|
349
|
+
args.each_with_index{|v, i| insert(idx + i, v)}
|
350
|
+
else
|
351
|
+
insert(idx, args)
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
# If a control given, adds it in this statusbar, otherwize adds a part at last.
|
356
|
+
def <<(arg)
|
357
|
+
if arg.is_a?(Window)
|
358
|
+
controls << arg
|
359
|
+
else
|
360
|
+
self[count, 0] = arg
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
# Sets a minimum height of this status bar.
|
365
|
+
def minheight=(h)
|
366
|
+
alive? ? SendMessage(SB_SETMINHEIGHT, h, 0) : @_minheight = h
|
367
|
+
end
|
368
|
+
|
369
|
+
# Gets an imagelist assigned to this status bar.
|
370
|
+
def imagelist()
|
371
|
+
@imagelist
|
372
|
+
end
|
373
|
+
# Assignes an imagelist to this status bar.
|
374
|
+
def imagelist=(il)
|
375
|
+
raise ArgumentError, "size of argument must be [16, 16]", caller(1) if il.iconsize!=[16,16]
|
376
|
+
@imagelist = il
|
377
|
+
class << @imagelist
|
378
|
+
attr_reader :_icons
|
379
|
+
def set_hicon(idx, hicon)
|
380
|
+
@_icons ||= []
|
381
|
+
@_icons[idx] = hicon
|
382
|
+
end
|
383
|
+
def get_hicon(idx)
|
384
|
+
@_icons ||= []
|
385
|
+
@_icons[idx]
|
386
|
+
end
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
390
|
+
# Gets the count of the parts in this status bar.
|
391
|
+
def count()
|
392
|
+
alive? ? @_widths.size : @_parts.size
|
393
|
+
end
|
394
|
+
|
395
|
+
# Retreives wheter this status bar is in the simple mode or not.
|
396
|
+
def simple()
|
397
|
+
alive? ? SendMessage(SB_ISSIMPLE, 0, 0)!=0 || nil : @_simple
|
398
|
+
end
|
399
|
+
alias simple? simple
|
400
|
+
|
401
|
+
# Sets or resets the simple mode to this control.
|
402
|
+
def simple=(f)
|
403
|
+
alive? ? SendMessage(SB_SIMPLE, f ? 1 : 0, 0) : @_simple = f
|
404
|
+
end
|
405
|
+
|
406
|
+
# each(){|part| ... }
|
407
|
+
# Performs the block for each <i>part</i> in this statusbar as a block parameter.
|
408
|
+
def each()
|
409
|
+
count.times{|i| yield self[i]}
|
410
|
+
end
|
411
|
+
|
412
|
+
#
|
413
|
+
def _get_width(idx)
|
414
|
+
@_widths[idx]
|
415
|
+
end
|
416
|
+
#
|
417
|
+
def _set_width(idx, w)
|
418
|
+
if w == -1
|
419
|
+
if @minus1pos && @minus1pos != idx
|
420
|
+
raise ArgumentError, "-1 value must be only 1 in the parts"
|
421
|
+
end
|
422
|
+
@minus1pos = idx
|
423
|
+
else
|
424
|
+
@minus1pos = nil if @minus1pos == idx
|
425
|
+
end
|
426
|
+
idx = @_widths.size if idx > @_widths.size
|
427
|
+
@_widths[idx] = w
|
428
|
+
_set_parts(@_widths) if alive?
|
429
|
+
end
|
430
|
+
|
431
|
+
protected
|
432
|
+
def _apply_options(arg)
|
433
|
+
if st=WinStyles[arg]
|
434
|
+
self.style |= st
|
435
|
+
return nil
|
436
|
+
end
|
437
|
+
super
|
438
|
+
end
|
439
|
+
|
440
|
+
private
|
441
|
+
def _set_parts(args)
|
442
|
+
ar = args.inject([]){|r, i| r << r.last.to_i + (i<0 ? 0 : i)}
|
443
|
+
if args.last == -1
|
444
|
+
ar[args.size-1] = -1
|
445
|
+
else
|
446
|
+
@minus1pos = args.index(-1)
|
447
|
+
end
|
448
|
+
@buffer = IARRAY[ar]
|
449
|
+
SendMessage(SB_SETPARTS, args.size, @buffer)
|
450
|
+
refresh_parts()
|
451
|
+
end
|
452
|
+
|
453
|
+
def __statusbar_resize__(wp, lp)
|
454
|
+
SendMessage(WM_SIZE, wp, lp);
|
455
|
+
refresh_parts()
|
456
|
+
end
|
457
|
+
|
458
|
+
def _check_index(idx)
|
459
|
+
idx = idx > @_parts.size ? @_parts.size : idx
|
460
|
+
end
|
461
|
+
|
462
|
+
def refresh_parts()
|
463
|
+
return unless alive?
|
464
|
+
return unless @minus1pos
|
465
|
+
size = SendMessage(SB_GETPARTS, 0, 0)
|
466
|
+
_w, h = self.clientsize
|
467
|
+
w = _w - @buffer[size-1]
|
468
|
+
for i in @minus1pos..(size-1)
|
469
|
+
@buffer[i] += w
|
470
|
+
end
|
471
|
+
SendMessage(SB_SETPARTS, size, @buffer)
|
472
|
+
end
|
473
|
+
|
474
|
+
def _insert_icon(idx, ico)
|
475
|
+
@_icons ||= []
|
476
|
+
@_icons.insert(idx, ico)
|
477
|
+
end
|
478
|
+
def _get_icon(idx) #; dpp @_icons, idx
|
479
|
+
@_icons ||= []
|
480
|
+
@_icons[idx]
|
481
|
+
end
|
482
|
+
def _set_icon(idx, ico)
|
483
|
+
@_icons ||= []
|
484
|
+
@_icons[idx] = ico
|
485
|
+
if alive?
|
486
|
+
SendMessage(SB_SETICON, idx, ico ? ico._hicon : 0)
|
487
|
+
end
|
488
|
+
end
|
489
|
+
end
|
490
|
+
end
|