wrb 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,686 @@
|
|
|
1
|
+
require 'wrb'
|
|
2
|
+
require 'wrb/commctrlconst'
|
|
3
|
+
|
|
4
|
+
module WR
|
|
5
|
+
module RC
|
|
6
|
+
TCS_SCROLLOPPOSITE = 0x1
|
|
7
|
+
TCS_BOTTOM = 0x2
|
|
8
|
+
TCS_RIGHT = 0x2
|
|
9
|
+
TCS_MULTISELECT = 0x4
|
|
10
|
+
TCS_FLATBUTTONS = 0x8
|
|
11
|
+
TCS_FORCEICONLEFT = 0x10
|
|
12
|
+
TCS_FORCELABELLEFT = 0x20
|
|
13
|
+
TCS_HOTTRACK = 0x40
|
|
14
|
+
TCS_VERTICAL = 0x80
|
|
15
|
+
TCS_TABS = 0x0
|
|
16
|
+
TCS_BUTTONS = 0x100
|
|
17
|
+
TCS_SINGLELINE = 0x0
|
|
18
|
+
TCS_MULTILINE = 0x200
|
|
19
|
+
TCS_RIGHTJUSTIFY = 0x0
|
|
20
|
+
TCS_FIXEDWIDTH = 0x400
|
|
21
|
+
TCS_RAGGEDRIGHT = 0x800
|
|
22
|
+
TCS_FOCUSONBUTTONDOWN = 0x1000
|
|
23
|
+
TCS_OWNERDRAWFIXED = 0x2000
|
|
24
|
+
TCS_TOOLTIPS = 0x4000
|
|
25
|
+
TCS_FOCUSNEVER = 0x8000
|
|
26
|
+
|
|
27
|
+
TCS_EX_FLATSEPARATORS = 0x1
|
|
28
|
+
TCS_EX_REGISTERDROP = 0x2
|
|
29
|
+
|
|
30
|
+
TCM_FIRST = 0x1300
|
|
31
|
+
TCM_GETIMAGELIST = TCM_FIRST+2
|
|
32
|
+
TCM_SETIMAGELIST = TCM_FIRST+3
|
|
33
|
+
TCM_GETITEMCOUNT = TCM_FIRST+4
|
|
34
|
+
TCM_GETITEMA = TCM_FIRST+5
|
|
35
|
+
TCM_GETITEMW = TCM_FIRST+60
|
|
36
|
+
TCM_SETITEMA = TCM_FIRST+6
|
|
37
|
+
TCM_SETITEMW = TCM_FIRST+61
|
|
38
|
+
TCM_INSERTITEMA = TCM_FIRST+7
|
|
39
|
+
TCM_INSERTITEMW = TCM_FIRST+62
|
|
40
|
+
TCM_DELETEITEM = TCM_FIRST+8
|
|
41
|
+
TCM_DELETEALLITEMS = TCM_FIRST+9
|
|
42
|
+
TCM_GETITEMRECT = TCM_FIRST+10
|
|
43
|
+
TCM_GETCURSEL = TCM_FIRST+11
|
|
44
|
+
TCM_SETCURSEL = TCM_FIRST+12
|
|
45
|
+
TCM_HITTEST = TCM_FIRST+13
|
|
46
|
+
TCM_SETITEMEXTRA = TCM_FIRST+14
|
|
47
|
+
TCM_ADJUSTRECT = TCM_FIRST+40
|
|
48
|
+
TCM_SETITEMSIZE = TCM_FIRST+41
|
|
49
|
+
TCM_REMOVEIMAGE = TCM_FIRST+42
|
|
50
|
+
TCM_SETPADDING = TCM_FIRST+43
|
|
51
|
+
TCM_GETROWCOUNT = TCM_FIRST+44
|
|
52
|
+
TCM_GETTOOLTIPS = TCM_FIRST+45
|
|
53
|
+
TCM_SETTOOLTIPS = TCM_FIRST+46
|
|
54
|
+
TCM_GETCURFOCUS = TCM_FIRST+47
|
|
55
|
+
TCM_SETCURFOCUS = TCM_FIRST+48
|
|
56
|
+
TCM_SETMINTABWIDTH = TCM_FIRST+49
|
|
57
|
+
TCM_DESELECTALL = TCM_FIRST+50
|
|
58
|
+
TCM_HIGHLIGHTITEM = TCM_FIRST+51
|
|
59
|
+
TCM_SETEXTENDEDSTYLE = TCM_FIRST+52
|
|
60
|
+
TCM_GETEXTENDEDSTYLE = TCM_FIRST+53
|
|
61
|
+
|
|
62
|
+
if RWin::UNICODE
|
|
63
|
+
TCM_GETITEM = TCM_GETITEMW
|
|
64
|
+
TCM_SETITEM = TCM_SETITEMW
|
|
65
|
+
TCM_INSERTITEM = TCM_INSERTITEMW
|
|
66
|
+
else
|
|
67
|
+
TCM_GETITEM = TCM_GETITEMA
|
|
68
|
+
TCM_SETITEM = TCM_SETITEMA
|
|
69
|
+
TCM_INSERTITEM = TCM_INSERTITEMA
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
TCN_FIRST = -550
|
|
73
|
+
TCN_KEYDOWN = TCN_FIRST-0
|
|
74
|
+
TCN_SELCHANGE = TCN_FIRST-1
|
|
75
|
+
TCN_SELCHANGING = TCN_FIRST-2
|
|
76
|
+
TCN_GETOBJECT = TCN_FIRST-3
|
|
77
|
+
TCN_FOCUSCHANGE = TCN_FIRST-4
|
|
78
|
+
|
|
79
|
+
TCIF_TEXT = 0x1
|
|
80
|
+
TCIF_IMAGE = 0x2
|
|
81
|
+
TCIF_RTLREADING = 0x4
|
|
82
|
+
TCIF_PARAM = 0x8
|
|
83
|
+
TCIF_STATE = 0x10
|
|
84
|
+
|
|
85
|
+
TCIS_BUTTONPRESSED = 0x1
|
|
86
|
+
TCIS_HIGHLIGHTED = 0x2
|
|
87
|
+
|
|
88
|
+
TCHT_NOWHERE = 0x1
|
|
89
|
+
TCHT_ONITEMICON = 0x2
|
|
90
|
+
TCHT_ONITEMLABEL = 0x4
|
|
91
|
+
TCHT_ONITEM = (TCHT_ONITEMICON | TCHT_ONITEMLABEL)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# This control is analogous to the dividers in a notebook or the labels in a file cabinet.
|
|
95
|
+
# <br>See also <a href="https://docs.microsoft.com/en-us/windows/desktop/Controls/
|
|
96
|
+
# window-controls"> Windows Control section of Microsoft Docs.</a>
|
|
97
|
+
class Tabctrl < WinControl
|
|
98
|
+
|
|
99
|
+
TCITEMHEADER = API.defstruct "
|
|
100
|
+
UINT mask;
|
|
101
|
+
UINT lpReserved1;
|
|
102
|
+
UINT lpReserved2;
|
|
103
|
+
LPTSTR pszText;
|
|
104
|
+
int cchTextMax;
|
|
105
|
+
int iImage;"
|
|
106
|
+
|
|
107
|
+
TCITEM = API.defstruct "
|
|
108
|
+
UINT mask;
|
|
109
|
+
DWORD dwState;
|
|
110
|
+
DWORD dwStateMask;
|
|
111
|
+
LPTSTR pszText;
|
|
112
|
+
int cchTextMax;
|
|
113
|
+
int iImage;
|
|
114
|
+
LPARAM lParam;"
|
|
115
|
+
|
|
116
|
+
TCHITTESTINFO = API.defstruct "
|
|
117
|
+
POINT pt;
|
|
118
|
+
UINT flags;"
|
|
119
|
+
|
|
120
|
+
TCKEYDOWN = API.defstruct "
|
|
121
|
+
NMHDR hdr;
|
|
122
|
+
WORD wVKey;
|
|
123
|
+
UINT flags;"
|
|
124
|
+
|
|
125
|
+
NMTCKEYDOWN = API.defstruct "
|
|
126
|
+
NMHDR hdr;
|
|
127
|
+
WORD wVKey;
|
|
128
|
+
UINT flags;"
|
|
129
|
+
|
|
130
|
+
# Holder of TCITEM and tab index
|
|
131
|
+
class Tab
|
|
132
|
+
include ModAccessor
|
|
133
|
+
class Controls < Collection
|
|
134
|
+
def initialize(onr)
|
|
135
|
+
@owner = onr
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def <<(arg)# dpp arg
|
|
139
|
+
@owner.owner << arg unless arg.idcmd
|
|
140
|
+
@owner._add_accessor(arg, "#{arg.name}".intern)
|
|
141
|
+
@owner.instance_eval("def _#{arg.name}() #{arg.name}; end")
|
|
142
|
+
class << arg
|
|
143
|
+
attr_accessor :owner
|
|
144
|
+
end
|
|
145
|
+
arg.owner = self
|
|
146
|
+
super(arg)
|
|
147
|
+
self.uniq!
|
|
148
|
+
arg
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def show() #; dpp self
|
|
152
|
+
self.each{|i| i.showna}
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def hide()
|
|
156
|
+
self.each{|i| i.hide}
|
|
157
|
+
end
|
|
158
|
+
def delete(obj)
|
|
159
|
+
obj.show
|
|
160
|
+
super
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
include RC
|
|
165
|
+
attr_reader :tcitem, :owner
|
|
166
|
+
attr_accessor :index
|
|
167
|
+
|
|
168
|
+
def initialize(*args)
|
|
169
|
+
@owner = args.shift if args[0].is_a?(Tabctrl)
|
|
170
|
+
@controls = Controls.new(self)
|
|
171
|
+
if args.empty? # For get tab data
|
|
172
|
+
#@index = args[0]
|
|
173
|
+
@tcitem = TCITEM[TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM]
|
|
174
|
+
else # For set all tab data
|
|
175
|
+
@tcitem = TCITEM.new
|
|
176
|
+
text, @image, @data = args
|
|
177
|
+
if text
|
|
178
|
+
@text = text.dup
|
|
179
|
+
@tcitem.mask |= TCIF_TEXT
|
|
180
|
+
@tcitem.pszText = @text
|
|
181
|
+
@tcitem.cchTextMax = @text.size
|
|
182
|
+
end
|
|
183
|
+
if @image
|
|
184
|
+
@tcitem.mask |= TCIF_IMAGE
|
|
185
|
+
@tcitem.iImage = @image
|
|
186
|
+
end
|
|
187
|
+
if @data
|
|
188
|
+
@tcitem.mask |= TCIF_PARAM
|
|
189
|
+
lparam = @data.__id__
|
|
190
|
+
@owner._ar_data << dt if (lparam&1)==0 && lparam>NilID
|
|
191
|
+
@tcitem.lParam = lparam
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
def owner=(onr)
|
|
197
|
+
@owner = onr
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
def inspect()
|
|
201
|
+
sprintf("<%s %#x text=%p>", self.class, __id__, @text)
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
def controls()
|
|
205
|
+
@controls
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
def index()
|
|
209
|
+
@owner.tabs.index(self)
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# def update(idx)
|
|
213
|
+
# @index = idx
|
|
214
|
+
# if @text
|
|
215
|
+
# @owner.SendMessage(TCM_SETITEM, idx, @tcitem)
|
|
216
|
+
# else
|
|
217
|
+
# buff = TCHAR[256]
|
|
218
|
+
# @tcitem.cchTextMax = buff.size
|
|
219
|
+
# @tcitem.pszText = buff
|
|
220
|
+
# @owner.SendMessage(TCM_GETITEM, idx, @tcitem)
|
|
221
|
+
# @text = buff.to_s #; dpp @tcitem.mask, @text
|
|
222
|
+
# end
|
|
223
|
+
# self
|
|
224
|
+
# end
|
|
225
|
+
|
|
226
|
+
def delete()
|
|
227
|
+
@controls.show
|
|
228
|
+
@owner.delete(index)
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
def <<(arg) #dpp arg
|
|
232
|
+
@controls << arg
|
|
233
|
+
arg.visible = self.visible
|
|
234
|
+
# @owner.pages[index] << arg
|
|
235
|
+
arg
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def text()
|
|
239
|
+
if @owner.alive?
|
|
240
|
+
@tcitem.clear(TCIF_TEXT, 0, 0, buff=TCHAR[256], buff.size)
|
|
241
|
+
@owner.SendMessage(TCM_GETITEM, index, @tcitem)
|
|
242
|
+
@text = buff.to_s
|
|
243
|
+
else
|
|
244
|
+
@text
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
alias caption text
|
|
248
|
+
def text=(txt)
|
|
249
|
+
str = txt.dup
|
|
250
|
+
if @owner.alive?
|
|
251
|
+
@tcitem.clear(TCIF_TEXT, 0, 0, str, str.size)
|
|
252
|
+
@owner.SendMessage(TCM_SETITEM, index, @tcitem)
|
|
253
|
+
else
|
|
254
|
+
@text = str
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
alias caption= text=
|
|
258
|
+
|
|
259
|
+
def image()
|
|
260
|
+
if @owner.alive?
|
|
261
|
+
@tcitem.clear(TCIF_IMAGE)
|
|
262
|
+
@owner.SendMessage(TCM_GETITEM, index, @tcitem)
|
|
263
|
+
@tcitem.iImage
|
|
264
|
+
else
|
|
265
|
+
@image
|
|
266
|
+
end
|
|
267
|
+
end
|
|
268
|
+
def image=(img)
|
|
269
|
+
if @owner.alive?
|
|
270
|
+
return @owner.SendMessage(TCM_REMOVEIMAGE, index, 0) if img.nil?
|
|
271
|
+
@tcitem.clear(TCIF_IMAGE, 0, 0, nil, 0, img)
|
|
272
|
+
@owner.SendMessage(TCM_SETITEM, index, @tcitem)
|
|
273
|
+
else
|
|
274
|
+
@image = img
|
|
275
|
+
end
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
def data()
|
|
279
|
+
if @owner.alive?
|
|
280
|
+
@tcitem.clear(TCIF_PARAM)
|
|
281
|
+
@owner.SendMessage(TCM_GETITEM, index, @tcitem)
|
|
282
|
+
ObjectSpace._id2ref(@tcitem.lParam)
|
|
283
|
+
else
|
|
284
|
+
@data
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
def data=(dt)
|
|
288
|
+
if @owner.alive?
|
|
289
|
+
@owner._ar_data.delete_at(@owner._ar_data.index(self.data))
|
|
290
|
+
@tcitem.clear(TCIF_PARAM)
|
|
291
|
+
lparam = dt.__id__
|
|
292
|
+
@owner._ar_data << dt if (lparam&1)==0 && lparam>NilID
|
|
293
|
+
@tcitem.lParam = lparam
|
|
294
|
+
@owner.SendMessage(TCM_SETITEM, index, @tcitem)
|
|
295
|
+
else
|
|
296
|
+
@data = dt
|
|
297
|
+
end
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
def show()
|
|
301
|
+
@controls.show
|
|
302
|
+
end
|
|
303
|
+
def hide()
|
|
304
|
+
@controls.hide
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
def visible() #; dpp @owner.tabs.index(self), @owner.cursel
|
|
308
|
+
@owner.tabs.index(self) == @owner.cursel
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
##### Only for window alive #####
|
|
312
|
+
|
|
313
|
+
def rect()
|
|
314
|
+
rc = RECT.new
|
|
315
|
+
@owner.SendMessage(TCM_GETITEMRECT, index, rc)
|
|
316
|
+
rc
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
##################### Main ##################
|
|
321
|
+
include ModCommCtrl
|
|
322
|
+
include ModParent
|
|
323
|
+
include ModAccessor
|
|
324
|
+
|
|
325
|
+
WinStyles = {
|
|
326
|
+
:bottom => TCS_BOTTOM,
|
|
327
|
+
:buttons => TCS_BUTTONS,
|
|
328
|
+
:fixedwidth => TCS_FIXEDWIDTH,
|
|
329
|
+
:focusnever => TCS_FOCUSNEVER,
|
|
330
|
+
:focusonbuttondown => TCS_FOCUSONBUTTONDOWN,
|
|
331
|
+
:flatbuttons => TCS_FLATBUTTONS,
|
|
332
|
+
:forceiconleft => TCS_FORCEICONLEFT,
|
|
333
|
+
:forcelabelleft => TCS_FORCELABELLEFT,
|
|
334
|
+
:hottrack => TCS_HOTTRACK,
|
|
335
|
+
:ownerdrawfixed => TCS_OWNERDRAWFIXED,
|
|
336
|
+
:multiline => TCS_MULTILINE,
|
|
337
|
+
:multiselect => TCS_MULTISELECT,
|
|
338
|
+
:raggedright => TCS_RAGGEDRIGHT,
|
|
339
|
+
:right => TCS_RIGHT,
|
|
340
|
+
:rightjustify => TCS_RIGHTJUSTIFY,
|
|
341
|
+
:scrollopposite => TCS_SCROLLOPPOSITE,
|
|
342
|
+
:singleline => TCS_SINGLELINE,
|
|
343
|
+
:tabs => TCS_TABS,
|
|
344
|
+
:tooltips => TCS_TOOLTIPS,
|
|
345
|
+
:vertical => TCS_VERTICAL,
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
TabExStyles = {
|
|
349
|
+
:flatseparators => TCS_EX_FLATSEPARATORS,
|
|
350
|
+
:registerdrop => TCS_EX_REGISTERDROP,
|
|
351
|
+
:noflatseparators => ~TCS_EX_FLATSEPARATORS
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
PreDefinedEvents = {
|
|
355
|
+
:click => [WM_NOTIFY, NM_CLICK, 'xs', NMMOUSE],
|
|
356
|
+
:dblclk => [WM_NOTIFY, NM_DBLCLK, 'xs', NMMOUSE],
|
|
357
|
+
:focuschange => [WM_NOTIFY, TCN_FOCUSCHANGE, 'xs', NMHDR],
|
|
358
|
+
:keydown => [WM_NOTIFY, TCN_KEYDOWN, 'xs', NMTCKEYDOWN],
|
|
359
|
+
:rclick => [WM_NOTIFY, NM_RCLICK, 'xs', NMMOUSE],
|
|
360
|
+
:rdblclk => [WM_NOTIFY, NM_RDBLCLK, 'xs', NMMOUSE],
|
|
361
|
+
:releasedcapture => [WM_NOTIFY, NM_RELEASEDCAPTURE, 'xs', NMHDR],
|
|
362
|
+
:selchange => [WM_NOTIFY, TCN_SELCHANGE, 'xs', NMHDR],
|
|
363
|
+
:selchanging => [WM_NOTIFY, TCN_SELCHANGING, 'xs', NMHDR],
|
|
364
|
+
# :getobject => [WM_NOTIFY, TCN_GETOBJECT, 'xs', NMOBJECTNOTIFY], # COM
|
|
365
|
+
}
|
|
366
|
+
DefaultEvents = [
|
|
367
|
+
:selchange # ???_selchange(arg)
|
|
368
|
+
]
|
|
369
|
+
|
|
370
|
+
# def self.sym2style(*args) _sym2style(WinStyles, args); end
|
|
371
|
+
# def self.sym2exstyle(*args) _sym2style(WinExStyles, args); end
|
|
372
|
+
|
|
373
|
+
attr_reader :_ar_data #, :controls
|
|
374
|
+
|
|
375
|
+
def initialize(*args)
|
|
376
|
+
class << (@_tabs = []); attr_accessor :owner end
|
|
377
|
+
@_tabs.owner = self
|
|
378
|
+
super
|
|
379
|
+
@_classname = 'SysTabControl32'
|
|
380
|
+
self.style |= TCS_HOTTRACK
|
|
381
|
+
@_acceptable_events = PreDefinedEvents.dup
|
|
382
|
+
@_ar_data = []
|
|
383
|
+
end
|
|
384
|
+
#
|
|
385
|
+
def idcmd=(id)
|
|
386
|
+
@_parent.set_msgtranslator(WM_NOTIFY) unless @_parent.get_msgtranslator(WM_NOTIFY)
|
|
387
|
+
@_parent.register_event(id, WM_NOTIFY, TCN_SELCHANGE, "__selchanged__", 'xs', NMHDR, self) #refrection
|
|
388
|
+
super
|
|
389
|
+
end
|
|
390
|
+
#
|
|
391
|
+
def create()
|
|
392
|
+
super
|
|
393
|
+
SetWindowSubclass()
|
|
394
|
+
self.imagelist = @_imagelist if @_imagelist
|
|
395
|
+
self.cursel = @_cursel if @_cursel
|
|
396
|
+
self.focused = @_focused if @_focused
|
|
397
|
+
self.tooltips = @_tooltips if @_tooltips
|
|
398
|
+
self.extendedstyle = @_extendedstyle if @_extendedstyle
|
|
399
|
+
self.padding = @_padding if @_padding
|
|
400
|
+
self.mintabwidth = @_mintabwidth if @_mintabwidth
|
|
401
|
+
self.tabs = @_tabs if @_tabs
|
|
402
|
+
end
|
|
403
|
+
#
|
|
404
|
+
def register_event(*args)
|
|
405
|
+
if !@_setsubclass && !args.last.is_a?(RWin::Window) &&
|
|
406
|
+
(args[1]==WM_COMMAND || args[1]==WM_NOTIFY)
|
|
407
|
+
args[6] = get_toplevel_win # forwarding to toplevel
|
|
408
|
+
end
|
|
409
|
+
super *args
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
# Inserts a new tab in this tab control.<br>
|
|
413
|
+
# Give an array of [text, image, data] or a Tabctrl::Tab
|
|
414
|
+
def insert_tab(idx, arg) #;dpp idx, arg
|
|
415
|
+
if arg.is_a?(Array)
|
|
416
|
+
tab = Tab.new(self, *arg)
|
|
417
|
+
elsif arg.is_a?(Tab)
|
|
418
|
+
tab = arg
|
|
419
|
+
tab.owner = self
|
|
420
|
+
else
|
|
421
|
+
raise ArgumentError, "Argument must be a Tab or an Array."
|
|
422
|
+
end
|
|
423
|
+
@_tabs.insert(idx, tab)
|
|
424
|
+
SendMessage(TCM_INSERTITEM, idx, tab.tcitem) if alive?
|
|
425
|
+
tab
|
|
426
|
+
end
|
|
427
|
+
def insert(idx, arg)
|
|
428
|
+
insert_tab(idx, arg)
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
# def delete_tab(idx)
|
|
432
|
+
# if alive?
|
|
433
|
+
# tab = Tab.new(self)
|
|
434
|
+
# tab.index = idx
|
|
435
|
+
# if n=@_ar_data.index(tab.data)
|
|
436
|
+
# @_ar_data.delete_at(n)
|
|
437
|
+
# end
|
|
438
|
+
# SendMessage(TCM_DELETEITEM, idx, 0)
|
|
439
|
+
# end
|
|
440
|
+
# @_tabs.delete_at(idx)
|
|
441
|
+
# end
|
|
442
|
+
|
|
443
|
+
# If given index, deletes a tab specified index and removes associated control from it, otherwize deletes self.
|
|
444
|
+
def delete(idx=nil)
|
|
445
|
+
if idx.nil?
|
|
446
|
+
@controls.each{|i| i.delete}
|
|
447
|
+
@_parent.controls.delete(self)
|
|
448
|
+
return
|
|
449
|
+
end
|
|
450
|
+
if alive?
|
|
451
|
+
return if idx >= self.count
|
|
452
|
+
if n=@_ar_data.index(self[idx].data)
|
|
453
|
+
@_ar_data.delete_at(n)
|
|
454
|
+
end
|
|
455
|
+
SendMessage(TCM_DELETEITEM, idx, 0)
|
|
456
|
+
self.refresh
|
|
457
|
+
end
|
|
458
|
+
@_tabs.delete_at(idx)
|
|
459
|
+
end
|
|
460
|
+
|
|
461
|
+
# Retreives count of tabs.
|
|
462
|
+
def count() #; dpp @_tabs
|
|
463
|
+
alive? ? SendMessage(TCM_GETITEMCOUNT, 0, 0) : @_tabs.size
|
|
464
|
+
end
|
|
465
|
+
|
|
466
|
+
# Retreives Tabctrl::Tabs
|
|
467
|
+
def tabs()
|
|
468
|
+
#r = alive? ? (0..count-1).inject([]){|r, i| r << Tab.new(self).update(i)} : @_tabs
|
|
469
|
+
@_tabs
|
|
470
|
+
end
|
|
471
|
+
# Sets multiple tabs to this tab control.
|
|
472
|
+
# Give an array of [[text, image, data], ... ] or an array of Tabctrl::Tabs.
|
|
473
|
+
def tabs=(ar)
|
|
474
|
+
ar = [ar] unless ar.is_a?(Array) #; dpp ar, @_tabs, count
|
|
475
|
+
if alive?
|
|
476
|
+
ar = ar.dup
|
|
477
|
+
self.clear
|
|
478
|
+
end
|
|
479
|
+
self[0, count] = ar unless ar.empty?
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
# Clears all tabs and removes associated controls.
|
|
483
|
+
def clear()
|
|
484
|
+
alive? && SendMessage(TCM_DELETEALLITEMS, 0, 0)
|
|
485
|
+
@_tabs.clear
|
|
486
|
+
end
|
|
487
|
+
|
|
488
|
+
# Adds control on this tab control.<br>
|
|
489
|
+
# Syntax is same as <code>Controls#<< </code>.
|
|
490
|
+
def <<(arg)
|
|
491
|
+
# Tabctl sends all message in the client area to parent, so no need to set parent.
|
|
492
|
+
@controls ||= Controls.new(self)
|
|
493
|
+
if arg.is_a?(WinControl)
|
|
494
|
+
@controls << arg
|
|
495
|
+
self._add_accessor(arg, arg.name)
|
|
496
|
+
# @_parent.controls._add_accessor(arg, arg.name) # Which do you like?
|
|
497
|
+
arg
|
|
498
|
+
else # add new tab and page
|
|
499
|
+
self[self.count, 0] = *arg
|
|
500
|
+
self.tabs
|
|
501
|
+
end
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
# Retreives specified index of tab in this tab control.
|
|
505
|
+
def [](idx)
|
|
506
|
+
@_tabs[idx]
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
# []=(index, length=1, *args)
|
|
510
|
+
# Inserts and replaces tabs by specified index and length with arguments.
|
|
511
|
+
def []=(idx, *args)
|
|
512
|
+
case args.size
|
|
513
|
+
when 1
|
|
514
|
+
num = 1; args=args[0]
|
|
515
|
+
when 2
|
|
516
|
+
num, args = args
|
|
517
|
+
end
|
|
518
|
+
return if args.empty? || args==[nil]
|
|
519
|
+
anum = args.size
|
|
520
|
+
j = 0
|
|
521
|
+
item = args[0].is_a?(String) ? [args.shift] : [] #; dpp args
|
|
522
|
+
while i=args.shift
|
|
523
|
+
if i.is_a?(String) #; dpp i, j, item
|
|
524
|
+
unless item.empty?
|
|
525
|
+
insert(idx+j, item)
|
|
526
|
+
j += 1
|
|
527
|
+
end
|
|
528
|
+
item = []
|
|
529
|
+
elsif i.is_a?(Array) || i.is_a?(Tab) # ; dpp i, j, item
|
|
530
|
+
unless item.empty?
|
|
531
|
+
insert(idx+j, item)
|
|
532
|
+
j += 1
|
|
533
|
+
end
|
|
534
|
+
insert(idx+j, i)
|
|
535
|
+
j += 1
|
|
536
|
+
item = []
|
|
537
|
+
next
|
|
538
|
+
elsif i.nil?
|
|
539
|
+
next
|
|
540
|
+
end
|
|
541
|
+
item << i
|
|
542
|
+
end
|
|
543
|
+
insert(idx+j, item) if !item.empty? #; dpp @_pages,idx, num, ar_pages, anum
|
|
544
|
+
refresh if alive?
|
|
545
|
+
end
|
|
546
|
+
|
|
547
|
+
# Retrieves the image list associated with this tab control.
|
|
548
|
+
def imagelist()
|
|
549
|
+
alive? ? APP.hrsc2ref(SendMessage(TCM_GETIMAGELIST, 0, 0)) || nil : @_imagelist
|
|
550
|
+
end
|
|
551
|
+
# Assigns an image list to this tab control.
|
|
552
|
+
def imagelist=(il)
|
|
553
|
+
il = Imagelist.loadb64(il) if il.is_a?(String)
|
|
554
|
+
if alive?
|
|
555
|
+
SendMessage(TCM_SETIMAGELIST, 0, il ? il._himagelist : 0)
|
|
556
|
+
else
|
|
557
|
+
@_imagelist = il
|
|
558
|
+
end
|
|
559
|
+
end
|
|
560
|
+
|
|
561
|
+
# Determines the currently selected tab in this tab control.
|
|
562
|
+
def cursel()
|
|
563
|
+
alive? ? SendMessage(TCM_GETCURSEL, 0, 0) : @_cursel.to_i
|
|
564
|
+
end
|
|
565
|
+
# Selects a tab in a tab control.
|
|
566
|
+
def cursel=(args)
|
|
567
|
+
sel, with_msg = args
|
|
568
|
+
if alive?
|
|
569
|
+
SendMessage(TCM_SETCURSEL, sel, 0)
|
|
570
|
+
if with_msg.nil? || with_msg
|
|
571
|
+
SendMessage(WM_NOTIFY, 0, NMHDR[_hwnd, idcmd, TCN_SELCHANGE])
|
|
572
|
+
end
|
|
573
|
+
else
|
|
574
|
+
@_cursel = sel
|
|
575
|
+
end
|
|
576
|
+
end
|
|
577
|
+
|
|
578
|
+
# Only for TCS_BUTTONS style
|
|
579
|
+
def focused()
|
|
580
|
+
alive? ? SendMessage(TCM_GETCURFOCUS, 0, 0) : @_focused.to_i
|
|
581
|
+
end
|
|
582
|
+
# Only for TCS_BUTTONS style
|
|
583
|
+
def focused=(fc)
|
|
584
|
+
alive? ? SendMessage(TCM_SETCURFOCUS, fc, 0) : @_focused = fc
|
|
585
|
+
end
|
|
586
|
+
|
|
587
|
+
# Retrieves the tooltip control associated with this tab control.
|
|
588
|
+
def tooltips()
|
|
589
|
+
alive? ? APP.hwnd2ref(SendMessage(TCM_GETTOOLTIPS, 0, 0)) : @_tooltips
|
|
590
|
+
end
|
|
591
|
+
# Assigns a tooltip control to this tab control.
|
|
592
|
+
def tooltips=(tt)
|
|
593
|
+
alive? ? SendMessage(TCM_SETTOOLTIPS, 0, tt.hWnd) : @_tooltips = tt
|
|
594
|
+
end
|
|
595
|
+
|
|
596
|
+
# Retrieves the extended styles that are currently in use for this tab control.
|
|
597
|
+
def extendedstyle()
|
|
598
|
+
if alive?
|
|
599
|
+
SendMessage(TCM_GETEXTENDEDSTYLE, 0, 0)
|
|
600
|
+
else
|
|
601
|
+
@_extendedstyle.to_i
|
|
602
|
+
end
|
|
603
|
+
end
|
|
604
|
+
# Sets the extended styles that this tab control will use.
|
|
605
|
+
def extendedstyle=(xs)
|
|
606
|
+
if alive? #; dp "@%p", xs
|
|
607
|
+
SendMessage(TCM_SETEXTENDEDSTYLE, 0, xs)
|
|
608
|
+
else
|
|
609
|
+
@_extendedstyle = xs
|
|
610
|
+
end
|
|
611
|
+
end
|
|
612
|
+
|
|
613
|
+
# Gets the minimum width of tabs.
|
|
614
|
+
def mintabwidth()
|
|
615
|
+
@_mintabwidth
|
|
616
|
+
end
|
|
617
|
+
# Sets the minimum width of tabs in this tab control.
|
|
618
|
+
def mintabwidth=(w)
|
|
619
|
+
@_mintabwidth = w
|
|
620
|
+
SendMessage(TCM_SETMINTABWIDTH, 0, w.nil? ? -1 : w) if alive?
|
|
621
|
+
end
|
|
622
|
+
|
|
623
|
+
# Gets the padding of this tab control.
|
|
624
|
+
def padding()
|
|
625
|
+
@_padding
|
|
626
|
+
end
|
|
627
|
+
# Sets the padding around each tab's icon and label in this tab control.
|
|
628
|
+
def padding=(args) # Write only
|
|
629
|
+
@_padding = args
|
|
630
|
+
if alive?
|
|
631
|
+
px, py = args.nil? ? [0, 0] : args
|
|
632
|
+
raise ArgumentError, "Argument must be pair of x, y pixcels" unless py
|
|
633
|
+
SendMessage(TCM_SETPADDING, 0, MAKELPARAM(px, py))
|
|
634
|
+
end
|
|
635
|
+
end
|
|
636
|
+
|
|
637
|
+
# Retreives count of tabs in this tab control.
|
|
638
|
+
def count()
|
|
639
|
+
tabs.count
|
|
640
|
+
end
|
|
641
|
+
|
|
642
|
+
# each(){|tab| ... }
|
|
643
|
+
# Performs the block for each <i>tab</i> in this as a block parameter.
|
|
644
|
+
def each()
|
|
645
|
+
tabs.each{|tb| yield tb}
|
|
646
|
+
end
|
|
647
|
+
|
|
648
|
+
##### Only for window alive #####
|
|
649
|
+
|
|
650
|
+
# Determines which tab, if any, is at a specified screen position.<br>
|
|
651
|
+
# Returns a TCHITTESTINFO structure.
|
|
652
|
+
def hittest(x, y, flag=TCHT_ONITEM)
|
|
653
|
+
SendMessage(TCM_HITTEST, 0, TCHITTESTINFO[x, y, flag])
|
|
654
|
+
end
|
|
655
|
+
|
|
656
|
+
#
|
|
657
|
+
def __move(x, y, w, h)
|
|
658
|
+
super
|
|
659
|
+
@controls.each{|i| i.__move(0, 0, self.w, self.h)} if @controls
|
|
660
|
+
end
|
|
661
|
+
|
|
662
|
+
protected
|
|
663
|
+
def _apply_options(arg)
|
|
664
|
+
if st = WinStyles[arg]
|
|
665
|
+
self.style |= st
|
|
666
|
+
return nil
|
|
667
|
+
end
|
|
668
|
+
if es = TabExStyles[arg] #; dp "@%p, %p", arg, es
|
|
669
|
+
if es < 0
|
|
670
|
+
self.extendedstyle &= es
|
|
671
|
+
else
|
|
672
|
+
self.extendedstyle |= es
|
|
673
|
+
end
|
|
674
|
+
end
|
|
675
|
+
super
|
|
676
|
+
end
|
|
677
|
+
|
|
678
|
+
private
|
|
679
|
+
def __selchanged__(nm)
|
|
680
|
+
return unless idcmd == nm.idFrom
|
|
681
|
+
ci = self.cursel
|
|
682
|
+
@_tabs.each_with_index{|tab, i| ci==i ? tab.controls.show : tab.controls.hide}
|
|
683
|
+
end
|
|
684
|
+
|
|
685
|
+
end
|
|
686
|
+
end
|