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,97 @@
|
|
|
1
|
+
require 'wrb'
|
|
2
|
+
module WR
|
|
3
|
+
|
|
4
|
+
# Handles a Inifile (*.ini) like a Hash. (WRB orignal)<br>
|
|
5
|
+
# Inifile formats are following.<pre>
|
|
6
|
+
# [section]
|
|
7
|
+
# key=value
|
|
8
|
+
# ...</pre>
|
|
9
|
+
class Inifile < Hash
|
|
10
|
+
|
|
11
|
+
=begin
|
|
12
|
+
Singleton method:
|
|
13
|
+
self.new(path, &block)
|
|
14
|
+
=end
|
|
15
|
+
|
|
16
|
+
# Opens a file specified <i>path</i>.<br>
|
|
17
|
+
# If <i>block</i> is given, opens for writing and closes automaticaly.
|
|
18
|
+
def self.open(path, &block)
|
|
19
|
+
self.new().open(path, &block)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
def _parse(str)
|
|
24
|
+
section = nil
|
|
25
|
+
str.each_line{|l|
|
|
26
|
+
if l =~ /\[(.+)\]/
|
|
27
|
+
sec_key = $1.strip
|
|
28
|
+
section = self[sec_key] || (self[sec_key] = {})
|
|
29
|
+
elsif l =~ /(.+)=(.+)/
|
|
30
|
+
key, val = $1.strip, $2.strip
|
|
31
|
+
section[key] = val
|
|
32
|
+
end
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def _format()
|
|
37
|
+
str = ""
|
|
38
|
+
self.each{|k,v|
|
|
39
|
+
str << "[#{k}]\n"
|
|
40
|
+
v.each{|k1, v1| str << "#{k1}=#{v1}\n" }
|
|
41
|
+
}
|
|
42
|
+
str
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def initialize(fname=nil, &block)
|
|
46
|
+
return unless fname
|
|
47
|
+
open(fname, &block)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
public
|
|
51
|
+
|
|
52
|
+
# Opens a file specified <i>path</i>.<br>
|
|
53
|
+
# If block is given, opens for writing and closes automaticaly.
|
|
54
|
+
def open(path)
|
|
55
|
+
@_path = File.expand_path(path)
|
|
56
|
+
if block_given?
|
|
57
|
+
Mutex.new.synchronize {
|
|
58
|
+
File.open(@_path, 'w+'){|f|
|
|
59
|
+
_parse(f.read)
|
|
60
|
+
yield self
|
|
61
|
+
f.write(_format)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else
|
|
65
|
+
File.open(@_path, 'r'){|f| _parse(f.read)}
|
|
66
|
+
end
|
|
67
|
+
self
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Closes and writes out to the file.
|
|
71
|
+
def close()
|
|
72
|
+
File.open(@_path, 'w'){|f| f.write(_format) }
|
|
73
|
+
end
|
|
74
|
+
alias flash close
|
|
75
|
+
|
|
76
|
+
# Gets an absolute path to this inifile.
|
|
77
|
+
def path()
|
|
78
|
+
@_path
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
module WR
|
|
84
|
+
Inifile.new("mytest.ini"){|ini|
|
|
85
|
+
ini['Section1'] = {'a' => 1, 'b' => 2}
|
|
86
|
+
ini['Section1']['c'] = 100
|
|
87
|
+
# ini['Section1'].delete('c')
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
begin
|
|
91
|
+
ini = Inifile.open("mytest.ini"); dpp ini
|
|
92
|
+
ini['Section1'].delete('c')
|
|
93
|
+
ensure
|
|
94
|
+
ini.close
|
|
95
|
+
end
|
|
96
|
+
end if $0 == __FILE__
|
|
97
|
+
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
require 'wrb'
|
|
2
|
+
require 'wrb/listcommon'
|
|
3
|
+
|
|
4
|
+
module WR
|
|
5
|
+
module RC
|
|
6
|
+
LBS_NOTIFY = 0x0001
|
|
7
|
+
LBS_SORT = 0x0002
|
|
8
|
+
LBS_NOREDRAW = 0x0004
|
|
9
|
+
LBS_MULTIPLESEL = 0x0008
|
|
10
|
+
LBS_OWNERDRAWFIXED = 0x0010
|
|
11
|
+
LBS_OWNERDRAWVARIABLE = 0x0020
|
|
12
|
+
LBS_HASSTRINGS = 0x0040
|
|
13
|
+
LBS_USETABSTOPS = 0x0080
|
|
14
|
+
LBS_NOINTEGRALHEIGHT = 0x0100
|
|
15
|
+
LBS_MULTICOLUMN = 0x0200
|
|
16
|
+
LBS_WANTKEYBOARDINPUT = 0x0400
|
|
17
|
+
LBS_EXTENDEDSEL = 0x0800
|
|
18
|
+
LBS_DISABLENOSCROLL = 0x1000
|
|
19
|
+
LBS_NODATA = 0x2000
|
|
20
|
+
LBS_NOSEL = 0x4000
|
|
21
|
+
LBS_COMBOBOX = 0x8000
|
|
22
|
+
LBS_STANDARD = (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER)
|
|
23
|
+
LBS_DEFAULT = (LBS_NOTIFY | WS_VSCROLL | WS_BORDER)
|
|
24
|
+
|
|
25
|
+
LB_ADDSTRING = 0x0180
|
|
26
|
+
LB_INSERTSTRING = 0x0181
|
|
27
|
+
LB_DELETESTRING = 0x0182
|
|
28
|
+
LB_SETSEL = 0x0185
|
|
29
|
+
LB_SETCURSEL = 0x0186
|
|
30
|
+
LB_GETSEL = 0x0187
|
|
31
|
+
LB_GETCURSEL = 0x188
|
|
32
|
+
LB_GETTEXT = 0x189
|
|
33
|
+
LB_GETTEXTLEN = 0x18a
|
|
34
|
+
LB_GETCOUNT = 0x18b
|
|
35
|
+
LB_SELECTSTRING = 0x18c
|
|
36
|
+
LB_DIR = 0x18d
|
|
37
|
+
LB_FINDSTRING = 0x18f
|
|
38
|
+
LB_GETSELCOUNT = 0x190
|
|
39
|
+
LB_GETSELITEMS = 0x191
|
|
40
|
+
LB_GETITEMDATA = 0x199
|
|
41
|
+
LB_SETITEMDATA = 0x19a
|
|
42
|
+
|
|
43
|
+
LBN_SELCHANGE = 1
|
|
44
|
+
LBN_DBLCLK = 2
|
|
45
|
+
LBN_SELCANCEL = 3
|
|
46
|
+
LBN_SETFOCUS = 4
|
|
47
|
+
LBN_KILLFOCUS = 5
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# This control contains a simple list from which the user can generally select one or more items.<br>
|
|
51
|
+
# See also <a href="https://docs.microsoft.com/en-us/windows/desktop/Controls/
|
|
52
|
+
# window-controls"> Windows Control section of Microsoft Docs.</a>
|
|
53
|
+
class Listbox < WinControl
|
|
54
|
+
include ModStdCtrl
|
|
55
|
+
include ModListItems
|
|
56
|
+
|
|
57
|
+
WinStyles = {
|
|
58
|
+
:notify => LBS_NOTIFY,
|
|
59
|
+
:sort => LBS_SORT,
|
|
60
|
+
:noredraw => LBS_NOREDRAW,
|
|
61
|
+
:multiplesel => LBS_MULTIPLESEL,
|
|
62
|
+
:ownerdrawfixed => LBS_OWNERDRAWFIXED,
|
|
63
|
+
:ownerdrawvariable => LBS_OWNERDRAWVARIABLE,
|
|
64
|
+
:hasstrings => LBS_HASSTRINGS,
|
|
65
|
+
:usetabstops => LBS_USETABSTOPS,
|
|
66
|
+
:nointegralheight => LBS_NOINTEGRALHEIGHT,
|
|
67
|
+
:multicolumn => LBS_MULTICOLUMN,
|
|
68
|
+
:wantkeyboardinput => LBS_WANTKEYBOARDINPUT,
|
|
69
|
+
:extendedsel => LBS_EXTENDEDSEL,
|
|
70
|
+
:disablenoscroll => LBS_DISABLENOSCROLL,
|
|
71
|
+
:nodata => LBS_NODATA,
|
|
72
|
+
:nosel => LBS_NOSEL,
|
|
73
|
+
:combobox => LBS_COMBOBOX,
|
|
74
|
+
:standard => LBS_STANDARD,
|
|
75
|
+
:default => LBS_DEFAULT
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
PreDefinedEvents = {
|
|
79
|
+
:selchange => [WM_COMMAND, LBN_SELCHANGE, 'hi'],
|
|
80
|
+
:dblclk => [WM_COMMAND, LBN_DBLCLK, 'hi'],
|
|
81
|
+
:selcancel => [WM_COMMAND, LBN_SELCANCEL, 'hi'],
|
|
82
|
+
:setfocus => [WM_COMMAND, LBN_SETFOCUS, 'hi'],
|
|
83
|
+
:killfocus => [WM_COMMAND, LBN_KILLFOCUS, 'hi']
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
DefaultEvents = [
|
|
87
|
+
:selchange # ???_selchange(idcmd, code, hwnd)
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
# def self.sym2style(*args) _sym2style(WinStyles, args); end
|
|
91
|
+
|
|
92
|
+
########## Main ##########
|
|
93
|
+
|
|
94
|
+
def initialize(*args)
|
|
95
|
+
super
|
|
96
|
+
@_classname = "LISTBOX"
|
|
97
|
+
# self.style |= LBS_STANDARD
|
|
98
|
+
@_items = []
|
|
99
|
+
@_ar_data = []
|
|
100
|
+
@_acceptable_events = PreDefinedEvents.dup
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
#
|
|
104
|
+
def create()
|
|
105
|
+
if self.style & 0x0ffffff == 0
|
|
106
|
+
self.style |= LBS_DEFAULT
|
|
107
|
+
end
|
|
108
|
+
super
|
|
109
|
+
@_items.each{|i| insert_item(self.count, *i)}
|
|
110
|
+
@_items.clear
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
protected
|
|
114
|
+
def _apply_options(arg)
|
|
115
|
+
if st=WinStyles[arg]
|
|
116
|
+
self.style |= st
|
|
117
|
+
return nil
|
|
118
|
+
end
|
|
119
|
+
super
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
###### common named methods to wrap SendMessage for ModListItems #####
|
|
123
|
+
private
|
|
124
|
+
def _setitemdata(wp, lp) SendMessage(LB_SETITEMDATA, wp, lp); end
|
|
125
|
+
def _addstring(wp, lp) SendMessage(LB_ADDSTRING, wp, lp); end
|
|
126
|
+
def _insertstring(wp, lp) SendMessage(LB_INSERTSTRING, wp, lp); end
|
|
127
|
+
def _deletestring(wp, lp) SendMessage(LB_DELETESTRING, wp, lp); end
|
|
128
|
+
def _getcount(wp, lp) SendMessage(LB_GETCOUNT, wp, lp); end
|
|
129
|
+
def _gettextlen(wp, lp) SendMessage(LB_GETTEXTLEN, wp, lp); end
|
|
130
|
+
def _gettext(wp, lp) SendMessage(LB_GETTEXT, wp, lp); end
|
|
131
|
+
def _getitemdata(wp, lp) SendMessage(LB_GETITEMDATA, wp, lp); end
|
|
132
|
+
def _findstring(wp, lp) SendMessage(LB_FINDSTRING, wp, lp); end
|
|
133
|
+
def _getcursel(wp, lp) SendMessage(LB_GETCURSEL, wp, lp); end
|
|
134
|
+
def _setcursel(wp, lp) SendMessage(LB_SETCURSEL, wp, lp); end
|
|
135
|
+
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
module WR
|
|
140
|
+
class Myform < Form
|
|
141
|
+
def initialize()
|
|
142
|
+
resize 320, 240
|
|
143
|
+
_<< Listbox[:lb1, "", 0, 0, 200, 200]
|
|
144
|
+
_.lb1 << [['a', 1], 'b', 'c']
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
self.start
|
|
148
|
+
end
|
|
149
|
+
end if $0 == __FILE__
|
|
@@ -0,0 +1,1467 @@
|
|
|
1
|
+
require 'wrb'
|
|
2
|
+
|
|
3
|
+
module WR
|
|
4
|
+
module RC
|
|
5
|
+
LVM_FIRST = 0x1000
|
|
6
|
+
LVM_GETBKCOLOR = LVM_FIRST+0
|
|
7
|
+
LVM_SETBKCOLOR = LVM_FIRST+1
|
|
8
|
+
LVM_GETIMAGELIST = LVM_FIRST+2
|
|
9
|
+
LVM_SETIMAGELIST = LVM_FIRST+3
|
|
10
|
+
LVM_GETITEMCOUNT = LVM_FIRST+4
|
|
11
|
+
LVM_DELETEITEM = LVM_FIRST+8
|
|
12
|
+
LVM_DELETEALLITEM = LVM_FIRST+9
|
|
13
|
+
LVM_GETCALLBACKMASK=LVM_FIRST+10
|
|
14
|
+
LVM_SETCALLBACKMASK=LVM_FIRST+11
|
|
15
|
+
LVM_GETNEXTITEM = LVM_FIRST+12
|
|
16
|
+
|
|
17
|
+
LVM_GETITEMRECT = LVM_FIRST+14
|
|
18
|
+
LVM_SETITEMPOSITION=LVM_FIRST+15
|
|
19
|
+
LVM_GETITEMPOSITION=LVM_FIRST+16
|
|
20
|
+
LVM_HITTEST = LVM_FIRST+18
|
|
21
|
+
LVM_ENSUREVISIBLE = LVM_FIRST+19
|
|
22
|
+
LVM_SCROLL = LVM_FIRST+20
|
|
23
|
+
LVM_REDRAWITEMS = LVM_FIRST+21
|
|
24
|
+
LVM_ARRANGE = LVM_FIRST+22
|
|
25
|
+
LVM_GETEDITCONTROL= LVM_FIRST+24
|
|
26
|
+
LVM_DELETECOLUMN = LVM_FIRST+28
|
|
27
|
+
LVM_GETCOLUMNWIDTH= LVM_FIRST+29
|
|
28
|
+
LVM_SETCOLUMNWIDTH= LVM_FIRST+30
|
|
29
|
+
LVM_GETHEADER = LVM_FIRST+31
|
|
30
|
+
LVM_CREATEDRAGIMAGE=LVM_FIRST+33
|
|
31
|
+
LVM_GETVIEWRECT = LVM_FIRST+34
|
|
32
|
+
LVM_GETTEXTCOLOR = LVM_FIRST+35
|
|
33
|
+
LVM_SETTEXTCOLOR = LVM_FIRST+36
|
|
34
|
+
LVM_GETTEXTBKCOLOR = LVM_FIRST+37
|
|
35
|
+
LVM_SETTEXTBKCOLOR = LVM_FIRST+38
|
|
36
|
+
LVM_GETTOPINDEX = LVM_FIRST+39
|
|
37
|
+
LVM_GETCOUNTPERPAGE = LVM_FIRST+40
|
|
38
|
+
LVM_GETORIGIN = LVM_FIRST+41
|
|
39
|
+
LVM_UPDATE = LVM_FIRST+42
|
|
40
|
+
LVM_SETITEMSTATE = LVM_FIRST+43
|
|
41
|
+
LVM_GETITEMSTATE = LVM_FIRST+44
|
|
42
|
+
|
|
43
|
+
LVM_SORTITEMS = LVM_FIRST+48
|
|
44
|
+
LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
|
|
45
|
+
LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55
|
|
46
|
+
LVM_SUBITEMHITTEST= LVM_FIRST+57
|
|
47
|
+
|
|
48
|
+
LVM_GETITEMA = LVM_FIRST+5
|
|
49
|
+
LVM_SETITEMA = LVM_FIRST+6
|
|
50
|
+
LVM_INSERTITEMA = LVM_FIRST+7
|
|
51
|
+
LVM_FINDITEMA = LVM_FIRST+13
|
|
52
|
+
LVM_GETSTRINGWIDTHA= LVM_FIRST+17
|
|
53
|
+
LVM_EDITLABELA = LVM_FIRST+23
|
|
54
|
+
LVM_GETCOLUMNA = LVM_FIRST+25
|
|
55
|
+
LVM_SETCOLUMNA = LVM_FIRST+26
|
|
56
|
+
LVM_INSERTCOLUMNA = LVM_FIRST+27
|
|
57
|
+
LVM_GETITEMTEXTA = LVM_FIRST+45
|
|
58
|
+
LVM_SETITEMTEXTA = LVM_FIRST+46
|
|
59
|
+
LVM_GETSELECTEDA = LVM_FIRST+50
|
|
60
|
+
LVM_SETBKIMAGEA = LVM_FIRST+68
|
|
61
|
+
LVM_GETBKIMAGEA = LVM_FIRST+69
|
|
62
|
+
LVM_SETTOOLTIPS = LVM_FIRST+74
|
|
63
|
+
LVM_GETTOOLTIPS = LVM_FIRST+78
|
|
64
|
+
|
|
65
|
+
LVM_GETITEMW = LVM_FIRST+75
|
|
66
|
+
LVM_SETITEMW = LVM_FIRST+76
|
|
67
|
+
LVM_INSERTITEMW = LVM_FIRST+77
|
|
68
|
+
LVM_FINDITEMW = LVM_FIRST+83
|
|
69
|
+
LVM_GETSTRINGWIDTHW= LVM_FIRST+87
|
|
70
|
+
LVM_GETCOLUMNW = LVM_FIRST+95
|
|
71
|
+
LVM_SETCOLUMNW = LVM_FIRST+96
|
|
72
|
+
LVM_INSERTCOLUMNW = LVM_FIRST+97
|
|
73
|
+
LVM_GETITEMTEXTW = LVM_FIRST+115
|
|
74
|
+
LVM_SETITEMTEXTW = LVM_FIRST+116
|
|
75
|
+
LVM_EDITLABELW = LVM_FIRST+118
|
|
76
|
+
LVM_GETSELECTEDW = LVM_FIRST+120
|
|
77
|
+
LVM_SETBKIMAGEW = LVM_FIRST+138
|
|
78
|
+
LVM_GETBKIMAGEW = LVM_FIRST+139
|
|
79
|
+
|
|
80
|
+
if RWin::UNICODE
|
|
81
|
+
LVM_GETITEM = LVM_GETITEMW
|
|
82
|
+
LVM_SETITEM = LVM_SETITEMW
|
|
83
|
+
LVM_INSERTITEM = LVM_INSERTITEMW
|
|
84
|
+
LVM_FINDITEM = LVM_FINDITEMW
|
|
85
|
+
LVM_GETSTRINGWIDTH= LVM_GETSTRINGWIDTHW
|
|
86
|
+
LVM_GETCOLUMN = LVM_GETCOLUMNW
|
|
87
|
+
LVM_SETCOLUMN = LVM_SETCOLUMNW
|
|
88
|
+
LVM_INSERTCOLUMN = LVM_INSERTCOLUMNW
|
|
89
|
+
LVM_GETITEMTEXT = LVM_GETITEMTEXTW
|
|
90
|
+
LVM_SETITEMTEXT = LVM_SETITEMTEXTW
|
|
91
|
+
LVM_EDITLABEL = LVM_EDITLABELW
|
|
92
|
+
LVM_GETSELECTED = LVM_GETSELECTEDW
|
|
93
|
+
LVM_SETBKIMAGE = LVM_SETBKIMAGEW
|
|
94
|
+
LVM_GETBKIMAGE = LVM_GETBKIMAGEW
|
|
95
|
+
else
|
|
96
|
+
LVM_GETITEM = LVM_GETITEMA
|
|
97
|
+
LVM_SETITEM = LVM_SETITEMA
|
|
98
|
+
LVM_INSERTITEM = LVM_INSERTITEMA
|
|
99
|
+
LVM_FINDITEM = LVM_FINDITEMA
|
|
100
|
+
LVM_GETSTRINGWIDTH= LVM_GETSTRINGWIDTHA
|
|
101
|
+
LVM_GETCOLUMN = LVM_GETCOLUMNA
|
|
102
|
+
LVM_SETCOLUMN = LVM_SETCOLUMNA
|
|
103
|
+
LVM_INSERTCOLUMN = LVM_INSERTCOLUMNA
|
|
104
|
+
LVM_GETITEMTEXT = LVM_GETITEMTEXTA
|
|
105
|
+
LVM_SETITEMTEXT = LVM_SETITEMTEXTA
|
|
106
|
+
LVM_EDITLABEL = LVM_EDITLABELA
|
|
107
|
+
LVM_GETSELECTED = LVM_GETSELECTEDA
|
|
108
|
+
LVM_SETBKIMAGE = LVM_SETBKIMAGEA
|
|
109
|
+
LVM_GETBKIMAGE = LVM_GETBKIMAGEA
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
LVNI_ALL = 0x0
|
|
113
|
+
LVNI_FOCUSED = 0x1
|
|
114
|
+
LVNI_SELECTED = 0x2
|
|
115
|
+
LVNI_CUT = 0x4
|
|
116
|
+
LVNI_DROPHILITED = 0x8
|
|
117
|
+
LVNI_ABOVE = 0x100
|
|
118
|
+
LVNI_BELOW = 0x200
|
|
119
|
+
LVNI_TOLEFT = 0x400
|
|
120
|
+
LVNI_TORIGHT = 0x800
|
|
121
|
+
|
|
122
|
+
LVN_FIRST = -100
|
|
123
|
+
LVN_ITEMCHANGING = LVN_FIRST-0
|
|
124
|
+
LVN_ITEMCHANGED = LVN_FIRST-1
|
|
125
|
+
LVN_INSERTITEM = LVN_FIRST-2
|
|
126
|
+
LVN_DELETEITEM = LVN_FIRST-3
|
|
127
|
+
LVN_DELETEALLITEMS = LVN_FIRST-4
|
|
128
|
+
LVN_BEGINLABELEDITA = LVN_FIRST-5
|
|
129
|
+
LVN_BEGINLABELEDITW = LVN_FIRST-75
|
|
130
|
+
LVN_ENDLABELEDITA = LVN_FIRST-6
|
|
131
|
+
LVN_ENDLABELEDITW = LVN_FIRST-76
|
|
132
|
+
LVN_COLUMNCLICK = LVN_FIRST-8
|
|
133
|
+
LVN_BEGINDRAG = LVN_FIRST-9
|
|
134
|
+
LVN_BEGINRDRAG = LVN_FIRST-11
|
|
135
|
+
|
|
136
|
+
LVN_ODCACHEHINT = LVN_FIRST-13
|
|
137
|
+
LVN_ODFINDITEMA = LVN_FIRST-52
|
|
138
|
+
LVN_ODFINDITEMW = LVN_FIRST-79
|
|
139
|
+
|
|
140
|
+
LVN_ITEMACTIVATE = LVN_FIRST-14
|
|
141
|
+
LVN_ODSTATECHANGED = LVN_FIRST-15
|
|
142
|
+
|
|
143
|
+
LVN_HOTTRACK = LVN_FIRST-21
|
|
144
|
+
LVN_GETDISPINFOA = LVN_FIRST-50
|
|
145
|
+
LVN_GETDISPINFOW = LVN_FIRST-77
|
|
146
|
+
LVN_SETDISPINFOA = LVN_FIRST-51
|
|
147
|
+
LVN_SETDISPINFOW = LVN_FIRST-78
|
|
148
|
+
LVN_KEYDOWN = LVN_FIRST-55
|
|
149
|
+
|
|
150
|
+
if RWin::UNICODE
|
|
151
|
+
LVN_ODFINDITEM = LVN_ODFINDITEMW
|
|
152
|
+
LVN_BEGINLABELEDIT = LVN_BEGINLABELEDITW
|
|
153
|
+
LVN_ENDLABELEDIT = LVN_ENDLABELEDITW
|
|
154
|
+
LVN_GETDISPINFO = LVN_GETDISPINFOW
|
|
155
|
+
LVN_SETDISPINFO = LVN_SETDISPINFOW
|
|
156
|
+
else
|
|
157
|
+
LVN_ODFINDITEM = LVN_ODFINDITEMA
|
|
158
|
+
LVN_BEGINLABELEDIT = LVN_BEGINLABELEDITA
|
|
159
|
+
LVN_ENDLABELEDIT = LVN_ENDLABELEDITA
|
|
160
|
+
LVN_GETDISPINFO = LVN_GETDISPINFOA
|
|
161
|
+
LVN_SETDISPINFO = LVN_SETDISPINFOA
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
LVS_ICON = 0x0
|
|
165
|
+
LVS_REPORT = 0x1
|
|
166
|
+
LVS_SMALLICON = 0x2
|
|
167
|
+
LVS_LIST = 0x3
|
|
168
|
+
LVS_TYPEMASK = 0x3
|
|
169
|
+
LVS_SINGLESEL = 0x4
|
|
170
|
+
LVS_SHOWSELALWAYS = 0x8
|
|
171
|
+
LVS_SORTASCENDING = 0x10
|
|
172
|
+
LVS_SORTDESCENDING = 0x20
|
|
173
|
+
LVS_SHAREIMAGELISTS = 0x40
|
|
174
|
+
LVS_NOLABELWRAP = 0x80
|
|
175
|
+
LVS_AUTOARRANGE = 0x100
|
|
176
|
+
LVS_EDITLABELS = 0x200
|
|
177
|
+
LVS_OWNERDATA = 0x1000
|
|
178
|
+
LVS_NOSCROLL = 0x2000
|
|
179
|
+
LVS_TYPESTYLEMASK = 0xfc00
|
|
180
|
+
LVS_ALIGNTOP = 0x0
|
|
181
|
+
LVS_ALIGNLEFT = 0x800
|
|
182
|
+
LVS_ALIGNMASK = 0xc00
|
|
183
|
+
LVS_OWNERDRAWFIXED = 0x400
|
|
184
|
+
LVS_NOCOLUMNHEADER = 0x4000
|
|
185
|
+
LVS_NOSORTHEADER = 0x8000
|
|
186
|
+
|
|
187
|
+
LVIF_TEXT = 0x1
|
|
188
|
+
LVIF_IMAGE = 0x2
|
|
189
|
+
LVIF_PARAM = 0x4
|
|
190
|
+
LVIF_STATE = 0x8
|
|
191
|
+
LVIF_INDENT = 0x10
|
|
192
|
+
LVIF_NORECOMPUTE = 0x800
|
|
193
|
+
LVIF_GROUPID = 0x100
|
|
194
|
+
LVIF_COLUMNS = 0x200
|
|
195
|
+
LVIF_STD = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM | LVIF_INDENT
|
|
196
|
+
|
|
197
|
+
LVIS_FOCUSED = 0x1
|
|
198
|
+
LVIS_SELECTED = 0x2
|
|
199
|
+
LVIS_CUT = 0x4
|
|
200
|
+
LVIS_DROPHILITED = 0x8
|
|
201
|
+
LVIS_GLOW = 0x10
|
|
202
|
+
LVIS_ACTIVATING = 0x20
|
|
203
|
+
LVIS_OVERLAYMASK = 0xf00
|
|
204
|
+
LVIS_STATEIMAGEMASK = 0xf000
|
|
205
|
+
|
|
206
|
+
LVCF_FMT = 0x1
|
|
207
|
+
LVCF_WIDTH = 0x2
|
|
208
|
+
LVCF_TEXT = 0x4
|
|
209
|
+
LVCF_SUBITEM = 0x8
|
|
210
|
+
LVCF_IMAGE = 0x10
|
|
211
|
+
LVCF_ORDER = 0x20
|
|
212
|
+
LVCF_STD = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM
|
|
213
|
+
|
|
214
|
+
LVCFMT_LEFT = 0x0
|
|
215
|
+
LVCFMT_RIGHT = 0x1
|
|
216
|
+
LVCFMT_CENTER = 0x2
|
|
217
|
+
LVCFMT_JUSTIFYMASK = 0x3
|
|
218
|
+
LVCFMT_IMAGE = 0x800
|
|
219
|
+
LVCFMT_BITMAP_ON_RIGHT = 0x1000
|
|
220
|
+
|
|
221
|
+
LVSIL_NORMAL = 0
|
|
222
|
+
LVSIL_SMALL = 1
|
|
223
|
+
LVSIL_STATE = 2
|
|
224
|
+
LVSIL_GROUPHEADER = 3
|
|
225
|
+
|
|
226
|
+
LVS_EX_GRIDLINES = 0x1
|
|
227
|
+
LVS_EX_SUBITEMIMAGES = 0x2
|
|
228
|
+
LVS_EX_CHECKBOXES = 0x4
|
|
229
|
+
LVS_EX_TRACKSELECT = 0x8
|
|
230
|
+
LVS_EX_HEADERDRAGDROP = 0x10
|
|
231
|
+
LVS_EX_FULLROWSELECT = 0x20
|
|
232
|
+
LVS_EX_ONECLICKACTIVATE = 0x40
|
|
233
|
+
LVS_EX_TWOCLICKACTIVATE = 0x80
|
|
234
|
+
LVS_EX_FLATSB = 0x100
|
|
235
|
+
LVS_EX_REGIONAL = 0x200
|
|
236
|
+
LVS_EX_INFOTIP = 0x400
|
|
237
|
+
LVS_EX_UNDERLINEHOT = 0x800
|
|
238
|
+
LVS_EX_UNDERLINECOLD = 0x1000
|
|
239
|
+
LVS_EX_MULTIWORKAREAS = 0x2000
|
|
240
|
+
LVS_EX_LABELTIP = 0x4000
|
|
241
|
+
LVS_EX_BORDERSELECT = 0x8000
|
|
242
|
+
LVS_EX_DOUBLEBUFFER = 0x10000
|
|
243
|
+
LVS_EX_HIDELABELS = 0x20000
|
|
244
|
+
LVS_EX_SINGLEROW = 0x40000
|
|
245
|
+
LVS_EX_SNAPTOGRID = 0x80000
|
|
246
|
+
LVS_EX_SIMPLESELECT = 0x100000
|
|
247
|
+
LVS_EX_JUSTIFYCOLUMNS = 0x200000
|
|
248
|
+
LVS_EX_TRANSPARENTBKGND = 0x400000
|
|
249
|
+
LVS_EX_TRANSPARENTSHADOWTEXT= 0x800000
|
|
250
|
+
LVS_EX_AUTOAUTOARRANGE = 0x1000000
|
|
251
|
+
LVS_EX_HEADERINALLVIEWS = 0x2000000
|
|
252
|
+
LVS_EX_AUTOCHECKSELECT = 0x8000000
|
|
253
|
+
LVS_EX_AUTOSIZECOLUMNS = 0x10000000
|
|
254
|
+
LVS_EX_COLUMNSNAPPOINTS = 0x40000000
|
|
255
|
+
LVS_EX_COLUMNOVERFLOW = 0x80000000
|
|
256
|
+
|
|
257
|
+
LVFI_PARAM = 0x1
|
|
258
|
+
LVFI_STRING = 0x2
|
|
259
|
+
LVFI_PARTIAL = 0x8
|
|
260
|
+
LVFI_WRAP = 0x20
|
|
261
|
+
LVFI_NEARESTXY = 0x40
|
|
262
|
+
|
|
263
|
+
HDM_GETITEMCOUNT = 0x1200 unless defined? HDM_GETITEMCOUNT
|
|
264
|
+
|
|
265
|
+
LVBKIF_SOURCE_NONE = 0x0
|
|
266
|
+
LVBKIF_SOURCE_HBITMAP = 0x1
|
|
267
|
+
LVBKIF_SOURCE_URL = 0x2
|
|
268
|
+
LVBKIF_SOURCE_MASK = 0x3
|
|
269
|
+
|
|
270
|
+
LVBKIF_STYLE_NORMAL = 0x0
|
|
271
|
+
LVBKIF_STYLE_TILE = 0x10
|
|
272
|
+
LVBKIF_STYLE_MASK = 0x10
|
|
273
|
+
LVBKIF_FLAG_TILEOFFSET = 0x100
|
|
274
|
+
LVBKIF_TYPE_WATERMARK = 0x10000000
|
|
275
|
+
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
# A window that displays a collection of items. This provides several ways to arrange and display items.
|
|
279
|
+
# <br>See also <a href="https://docs.microsoft.com/en-us/windows/desktop/Controls/
|
|
280
|
+
# window-controls"> Windows Control section of Microsoft Docs.</a>
|
|
281
|
+
class Listview < WinControl
|
|
282
|
+
include ModCommCtrl
|
|
283
|
+
|
|
284
|
+
LVITEM = API.defstruct "
|
|
285
|
+
UINT mask;
|
|
286
|
+
int iItem;
|
|
287
|
+
int iSubItem;
|
|
288
|
+
UINT state;
|
|
289
|
+
UINT stateMask;
|
|
290
|
+
LPTSTR pszText;
|
|
291
|
+
int cchTextMax;
|
|
292
|
+
int iImage;
|
|
293
|
+
LPARAM lParam;
|
|
294
|
+
int iIndent;
|
|
295
|
+
int iGroupId;
|
|
296
|
+
UINT cColumns;
|
|
297
|
+
UINT* puColumns;"
|
|
298
|
+
|
|
299
|
+
LVCOLUMN = API.defstruct "
|
|
300
|
+
UINT mask;
|
|
301
|
+
int fmt;
|
|
302
|
+
int cx;
|
|
303
|
+
LPTSTR pszText;
|
|
304
|
+
int cchTextMax;
|
|
305
|
+
int iSubItem;
|
|
306
|
+
int iImage;
|
|
307
|
+
int iOrder;"
|
|
308
|
+
|
|
309
|
+
LVFINDINFO = API.defstruct "
|
|
310
|
+
UINT flags;
|
|
311
|
+
LPTSTR psz;
|
|
312
|
+
LPARAM lParam;
|
|
313
|
+
POINT pt;
|
|
314
|
+
UINT vkDirection;"
|
|
315
|
+
|
|
316
|
+
LVHITTEST = API.defstruct "
|
|
317
|
+
POINT pt;
|
|
318
|
+
UINT flags;
|
|
319
|
+
int iItem;
|
|
320
|
+
int iSubItem"
|
|
321
|
+
|
|
322
|
+
NMLISTVIEW = API.defstruct "
|
|
323
|
+
NMHDR hdr;
|
|
324
|
+
int iItem;
|
|
325
|
+
int iSubItem;
|
|
326
|
+
UINT uNewState;
|
|
327
|
+
UINT uOldState;
|
|
328
|
+
UINT uChanged;
|
|
329
|
+
POINT ptAction;
|
|
330
|
+
LPARAM lParam;"
|
|
331
|
+
|
|
332
|
+
NMLVCUSTOMDRAW = API.defstruct "
|
|
333
|
+
NMCUSTOMDRAW nmcd;
|
|
334
|
+
COLORREF clrText;
|
|
335
|
+
COLORREF clrTextBk;
|
|
336
|
+
int iSubItem;
|
|
337
|
+
DWORD dwItemType;
|
|
338
|
+
COLORREF clrFace;
|
|
339
|
+
int iIconEffect;
|
|
340
|
+
int iIconPhase;
|
|
341
|
+
int iPartId;
|
|
342
|
+
int iStateId;
|
|
343
|
+
RECT rcText;
|
|
344
|
+
UINT uAlign;"
|
|
345
|
+
|
|
346
|
+
LVKEYDOWN = API.defstruct "
|
|
347
|
+
NMHDR hdr;
|
|
348
|
+
WORD wVKey;
|
|
349
|
+
UINT flags;"
|
|
350
|
+
|
|
351
|
+
NMLVGETINFOTIP = API.defstruct "
|
|
352
|
+
NMHDR hdr;
|
|
353
|
+
DWORD dwFlags;
|
|
354
|
+
LPTSTR pszText;
|
|
355
|
+
int cchTextMax;
|
|
356
|
+
int iItem;
|
|
357
|
+
int iSubItem;
|
|
358
|
+
LPARAM lParam;"
|
|
359
|
+
|
|
360
|
+
NMITEMACTIVATE = API.defstruct "
|
|
361
|
+
NMHDR hdr;
|
|
362
|
+
int iItem;
|
|
363
|
+
int iSubItem;
|
|
364
|
+
UINT uNewState;
|
|
365
|
+
UINT uOldState;
|
|
366
|
+
UINT uChanged;
|
|
367
|
+
POINT ptAction;
|
|
368
|
+
LPARAM lParam;
|
|
369
|
+
UINT uKeyFlags;"
|
|
370
|
+
|
|
371
|
+
NMLVDISPINFO = API.defstruct "
|
|
372
|
+
NMHDR hdr;
|
|
373
|
+
LVITEM item;"
|
|
374
|
+
|
|
375
|
+
LVBKIMAGE = API.defstruct "
|
|
376
|
+
ULONG ulFlags;
|
|
377
|
+
HBITMAP hbm;
|
|
378
|
+
LPTSTR pszImage;
|
|
379
|
+
UINT cchImageMax;
|
|
380
|
+
int xOffsetPercent;
|
|
381
|
+
int yOffsetPercent;"
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
MAXCOLUMN = 0xffff
|
|
385
|
+
MaxText = 256
|
|
386
|
+
|
|
387
|
+
class Column # wrapper of LVCOLUMN and index
|
|
388
|
+
include RC
|
|
389
|
+
ColumnFormats = {
|
|
390
|
+
:left => LVCFMT_LEFT,
|
|
391
|
+
:right => LVCFMT_RIGHT,
|
|
392
|
+
:center => LVCFMT_CENTER,
|
|
393
|
+
:image => LVCFMT_IMAGE,
|
|
394
|
+
:bitmap_on_right => LVCFMT_BITMAP_ON_RIGHT
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
def self.[](*args) self.new(*args); end
|
|
398
|
+
|
|
399
|
+
def initialize(*args)
|
|
400
|
+
@owner = args.shift if args[0].is_a?(RWin::Window)
|
|
401
|
+
@index = args.shift if args[0].is_a?(Integer)
|
|
402
|
+
@text = args.shift if args[0].is_a?(String)
|
|
403
|
+
sz = @text ? @text.size : nil
|
|
404
|
+
|
|
405
|
+
width, fmt, image = args
|
|
406
|
+
width = width ? width.to_i : 80
|
|
407
|
+
fmt = fmt.is_a?(Symbol) ? ColumnFormats[fmt] : fmt.to_i#; dpp width, fmt, image
|
|
408
|
+
@lvcolumn = LVCOLUMN[LVCF_STD, fmt, width, @text, sz, @index, image]
|
|
409
|
+
# dpp @lvcolumn.to_hsh
|
|
410
|
+
if image
|
|
411
|
+
@lvcolumn.mask |= LVCF_IMAGE
|
|
412
|
+
@lvcolumn.fmt |= LVCFMT_IMAGE
|
|
413
|
+
end
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
def owner=(owner)
|
|
417
|
+
@owner = owner
|
|
418
|
+
self
|
|
419
|
+
end
|
|
420
|
+
|
|
421
|
+
def format_to_sym()
|
|
422
|
+
ColumnFormats.key(@lvcolumn.fmt & 0x1fff)
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
def format()
|
|
426
|
+
if @owner.alive?
|
|
427
|
+
@lvcolumn.clear(LVCF_FMT)
|
|
428
|
+
@owner.SendMessage(LVM_GETCOLUMN, @index, @lvcolumn)
|
|
429
|
+
@lvcolumn.fmt & 0x1fff
|
|
430
|
+
else
|
|
431
|
+
@format
|
|
432
|
+
end
|
|
433
|
+
end
|
|
434
|
+
def format=(fmt)
|
|
435
|
+
fmt = ColumnFormats[fmt] if fmt.is_a?(Symbol)
|
|
436
|
+
if @owner.alive?
|
|
437
|
+
@lvcolumn.clear(LVCF_FMT, fmt.to_i)
|
|
438
|
+
@owner.SendMessage(LVM_SETCOLUMN, @index, @lvcolumn)
|
|
439
|
+
else
|
|
440
|
+
@format = fmt
|
|
441
|
+
end
|
|
442
|
+
end
|
|
443
|
+
|
|
444
|
+
def text()
|
|
445
|
+
if @owner.alive?
|
|
446
|
+
buff = TCHAR[MaxText]
|
|
447
|
+
@lvcolumn.clear(LVCF_TEXT, nil, nil, buff, buff.size)
|
|
448
|
+
@owner.SendMessage(LVM_GETCOLUMN, @index, @lvcolumn)
|
|
449
|
+
buff.to_s
|
|
450
|
+
else
|
|
451
|
+
@text
|
|
452
|
+
end
|
|
453
|
+
end
|
|
454
|
+
def text=(txt)
|
|
455
|
+
if @owner.alive?
|
|
456
|
+
@lvcolumn.clear(LVCF_TEXT, nil, nil, txt, txt.size)
|
|
457
|
+
@owner.SendMessage(LVM_SETCOLUMN, @index, @lvcolumn)
|
|
458
|
+
else
|
|
459
|
+
@text = txt
|
|
460
|
+
end
|
|
461
|
+
end
|
|
462
|
+
|
|
463
|
+
def width()
|
|
464
|
+
if @owner.alive?
|
|
465
|
+
@lvcolumn.clear(LVCF_WIDTH)
|
|
466
|
+
@owner.SendMessage(LVM_GETCOLUMN, @index, @lvcolumn)
|
|
467
|
+
end
|
|
468
|
+
@lvcolumn.cx
|
|
469
|
+
end
|
|
470
|
+
def width=(w)
|
|
471
|
+
if @owner.alive?
|
|
472
|
+
@lvcolumn.clear(LVCF_WIDTH, nil, w.to_i)
|
|
473
|
+
@owner.SendMessage(LVM_SETCOLUMN, @index, @lvcolumn)
|
|
474
|
+
else
|
|
475
|
+
@lvcolumn.cx = w
|
|
476
|
+
end
|
|
477
|
+
end
|
|
478
|
+
|
|
479
|
+
def image()
|
|
480
|
+
if @owner.alive?
|
|
481
|
+
@lvcolumn.clear(LVCF_FMT|LVCF_IMAGE)
|
|
482
|
+
@owner.SendMessage(LVM_GETCOLUMN, @index, @lvcolumn)
|
|
483
|
+
end
|
|
484
|
+
@lvcolumn.fmt & LVCFMT_IMAGE > 0 ? @lvcolumn.iImage : nil
|
|
485
|
+
end
|
|
486
|
+
def image=(i)
|
|
487
|
+
if @owner.alive?
|
|
488
|
+
@lvcolumn.clear(LVCF_FMT|LVCF_IMAGE, LVCFMT_IMAGE)
|
|
489
|
+
@lvcolumn.iImage = i
|
|
490
|
+
@owner.SendMessage(LVM_SETCOLUMN, @index, @lvcolumn)
|
|
491
|
+
else
|
|
492
|
+
@lvcolumn.iImage = i
|
|
493
|
+
end
|
|
494
|
+
end
|
|
495
|
+
|
|
496
|
+
def delete()
|
|
497
|
+
@owner.SendMessage(LVM_DELETECOLUMN, @index, 0)
|
|
498
|
+
end
|
|
499
|
+
|
|
500
|
+
def lvcolumn()
|
|
501
|
+
@lvcolumn.pszText = @text
|
|
502
|
+
@lvcolumn.cchTextMax = @text ? @text.size : nil
|
|
503
|
+
@lvcolumn
|
|
504
|
+
end
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
class Columns #< Array
|
|
508
|
+
include RC
|
|
509
|
+
attr_reader :owner
|
|
510
|
+
def initialize(owner)
|
|
511
|
+
@owner = owner
|
|
512
|
+
@columns = []
|
|
513
|
+
# super()
|
|
514
|
+
end
|
|
515
|
+
|
|
516
|
+
def <<(arg)
|
|
517
|
+
@owner.alive? ? self[size, 0] = arg : @columns[size, 0] = arg #super
|
|
518
|
+
self
|
|
519
|
+
end
|
|
520
|
+
|
|
521
|
+
def size()
|
|
522
|
+
if @owner.alive?
|
|
523
|
+
API.SendMessage(@owner.SendMessage(LVM_GETHEADER, 0, 0), HDM_GETITEMCOUNT, 0, 0)
|
|
524
|
+
else
|
|
525
|
+
@columns.size
|
|
526
|
+
end
|
|
527
|
+
end
|
|
528
|
+
alias count size
|
|
529
|
+
|
|
530
|
+
def clear()
|
|
531
|
+
@owner.alive? ? size.times{self[0].delete} : @columns.clear
|
|
532
|
+
end
|
|
533
|
+
|
|
534
|
+
def [](idx)
|
|
535
|
+
if @owner.alive?
|
|
536
|
+
Column.new(@owner, idx)
|
|
537
|
+
else
|
|
538
|
+
@columns[idx]
|
|
539
|
+
end
|
|
540
|
+
end
|
|
541
|
+
|
|
542
|
+
def []=(idx, *args)
|
|
543
|
+
case args.size
|
|
544
|
+
when 1
|
|
545
|
+
n = 1; args = args[0]
|
|
546
|
+
when 2
|
|
547
|
+
n, args = args #; dpp args
|
|
548
|
+
else
|
|
549
|
+
raise ArgumentError, "invalid num of arguments"#, caller(1)
|
|
550
|
+
end
|
|
551
|
+
args = [args] unless args.is_a?(Array)
|
|
552
|
+
if @owner.alive?
|
|
553
|
+
n.times{|i| _delete_column(idx)}
|
|
554
|
+
j = 0
|
|
555
|
+
item = args[0].is_a?(String) ? [args.shift] : [] #; dpp args
|
|
556
|
+
while i=args.shift
|
|
557
|
+
if i.is_a?(String) #; dpp i, j, item
|
|
558
|
+
unless item.empty?
|
|
559
|
+
_insert_column(idx+j, item)
|
|
560
|
+
j += 1
|
|
561
|
+
end
|
|
562
|
+
item = []
|
|
563
|
+
elsif i.is_a?(Array) || i.is_a?(Column) # ; dpp i, j, item
|
|
564
|
+
unless item.empty?
|
|
565
|
+
_insert_column(idx+j, item)
|
|
566
|
+
j += 1
|
|
567
|
+
end
|
|
568
|
+
_insert_column(idx+j, i)
|
|
569
|
+
j += 1
|
|
570
|
+
item = []
|
|
571
|
+
next
|
|
572
|
+
elsif i.nil?
|
|
573
|
+
next
|
|
574
|
+
end
|
|
575
|
+
item << i
|
|
576
|
+
end
|
|
577
|
+
_insert_column(idx+j, item) if !item.empty? #; dpp @_pages,idx, num, ar_pages, anum
|
|
578
|
+
else
|
|
579
|
+
@columns[idx, n] = args
|
|
580
|
+
end
|
|
581
|
+
end
|
|
582
|
+
|
|
583
|
+
def each()
|
|
584
|
+
count.times{|i| yield self[i]}
|
|
585
|
+
end
|
|
586
|
+
|
|
587
|
+
private
|
|
588
|
+
def _create_substance()
|
|
589
|
+
self[0, 0] = @columns
|
|
590
|
+
@columns = nil
|
|
591
|
+
end
|
|
592
|
+
|
|
593
|
+
def _insert_column(idx, arg) #; dpp arg
|
|
594
|
+
if @owner.alive?
|
|
595
|
+
clmn = arg.is_a?(Column) ? arg : Column[*arg]
|
|
596
|
+
clmn.owner = @owner
|
|
597
|
+
@owner.SendMessage(LVM_INSERTCOLUMN, idx, clmn.lvcolumn)
|
|
598
|
+
else
|
|
599
|
+
idx = idx > self.size ? self.size : idx
|
|
600
|
+
self.insert(idx, arg)
|
|
601
|
+
end
|
|
602
|
+
end
|
|
603
|
+
|
|
604
|
+
def _delete_column(idx)
|
|
605
|
+
@owner.SendMessage(LVM_DELETECOLUMN, idx, 0)
|
|
606
|
+
end
|
|
607
|
+
end
|
|
608
|
+
|
|
609
|
+
class Item # Wrapper of index
|
|
610
|
+
include RC
|
|
611
|
+
|
|
612
|
+
ItemStates = {
|
|
613
|
+
:focused => LVIS_FOCUSED,
|
|
614
|
+
:selected => LVIS_SELECTED,
|
|
615
|
+
:cut => LVIS_CUT,
|
|
616
|
+
:drophilited => LVIS_DROPHILITED,
|
|
617
|
+
:glow => LVIS_GLOW,
|
|
618
|
+
:activating => LVIS_ACTIVATING,
|
|
619
|
+
:overlaymask => LVIS_OVERLAYMASK,
|
|
620
|
+
:stateimagemsk => LVIS_STATEIMAGEMASK
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
def initialize(owner, idx)
|
|
624
|
+
@owner = owner
|
|
625
|
+
@index = idx
|
|
626
|
+
end
|
|
627
|
+
|
|
628
|
+
def [](idx)
|
|
629
|
+
if @owner.alive?
|
|
630
|
+
item = LVITEM[LVIF_TEXT, @index, idx]
|
|
631
|
+
item.pszText = TCHAR[MaxText]
|
|
632
|
+
item.cchTextMax = MaxText
|
|
633
|
+
@owner.SendMessage(LVM_GETITEMTEXT, @index, item)
|
|
634
|
+
item.pszText
|
|
635
|
+
else
|
|
636
|
+
@owner._items[@index][0].split("\t")[idx]
|
|
637
|
+
end
|
|
638
|
+
end
|
|
639
|
+
def []=(idx, txt)
|
|
640
|
+
if @owner.alive?
|
|
641
|
+
item = LVITEM[LVIF_TEXT, @index, idx]
|
|
642
|
+
item.pszText = txt
|
|
643
|
+
item.cchTextMax = txt.size
|
|
644
|
+
@owner.SendMessage(LVM_SETITEMTEXT, @index, item)
|
|
645
|
+
else
|
|
646
|
+
ar = @owner._items[@index][0].split("\t")
|
|
647
|
+
ar[idx] = txt
|
|
648
|
+
@owner._items[@index][0] = ar.join("\t")
|
|
649
|
+
end
|
|
650
|
+
end
|
|
651
|
+
|
|
652
|
+
def text() self[0]; end
|
|
653
|
+
def text=(txt) self[0] = txt; end
|
|
654
|
+
|
|
655
|
+
def image()
|
|
656
|
+
item = LVITEM[LVIF_IMAGE, @index]
|
|
657
|
+
@owner.SendMessage(LVM_GETITEM, 0, item)
|
|
658
|
+
item.iImage
|
|
659
|
+
end
|
|
660
|
+
def image=(idx)
|
|
661
|
+
item = LVITEM[LVIF_IMAGE, @index]
|
|
662
|
+
item.iImage = idx
|
|
663
|
+
@owner.SendMessage(LVM_SETITEM, 0, item)
|
|
664
|
+
end
|
|
665
|
+
|
|
666
|
+
def indent()
|
|
667
|
+
item = LVITEM[LVIF_STD, @index]
|
|
668
|
+
@owner.SendMessage(LVM_GETITEM, 0, item)
|
|
669
|
+
item.iIndent
|
|
670
|
+
end
|
|
671
|
+
def indent=(idt)
|
|
672
|
+
item = LVITEM[LVIF_INDENT, @index]
|
|
673
|
+
item.iIndent = idt
|
|
674
|
+
@owner.SendMessage(LVM_SETITEM, 0, item)
|
|
675
|
+
end
|
|
676
|
+
|
|
677
|
+
def data
|
|
678
|
+
item = LVITEM[LVIF_PARAM, @index]
|
|
679
|
+
@owner.SendMessage(LVM_GETITEM, 0, item)
|
|
680
|
+
ObjectSpace._id2ref(item.lParam)
|
|
681
|
+
end
|
|
682
|
+
def data=(data)
|
|
683
|
+
item = LVITEM[LVIF_PARAM, @index]
|
|
684
|
+
item.lParam = data.__id__
|
|
685
|
+
@owner.SendMessage(LVM_SETITEM, 0, item)
|
|
686
|
+
end
|
|
687
|
+
|
|
688
|
+
def getstate(mask)
|
|
689
|
+
@owner.SendMessage(LVM_GETITEMSTATE, @index, mask)
|
|
690
|
+
end
|
|
691
|
+
def setstate(mask, state)
|
|
692
|
+
item = LVITEM[LVIF_STATE, 0, 0, state, mask]
|
|
693
|
+
@owner.SendMessage(LVM_SETITEMSTATE, @index, item)
|
|
694
|
+
end
|
|
695
|
+
|
|
696
|
+
def focused()
|
|
697
|
+
r = @owner.SendMessage(LVM_GETITEMSTATE, @index, LVIS_FOCUSED)
|
|
698
|
+
r == LVIS_FOCUSED ? true : false
|
|
699
|
+
end
|
|
700
|
+
def focused=(f)
|
|
701
|
+
item = LVITEM[LVIF_STATE, 0, 0, f ? LVIS_FOCUSED : 0, LVIS_FOCUSED]
|
|
702
|
+
@owner.SendMessage(LVM_SETITEMSTATE, @index, item)
|
|
703
|
+
end
|
|
704
|
+
|
|
705
|
+
def selected() (state & LVIS_SELECTED) > 0;
|
|
706
|
+
r = @owner.SendMessage(LVM_GETITEMSTATE, @index, LVIS_SELECTED)
|
|
707
|
+
r == LVIS_SELECTED ? true : false
|
|
708
|
+
end
|
|
709
|
+
def selected=(f)
|
|
710
|
+
item = LVITEM[LVIF_STATE, 0, 0, f ? LVIS_SELECTED : 0, LVIS_SELECTED]
|
|
711
|
+
@owner.SendMessage(LVM_SETITEMSTATE, @index, item)
|
|
712
|
+
end
|
|
713
|
+
|
|
714
|
+
def checked()
|
|
715
|
+
r = @owner.SendMessage(LVM_GETITEMSTATE, @index, LVIS_STATEIMAGEMASK) >> 12
|
|
716
|
+
r == 1 ? false : true
|
|
717
|
+
end
|
|
718
|
+
alias cheched? checked
|
|
719
|
+
def checked=(f)
|
|
720
|
+
item = LVITEM[LVIF_STATE]
|
|
721
|
+
item.state = (f ? 2 : 1) << 12
|
|
722
|
+
item.stateMask = LVIS_STATEIMAGEMASK
|
|
723
|
+
@owner.SendMessage(LVM_SETITEMSTATE, @index, item)
|
|
724
|
+
end
|
|
725
|
+
|
|
726
|
+
def columns()
|
|
727
|
+
item = LVITEM[LVIF_COLUMNS, @index]
|
|
728
|
+
@owner.SendMessage(LVM_GETITEM, 0, item)
|
|
729
|
+
|
|
730
|
+
end
|
|
731
|
+
|
|
732
|
+
def rect()
|
|
733
|
+
rc = RECT.new
|
|
734
|
+
@owner.SendMessage(LVM_GETITEMRECT, @index, rc)
|
|
735
|
+
rc.to_a
|
|
736
|
+
end
|
|
737
|
+
|
|
738
|
+
def delete()
|
|
739
|
+
@owner.delete(@index)
|
|
740
|
+
end
|
|
741
|
+
|
|
742
|
+
def editlabel()
|
|
743
|
+
@owner.editlabel(@index)
|
|
744
|
+
end
|
|
745
|
+
end # Listview::Item
|
|
746
|
+
|
|
747
|
+
#################### Main ####################
|
|
748
|
+
|
|
749
|
+
WinStyles = {
|
|
750
|
+
:iconview => LVS_ICON,
|
|
751
|
+
:reportview => LVS_REPORT,
|
|
752
|
+
:smalliconview => LVS_SMALLICON,
|
|
753
|
+
:listview => LVS_LIST,
|
|
754
|
+
:singlesel => LVS_SINGLESEL,
|
|
755
|
+
:showselalways => LVS_SHOWSELALWAYS,
|
|
756
|
+
:sortascending => LVS_SORTASCENDING,
|
|
757
|
+
:sortdescending => LVS_SORTDESCENDING,
|
|
758
|
+
:shareimagelists => LVS_SHAREIMAGELISTS,
|
|
759
|
+
:nolabelwrap => LVS_NOLABELWRAP,
|
|
760
|
+
:autoarrange => LVS_AUTOARRANGE,
|
|
761
|
+
:editlabels => LVS_EDITLABELS,
|
|
762
|
+
:ownerdata => LVS_OWNERDATA,
|
|
763
|
+
:noscroll => LVS_NOSCROLL,
|
|
764
|
+
:alingtop => LVS_ALIGNTOP,
|
|
765
|
+
:alignleft => LVS_ALIGNLEFT,
|
|
766
|
+
:ownerdrawfixed => LVS_OWNERDRAWFIXED,
|
|
767
|
+
:nocolumnheader => LVS_NOCOLUMNHEADER,
|
|
768
|
+
:nosortheader => LVS_NOSORTHEADER
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
LvsExStyles = {
|
|
772
|
+
:gridlines => LVS_EX_GRIDLINES,
|
|
773
|
+
:subitemimages => LVS_EX_SUBITEMIMAGES,
|
|
774
|
+
:checkboxes => LVS_EX_CHECKBOXES,
|
|
775
|
+
:trackselect => LVS_EX_TRACKSELECT,
|
|
776
|
+
:headerdragdrop => LVS_EX_HEADERDRAGDROP,
|
|
777
|
+
:fullrowselect => LVS_EX_FULLROWSELECT,
|
|
778
|
+
:oneclickactivate => LVS_EX_ONECLICKACTIVATE,
|
|
779
|
+
:twoclickactivate => LVS_EX_TWOCLICKACTIVATE,
|
|
780
|
+
:flatsb => LVS_EX_FLATSB,
|
|
781
|
+
:regional => LVS_EX_REGIONAL,
|
|
782
|
+
:infotip => LVS_EX_INFOTIP,
|
|
783
|
+
:underlinehot => LVS_EX_UNDERLINEHOT,
|
|
784
|
+
:underlinecold => LVS_EX_UNDERLINECOLD,
|
|
785
|
+
:multiworkareas => LVS_EX_MULTIWORKAREAS,
|
|
786
|
+
:labeltip => LVS_EX_LABELTIP,
|
|
787
|
+
:borderselect => LVS_EX_BORDERSELECT,
|
|
788
|
+
:doublebuffer => LVS_EX_DOUBLEBUFFER,
|
|
789
|
+
:hidelabels => LVS_EX_HIDELABELS,
|
|
790
|
+
:singlerow => LVS_EX_SINGLEROW,
|
|
791
|
+
:snaptoglid => LVS_EX_SNAPTOGRID,
|
|
792
|
+
:simpleselect => LVS_EX_SIMPLESELECT,
|
|
793
|
+
:justifycolumns => LVS_EX_JUSTIFYCOLUMNS,
|
|
794
|
+
:transparentbkgnd => LVS_EX_TRANSPARENTBKGND,
|
|
795
|
+
:transparentshadowtext => LVS_EX_TRANSPARENTSHADOWTEXT,
|
|
796
|
+
:autoautoarrange => LVS_EX_AUTOAUTOARRANGE,
|
|
797
|
+
:headerinallivews => LVS_EX_HEADERINALLVIEWS,
|
|
798
|
+
:autocheckselect => LVS_EX_AUTOCHECKSELECT,
|
|
799
|
+
:autosizecolumns => LVS_EX_AUTOSIZECOLUMNS,
|
|
800
|
+
:columnsnappoints => LVS_EX_COLUMNSNAPPOINTS,
|
|
801
|
+
:columnoverflow => LVS_EX_COLUMNOVERFLOW,
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
PreDefinedEvents = {
|
|
805
|
+
:click => [WM_NOTIFY, NM_CLICK, 'xs', NMITEMACTIVATE],
|
|
806
|
+
:dblclk => [WM_NOTIFY, NM_DBLCLK, 'xs', NMITEMACTIVATE],
|
|
807
|
+
:return => [WM_NOTIFY, NM_RETURN, 'xs', NMHDR],
|
|
808
|
+
:rclick => [WM_NOTIFY, NM_RCLICK, 'xs', NMITEMACTIVATE],
|
|
809
|
+
:rdblclk => [WM_NOTIFY, NM_RDBLCLK, 'xs', NMITEMACTIVATE],
|
|
810
|
+
:setfocus => [WM_NOTIFY, NM_SETFOCUS, 'xs', NMHDR],
|
|
811
|
+
:killfocus => [WM_NOTIFY, NM_KILLFOCUS, 'xs', NMHDR],
|
|
812
|
+
:customdraw => [WM_NOTIFY, NM_CUSTOMDRAW, 'xs', NMLVCUSTOMDRAW],
|
|
813
|
+
:hover => [WM_NOTIFY, NM_HOVER, 'xs', NMHDR],
|
|
814
|
+
:releasedcapture => [WM_NOTIFY, NM_RELEASEDCAPTURE, 'xs', NMHDR],
|
|
815
|
+
:keydown => [WM_NOTIFY, LVN_KEYDOWN, 'xs', LVKEYDOWN],
|
|
816
|
+
:itemactivate => [WM_NOTIFY, LVN_ITEMACTIVATE, 'xs', NMITEMACTIVATE],
|
|
817
|
+
:itemchanging => [WM_NOTIFY, LVN_ITEMCHANGING, 'xs', NMLISTVIEW],
|
|
818
|
+
:itemchanged => [WM_NOTIFY, LVN_ITEMCHANGED, 'xs', NMLISTVIEW],
|
|
819
|
+
:insertitem => [WM_NOTIFY, LVN_INSERTITEM, 'xs', NMLISTVIEW],
|
|
820
|
+
:deleteitem => [WM_NOTIFY, LVN_DELETEITEM, 'xs', NMLISTVIEW],
|
|
821
|
+
:columnclick => [WM_NOTIFY, LVN_COLUMNCLICK, 'xs', NMLISTVIEW],
|
|
822
|
+
:begindrag => [WM_NOTIFY, LVN_BEGINDRAG, 'xs', NMLISTVIEW],
|
|
823
|
+
:beginrdrag => [WM_NOTIFY, LVN_BEGINRDRAG, 'xs', NMLISTVIEW],
|
|
824
|
+
:beginlabeledit => [WM_NOTIFY, LVN_BEGINLABELEDIT, 'xs', NMLVDISPINFO],
|
|
825
|
+
:endlabeledit => [WM_NOTIFY, LVN_ENDLABELEDIT, 'xs', NMLVDISPINFO]
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
DefaultEvents = [
|
|
829
|
+
:click, #???_click(NMITEMACTIVATE)
|
|
830
|
+
:itemchanged #???_itemchanged(NMLISTVIEW)
|
|
831
|
+
]
|
|
832
|
+
|
|
833
|
+
attr_reader :_items
|
|
834
|
+
|
|
835
|
+
def initialize(*args)
|
|
836
|
+
@_extendedstyle = 0
|
|
837
|
+
@_columns = Columns.new(self)
|
|
838
|
+
super(*args)
|
|
839
|
+
@_classname = "SysListView32"
|
|
840
|
+
self.exstyle = WS_EX_CLIENTEDGE
|
|
841
|
+
@_acceptable_events = PreDefinedEvents.dup
|
|
842
|
+
@lvhit = LVHITTEST[POINT[*self.clientpos]]
|
|
843
|
+
@_items = []
|
|
844
|
+
@_ar_data = []
|
|
845
|
+
@_lvitem4delete = LVITEM[LVIF_PARAM] # for delete method
|
|
846
|
+
end
|
|
847
|
+
|
|
848
|
+
#
|
|
849
|
+
def create()
|
|
850
|
+
if @_parent.event_registered?(idcmd, WM_NOTIFY, LVN_DELETEITEM, "__deleteitem__", self)
|
|
851
|
+
@_parent.register_event(self.idcmd, WM_NOTIFY, LVN_DELETEITEM, "__deleteitem__", 'xs',
|
|
852
|
+
NMLISTVIEW, self) # for internal use
|
|
853
|
+
end
|
|
854
|
+
super
|
|
855
|
+
self.extendedstyle = @_extendedstyle if @_extendedstyle && @_extendedstyle > 0
|
|
856
|
+
self.imagelist = @_imagelist if @_imagelist
|
|
857
|
+
self.normalimagelist = @_normalimagelist if @_normalimagelist
|
|
858
|
+
self.smallimagelist = @_smallimagelist if @_smallimagelist
|
|
859
|
+
self.stateimagelist = @_stateimagelist if @_stateimagelist
|
|
860
|
+
self.groupheaderimagelist = @_groupheaderimagelist if @_groupheaderimagelist
|
|
861
|
+
self.bkcolor = @_bkcolor if @_bkcolor
|
|
862
|
+
self.textcolor = @_textcolor if @_textcolor
|
|
863
|
+
self.textbkcolor = @_textbkcolor if @_textbkcolor
|
|
864
|
+
self.tooltip = @_tooltip if @_tooltip
|
|
865
|
+
@_columns.__send__(:_create_substance) if @_columns
|
|
866
|
+
_create_substance if @_items
|
|
867
|
+
@_extendedstyle = @_normalimagelist = @_smallimagelist = @_stateimagelist =
|
|
868
|
+
@_groupheaderimagelist = @_bkcolor = @_textcolor = @_tooltip = @_items = nil
|
|
869
|
+
end
|
|
870
|
+
|
|
871
|
+
# def close()
|
|
872
|
+
# parent.unregister_event(self.idcmd, WM_NOTIFY, LVN_DELETEITEM, "__deleteitem__", self)
|
|
873
|
+
# super
|
|
874
|
+
# end
|
|
875
|
+
|
|
876
|
+
# Gets the columns of a listview.
|
|
877
|
+
# Returns a instance of Listview::Columns.
|
|
878
|
+
def columns()
|
|
879
|
+
@_columns
|
|
880
|
+
end
|
|
881
|
+
|
|
882
|
+
# Sets the collumns of header of a Listview
|
|
883
|
+
def columns=(args)
|
|
884
|
+
return @_columns.clear if args.nil? || args.empty?
|
|
885
|
+
args = [args] unless args.is_a?(Array)
|
|
886
|
+
@_columns[0, @_columns.size] = args
|
|
887
|
+
end
|
|
888
|
+
|
|
889
|
+
# Inserts an item into the Listview.
|
|
890
|
+
# This is low level method, so shuld be used `[]=' or `insert'.
|
|
891
|
+
def insert_item(idx, lvitem, arg)
|
|
892
|
+
if alive?
|
|
893
|
+
lvitem.mask = LVIF_STD
|
|
894
|
+
lvitem.iItem = idx
|
|
895
|
+
lvitem.iSubItem = 0
|
|
896
|
+
txt, image, indent, data = arg
|
|
897
|
+
txts = txt.to_s.split("\t")
|
|
898
|
+
lvitem.pszText = t = txts.shift.to_s
|
|
899
|
+
lvitem.cchTextMax = t.size + 1
|
|
900
|
+
lvitem.iImage = image.nil? ? -1 : image.to_i
|
|
901
|
+
lparam = data.__id__
|
|
902
|
+
@_ar_data << data if (lparam&1)==0 && lparam>NilID
|
|
903
|
+
lvitem.lParam = lparam #; dp "@%p", lvitem.to_a
|
|
904
|
+
lvitem.iIndent = indent.to_i
|
|
905
|
+
SendMessage(LVM_INSERTITEM, 0, lvitem)
|
|
906
|
+
# set subitems
|
|
907
|
+
lvitem.mask = LVIF_TEXT
|
|
908
|
+
txts.each_with_index{|itxt, i|
|
|
909
|
+
lvitem.iSubItem = i+1
|
|
910
|
+
lvitem.pszText = itxt.to_s
|
|
911
|
+
lvitem.cchTextMax = itxt.size
|
|
912
|
+
SendMessage(LVM_SETITEMTEXT, idx, lvitem)
|
|
913
|
+
}
|
|
914
|
+
else
|
|
915
|
+
@_items.insert(idx, arg)
|
|
916
|
+
end
|
|
917
|
+
end
|
|
918
|
+
|
|
919
|
+
# insert(index, length=1, *args)
|
|
920
|
+
# Inserts and replaces at the specified <i>index</i> and <i>length</i> by the <i>items</i>.<br>
|
|
921
|
+
# Give the arrays of [[<i>text</i>, <i>image</i>, <i>indent</i>, <i>data</i>], ... ] as <i>args</i>.
|
|
922
|
+
def insert(idx, *args)
|
|
923
|
+
idx = self.count if idx == -1
|
|
924
|
+
case args.size
|
|
925
|
+
when 2
|
|
926
|
+
len = args.shift
|
|
927
|
+
when 1
|
|
928
|
+
len = 1
|
|
929
|
+
else #; dpp idx, len, args
|
|
930
|
+
raise ArgumentError, "Illegal num of args: #{args.size + 1}"
|
|
931
|
+
end
|
|
932
|
+
len.times{delete_item(idx)}
|
|
933
|
+
args = args[0] #;dpp args
|
|
934
|
+
if args.is_a?(String)
|
|
935
|
+
insert_item(idx, LVITEM.new, args)
|
|
936
|
+
elsif args[0].is_a?(String) && !args[1].is_a?(String)
|
|
937
|
+
insert_item(idx, LVITEM.new, args)
|
|
938
|
+
else
|
|
939
|
+
args.each_with_index{|arg, i| insert_item(idx + i, LVITEM.new, arg)}
|
|
940
|
+
end
|
|
941
|
+
end
|
|
942
|
+
alias []= insert
|
|
943
|
+
|
|
944
|
+
# Gets an image-list item specified index.
|
|
945
|
+
def fetch(idx)
|
|
946
|
+
Listview::Item.new(self, idx)
|
|
947
|
+
end
|
|
948
|
+
|
|
949
|
+
# Retreives the array of Listview::Item at the specified index and length.
|
|
950
|
+
def slice(idx, num=1)
|
|
951
|
+
if num == 1
|
|
952
|
+
fetch(idx)
|
|
953
|
+
else
|
|
954
|
+
ret = []
|
|
955
|
+
num.times{|i| ret << fetch(idx + i)}
|
|
956
|
+
ret
|
|
957
|
+
end
|
|
958
|
+
end
|
|
959
|
+
alias [] slice
|
|
960
|
+
|
|
961
|
+
# Deletes item of specified <i>index</i> from this control.
|
|
962
|
+
def delete_item(index)
|
|
963
|
+
alive? ? SendMessage(LVM_DELETEITEM, index, 0) : @_items.delete_at(index)
|
|
964
|
+
end
|
|
965
|
+
|
|
966
|
+
# delete(index=nil, number=1)
|
|
967
|
+
# Deletes items at specified <i>index</i> and <i>number</i> from this control.<br>
|
|
968
|
+
# If no arguments given, deletes self.
|
|
969
|
+
def delete(*args)
|
|
970
|
+
return super() if args.empty?
|
|
971
|
+
index, len = args
|
|
972
|
+
len ||= 1
|
|
973
|
+
len.times{ delete_item(index) }
|
|
974
|
+
end
|
|
975
|
+
|
|
976
|
+
# Retreives count of items.
|
|
977
|
+
def count()
|
|
978
|
+
alive? ? SendMessage(LVM_GETITEMCOUNT, 0, 0) : @_items.size
|
|
979
|
+
end
|
|
980
|
+
|
|
981
|
+
# Adds the args at last of the items.<br>
|
|
982
|
+
# Give a String or a Array of [String, Object] as args.
|
|
983
|
+
def <<(arg)
|
|
984
|
+
self[count, 0] = arg
|
|
985
|
+
end
|
|
986
|
+
|
|
987
|
+
# each(){|item| ... }
|
|
988
|
+
# Performs the block for each <i>item</i> in this listview as a block parameter.
|
|
989
|
+
def each()
|
|
990
|
+
count.times{|i| yield self.fetch(i)} if block_given?
|
|
991
|
+
end
|
|
992
|
+
|
|
993
|
+
#######################################################################
|
|
994
|
+
|
|
995
|
+
# Gets a normal and a small imagelist assigned to this Listview control.
|
|
996
|
+
def imagelist()
|
|
997
|
+
if alive?
|
|
998
|
+
[APP.hrsc2ref(SendMessage(LVM_GETIMAGELIST, LVSIL_NORMAL, 0))||nil,
|
|
999
|
+
APP.hrsc2ref(SendMessage(LVM_GETIMAGELIST, LVSIL_SMALL, 0))||nil]
|
|
1000
|
+
else
|
|
1001
|
+
@_imagelist
|
|
1002
|
+
end
|
|
1003
|
+
end
|
|
1004
|
+
|
|
1005
|
+
# imagelist=([normaliamge,] smallimage)
|
|
1006
|
+
# Assignes a normal and a small imagelist to this Listview control.
|
|
1007
|
+
def imagelist=(*args) #([normaliamge,] smallimage)
|
|
1008
|
+
args = args[0] if args[0].is_a?(Array)#; dpp args
|
|
1009
|
+
if alive?
|
|
1010
|
+
im1, im2 = args
|
|
1011
|
+
im1 = Imagelist.loadb64(im1) if im1.is_a?(String)
|
|
1012
|
+
im2 = Imagelist.loadb64(im2) if im2.is_a?(String)
|
|
1013
|
+
if im1.iconsize[0]==32
|
|
1014
|
+
SendMessage(LVM_SETIMAGELIST, LVSIL_NORMAL, im1 ? im1._himagelist : 0)
|
|
1015
|
+
SendMessage(LVM_SETIMAGELIST, LVSIL_SMALL, im2 ? im2._himagelist : 0) if im2
|
|
1016
|
+
else
|
|
1017
|
+
SendMessage(LVM_SETIMAGELIST, LVSIL_SMALL, im1 ? im1._himagelist : 0)
|
|
1018
|
+
end
|
|
1019
|
+
else
|
|
1020
|
+
@_imagelist = args
|
|
1021
|
+
end
|
|
1022
|
+
end
|
|
1023
|
+
|
|
1024
|
+
# Gets a normal imagelist assigned to this control.
|
|
1025
|
+
def normalimagelist()
|
|
1026
|
+
alive? ? APP.hrsc2ref(SendMessage(LVM_GETIMAGELIST, LVSIL_NORMAL, 0)) || nil : @_nomalimagelist
|
|
1027
|
+
end
|
|
1028
|
+
# Assignes a normal imagelist to this control.
|
|
1029
|
+
def normalimagelist=(il) # dp "@%p", arg
|
|
1030
|
+
il = Imagelist.loadb64(il) if il.is_a?(String)
|
|
1031
|
+
alive? ? SendMessage(LVM_SETIMAGELIST, LVSIL_NORMAL, il ? il._himagelist : 0) :
|
|
1032
|
+
@_normalimagelist = il
|
|
1033
|
+
end
|
|
1034
|
+
|
|
1035
|
+
# Gets a small imagelist assigned to this control.
|
|
1036
|
+
def smallimagelist()
|
|
1037
|
+
alive? ? APP.hrsc2ref(SendMessage(LVM_GETIMAGELIST, LVSIL_SMALL, 0)) || nil :
|
|
1038
|
+
@_smallimagelist
|
|
1039
|
+
end
|
|
1040
|
+
# Assignes a small imagelist to this control.
|
|
1041
|
+
def smallimagelist=(il) # dp "@%p", arg
|
|
1042
|
+
il = Imagelist.loadb64(il) if il.is_a?(String)
|
|
1043
|
+
alive? ? SendMessage(LVM_SETIMAGELIST, LVSIL_SMALL, il ? il._himagelist : 0) :
|
|
1044
|
+
@_smallimagelist = il
|
|
1045
|
+
end
|
|
1046
|
+
|
|
1047
|
+
# Gets a state imagelist assigned to this control.
|
|
1048
|
+
def stateimagelist()
|
|
1049
|
+
alive? ? APP.hrsc2ref(SendMessage(LVM_GETIMAGELIST, LVSIL_STSATE, 0)) || nil :
|
|
1050
|
+
@_stateimagelist
|
|
1051
|
+
end
|
|
1052
|
+
# Assignes a state imagelist to this control.
|
|
1053
|
+
def stateimagelist=(il) # dp "@%p", arg
|
|
1054
|
+
il = Imagelist.loadb64(il) if il.is_a?(String)
|
|
1055
|
+
alive? ? SendMessage(LVM_SETIMAGELIST, LVSIL_STATE, il ? il._himagelist : 0) :
|
|
1056
|
+
@_stateimagelist = il
|
|
1057
|
+
end
|
|
1058
|
+
|
|
1059
|
+
# Gets a group-header imagelist assigned to this control.
|
|
1060
|
+
def groupheaderimagelist()
|
|
1061
|
+
alive? ? APP.hrsc2ref(SendMessage(LVM_GETIMAGELIST, LVSIL_GROUPHEADER, 0)) || nil :
|
|
1062
|
+
@_groupheaderimagelist
|
|
1063
|
+
end
|
|
1064
|
+
# Assignes a group-header imagelist to this control.
|
|
1065
|
+
def groupheaderimagelist=(il)
|
|
1066
|
+
il = Imagelist.loadb64(il) if il.is_a?(String)
|
|
1067
|
+
alive? ? SendMessage(LVM_SETIMAGELIST, LVSIL_GROUPHEADER, il ? il._himagelist : 0) :
|
|
1068
|
+
@_groupheaderimagelist = il
|
|
1069
|
+
end
|
|
1070
|
+
|
|
1071
|
+
# Gets the background color of this control.
|
|
1072
|
+
def bkcolor()
|
|
1073
|
+
alive? ? SendMessage(LVM_GETBKCOLOR, 0, 0) & 0xffffff : @_bkcolor
|
|
1074
|
+
end
|
|
1075
|
+
# Sets the background color of this control.
|
|
1076
|
+
def bkcolor=(clr)
|
|
1077
|
+
alive? ? SendMessage(LVM_SETBKCOLOR, 0, clr) : @_bkcolor = clr
|
|
1078
|
+
end
|
|
1079
|
+
|
|
1080
|
+
# set/getbkimage is not work well...
|
|
1081
|
+
# # Gets the background image in this control.
|
|
1082
|
+
# def getbkimage()
|
|
1083
|
+
# bkimg = LVBKIMAGEA.new
|
|
1084
|
+
# SendMessage(LVM_GETBKIMAGE, 0, bkimg)
|
|
1085
|
+
# bkimg
|
|
1086
|
+
# end
|
|
1087
|
+
#
|
|
1088
|
+
# # Sets the background image in this control by specified aruments.
|
|
1089
|
+
# def setbkimage(image, x=50, y=50, tile=nil)
|
|
1090
|
+
# bkimg = LVBKIMAGE.new
|
|
1091
|
+
# if image.is_a?(RWin::Bitmap); dpp image
|
|
1092
|
+
# @image = image
|
|
1093
|
+
# bkimg.ulFlags = LVBKIF_SOURCE_HBITMAP
|
|
1094
|
+
# bkimg.hbm = @image._hddbitmap()
|
|
1095
|
+
# elsif image.is_a?(String)
|
|
1096
|
+
# if image=~/^\w+:\/\//
|
|
1097
|
+
# bkimg.ulFlags = LVBKIF_SOURCE_URL
|
|
1098
|
+
# bkimg.pszImage = image
|
|
1099
|
+
# bkimg.cchImageMax = image.size
|
|
1100
|
+
# else
|
|
1101
|
+
# image = Bitmap.loadb64(image)
|
|
1102
|
+
# bkimg.ulFlags = LVBKIF_SOURCE_HBITMAP
|
|
1103
|
+
# bkimg.hbm = image._hddbitmap
|
|
1104
|
+
# end
|
|
1105
|
+
# else
|
|
1106
|
+
# raise TypeError, "image is neither Bitmap nor String."
|
|
1107
|
+
# end
|
|
1108
|
+
# bkimg.ulFlags |= LVBKIF_STYLE_TILE if tile
|
|
1109
|
+
# bkimg.xOffsetPercent = x
|
|
1110
|
+
# bkimg.yOffsetPercent = y
|
|
1111
|
+
# SendMessage(LVM_SETBKIMAGE, 0, bkimg)
|
|
1112
|
+
# end
|
|
1113
|
+
|
|
1114
|
+
# Gets the text color of this list-view control.
|
|
1115
|
+
def textcolor()
|
|
1116
|
+
alive? ? SendMessage(LVM_GETTEXTCOLOR, 0, 0) & 0xffffff : @_textcolor
|
|
1117
|
+
end
|
|
1118
|
+
# Sets the text color of a list-view control.
|
|
1119
|
+
def textcolor=(clr)
|
|
1120
|
+
alive? ? SendMessage(LVM_SETTEXTCOLOR, 0, clr) : @_textcolor = clr
|
|
1121
|
+
end
|
|
1122
|
+
|
|
1123
|
+
# Gets the text background color of this list-view control.
|
|
1124
|
+
def textbkcolor()
|
|
1125
|
+
alive? ? SendMessage(LVM_GETTEXTBKCOLOR, 0, 0) & 0xffffff : @_textbkcolor
|
|
1126
|
+
end
|
|
1127
|
+
# Sets the background color of text in this list-view control.
|
|
1128
|
+
def textbkcolor=(clr)
|
|
1129
|
+
alive? ? SendMessage(LVM_SETTEXTBKCOLOR, 0, clr) : @_textbkcolor = clr
|
|
1130
|
+
end
|
|
1131
|
+
|
|
1132
|
+
# Retrieves the tooltip control that the list-view control uses to display tooltips.
|
|
1133
|
+
def tooltip()
|
|
1134
|
+
alive? ? APP.hwnd2ref(SendMessage(LVM_GETTOOLTIPS, 0, 0)) || nil : @_tooltip
|
|
1135
|
+
end
|
|
1136
|
+
# Sets the tooltip control that the list-view control will use to display tooltips.
|
|
1137
|
+
def tooltip=(tt)
|
|
1138
|
+
alive? ? SendMessage(LVM_SETTOOLTIPS, 0, tt ? tt.hWnd : 0) : @_tooltip = tt
|
|
1139
|
+
end
|
|
1140
|
+
|
|
1141
|
+
#### styles ####
|
|
1142
|
+
|
|
1143
|
+
# Gets whether selection is shown always, if any.
|
|
1144
|
+
def showselalways() (self.style & LVS_SHOWSELALWAYS) > 0; end
|
|
1145
|
+
# The selection, if any, is always shown, even if the control does not have the focus.
|
|
1146
|
+
def showselalways=(f) f ?
|
|
1147
|
+
self.style |= LVS_SHOWSELALWAYS : self.style &= ~LVS_SHOWSELALWAYS
|
|
1148
|
+
end
|
|
1149
|
+
|
|
1150
|
+
# Gets wheter the multiple items may be selected.
|
|
1151
|
+
def multiselect() (self.style & LVS_SIGLESEL) == 0; end
|
|
1152
|
+
# Sets wheter the multiple items may be selected. By default, multiple items may be selected.
|
|
1153
|
+
def multiselect=(f) f ? self.style &= ~LVS_SINGLESEL : self.style |= LVS_SINGLESEL; end
|
|
1154
|
+
|
|
1155
|
+
#### extended styles (not exstyle) ####
|
|
1156
|
+
|
|
1157
|
+
# Gets the extended styles that are currently in use for this list-view control.
|
|
1158
|
+
def get_extendedstyle(xstyle)
|
|
1159
|
+
alive? ? SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE, 0, xstyle)>0 || nil : @_extendedstyle
|
|
1160
|
+
end
|
|
1161
|
+
|
|
1162
|
+
# Sets extended styles in this list-view control.
|
|
1163
|
+
def set_extendedstyle(xstyle, f=true)
|
|
1164
|
+
if alive?
|
|
1165
|
+
SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE,xstyle,f ? xstyle : 0)
|
|
1166
|
+
else
|
|
1167
|
+
f ? @_extendedstyle |= xstyle : @_extendedstyle &= ~xstyle
|
|
1168
|
+
end
|
|
1169
|
+
end
|
|
1170
|
+
alias extendedstyle= set_extendedstyle
|
|
1171
|
+
|
|
1172
|
+
# Retreives whether displays gridlines around items and subitems.
|
|
1173
|
+
def gridlines() get_extendedstyle(LVS_EX_GRIDLINES); end
|
|
1174
|
+
# Sets whether displays gridlines around items and subitems.
|
|
1175
|
+
def gridlines=(f) set_extendedstyle(LVS_EX_GRIDLINES, f); end
|
|
1176
|
+
|
|
1177
|
+
# Retreives whether check boxes for items is enabled in this list-view control.
|
|
1178
|
+
def checkboxes() get_extendedstyle(LVS_EX_CHECKBOXES); end
|
|
1179
|
+
# Sets whether check boxes for items is enabled in this list-view control.
|
|
1180
|
+
def checkboxes=(f) set_extendedstyle(LVS_EX_CHECKBOXES, f); end
|
|
1181
|
+
|
|
1182
|
+
# Retreives whether hot-track selection is enabled in this list-view control.
|
|
1183
|
+
def trackselect() get_extendedstyle(LVS_EX_TRACKSELECT); end
|
|
1184
|
+
# Sets whether hot-track selection is enabled in this list-view control.
|
|
1185
|
+
def trackselect=(f) set_extendedstyle(LVS_EX_TRACKSELECT, f); end
|
|
1186
|
+
|
|
1187
|
+
# Retreives whether drag-and-drop reordering of columns is enabled in this list-view control.
|
|
1188
|
+
def headerdragdrop() get_extendedstyle(LVS_EX_HEADERDRAGDROP); end
|
|
1189
|
+
# Sets whether drag-and-drop reordering of columns is enabled in this list-view control.
|
|
1190
|
+
def headerdragdrop=(f) get_extendedstyle(LVS_EX_HEADERDRAGDROP, f); end
|
|
1191
|
+
|
|
1192
|
+
# Retreives whether full-row selection is enabled in this list-view control.
|
|
1193
|
+
def fullrowselect() get_extendedstyle(LVS_EX_FULLROWSELECT); end
|
|
1194
|
+
# Sets whether full-row selection is enabled in this list-view control.
|
|
1195
|
+
def fullrowselect=(f) set_extendedstyle(LVS_EX_FULLROWSELECT, f); end
|
|
1196
|
+
|
|
1197
|
+
ViewModes = {
|
|
1198
|
+
:iconview => LVS_ICON,
|
|
1199
|
+
:reportview => LVS_REPORT,
|
|
1200
|
+
:smalliconview => LVS_SMALLICON,
|
|
1201
|
+
:listview => LVS_LIST
|
|
1202
|
+
}
|
|
1203
|
+
# Gets a view-mode of this list-vew control.
|
|
1204
|
+
def viewmode() self.style & LVS_TYPEMASK; end
|
|
1205
|
+
# Converts a integer value of view-mode to symbol.
|
|
1206
|
+
def viewmode_to_sym() ViewModes.key(self.style & LVS_TYPEMASK); end
|
|
1207
|
+
# Sets a view-mode of this lis-view control. You can use following symbols instead of integer value.<br>
|
|
1208
|
+
# :reportview, :iconview, :smalliconview, :listview
|
|
1209
|
+
def viewmode=(mode)
|
|
1210
|
+
mode = ViewModes[mode] if mode.is_a?(Symbol)
|
|
1211
|
+
self.style = (self.style & ~LVS_TYPEMASK) | mode
|
|
1212
|
+
end
|
|
1213
|
+
|
|
1214
|
+
# Retreives the list of selected items in this list-view control.
|
|
1215
|
+
def selections()
|
|
1216
|
+
ret = []
|
|
1217
|
+
def ret.clear()
|
|
1218
|
+
self.each{|j| j.selected = false}
|
|
1219
|
+
super
|
|
1220
|
+
end
|
|
1221
|
+
i = -1
|
|
1222
|
+
while (i=SendMessage(LVM_GETNEXTITEM, i, LVNI_SELECTED)) > -1
|
|
1223
|
+
ret << Item.new(self, i)
|
|
1224
|
+
end
|
|
1225
|
+
ret
|
|
1226
|
+
end
|
|
1227
|
+
|
|
1228
|
+
# Gets the last of item in this list-view control.
|
|
1229
|
+
def last()
|
|
1230
|
+
self[count-1]
|
|
1231
|
+
end
|
|
1232
|
+
|
|
1233
|
+
# Clears all items in this list-view control.
|
|
1234
|
+
def clear()
|
|
1235
|
+
alive? ? SendMessage(LVM_DELETEALLITEM, 0, 0) : items.clear()
|
|
1236
|
+
self
|
|
1237
|
+
end
|
|
1238
|
+
|
|
1239
|
+
# Ensures that specified list-view item is either entirely or partially visible, scrolling the list-view control if necessary.
|
|
1240
|
+
def ensurevisible(i, partial=true)
|
|
1241
|
+
SendMessage(LVM_ENSUREVISIBLE, i.to_i, partial ? 1 : 0)
|
|
1242
|
+
end
|
|
1243
|
+
|
|
1244
|
+
# Determines which list-view item, if any, is at a specified position.
|
|
1245
|
+
def hittest(x, y)
|
|
1246
|
+
@lvhit.pt.x = x
|
|
1247
|
+
@lvhit.pt.y = y
|
|
1248
|
+
SendMessage(LVM_SUBITEMHITTEST, 0, @lvhit)
|
|
1249
|
+
[@lvhit.iItem, @lvhit.iSubItem, @lvhit.flags]
|
|
1250
|
+
end
|
|
1251
|
+
|
|
1252
|
+
#Determines the width of a specified string using this list-view control's current font.
|
|
1253
|
+
def stringwidth(txt)
|
|
1254
|
+
SendMessage(LVM_GETSTRINGWIDTH, 0, txt)
|
|
1255
|
+
end
|
|
1256
|
+
|
|
1257
|
+
# Searches for a list-view item that has the specified properties and bears the specified relationship to a specified item.
|
|
1258
|
+
def getnextitem(start, flag)
|
|
1259
|
+
SendMessage(LVM_GETNEXTITEM, start, flag)
|
|
1260
|
+
end
|
|
1261
|
+
|
|
1262
|
+
# Searches the index of focused item.
|
|
1263
|
+
def focused()
|
|
1264
|
+
getnextitem(-1, LVNI_FOCUSED)
|
|
1265
|
+
end
|
|
1266
|
+
|
|
1267
|
+
# Sets the specified item to focused.
|
|
1268
|
+
def focused=(idx)
|
|
1269
|
+
if idx && idx > 0
|
|
1270
|
+
self[idx].focused = true
|
|
1271
|
+
else
|
|
1272
|
+
self[focused].focused = nil
|
|
1273
|
+
end
|
|
1274
|
+
end
|
|
1275
|
+
|
|
1276
|
+
# Searches for a list-view item with the specified characteristics.
|
|
1277
|
+
def find(start=-1, param: nil, string: nil, substring: nil, wrap: nil, nearestxy: nil, direction: nil)
|
|
1278
|
+
lvfi = LVFINDINFO.new
|
|
1279
|
+
if param
|
|
1280
|
+
lvfi.lParam = param.to_i
|
|
1281
|
+
lvfi.flags |= LVFI_PARAM
|
|
1282
|
+
end
|
|
1283
|
+
if string
|
|
1284
|
+
lvfi.psz = string.to_s
|
|
1285
|
+
lvfi.flags |= LVFI_STRING
|
|
1286
|
+
lvfi.flags |= LVFI_WRAP if wrap
|
|
1287
|
+
end
|
|
1288
|
+
if substring
|
|
1289
|
+
lvfi.psz = string.to_s
|
|
1290
|
+
lvfi.flags |= LVFI_PARTIAL
|
|
1291
|
+
lvfi.flags |= LVFI_WRAP if wrap
|
|
1292
|
+
end
|
|
1293
|
+
if nearestxy
|
|
1294
|
+
lvfi.pt.x = nearestxy[0]
|
|
1295
|
+
lvfi.pt.y = nearestxy[1]
|
|
1296
|
+
lvfi.vkDirection = direction.to_i if direction
|
|
1297
|
+
lvfi.flags |= LVFI_NEARESTXY
|
|
1298
|
+
end
|
|
1299
|
+
SendMessage(LVM_FINDITEM, start, lvfi)
|
|
1300
|
+
end
|
|
1301
|
+
|
|
1302
|
+
# Begins in-place editing of the specified list-view item's text.
|
|
1303
|
+
def editlabel(idx)
|
|
1304
|
+
SendMessage(LVM_EDITLABEL, idx.to_i, 0)
|
|
1305
|
+
end
|
|
1306
|
+
|
|
1307
|
+
protected
|
|
1308
|
+
def _apply_options(arg)
|
|
1309
|
+
if st = WinStyles[arg]
|
|
1310
|
+
self.style |= st
|
|
1311
|
+
return nil
|
|
1312
|
+
elsif es = LvsExStyles[arg]
|
|
1313
|
+
@_extendedstyle |= es
|
|
1314
|
+
return nil
|
|
1315
|
+
end
|
|
1316
|
+
super
|
|
1317
|
+
end
|
|
1318
|
+
|
|
1319
|
+
private
|
|
1320
|
+
def _create_substance() #; dp "@%p", @_items
|
|
1321
|
+
Mutex.new.synchronize{
|
|
1322
|
+
lvitem = LVITEM.new
|
|
1323
|
+
@_items.each_with_index{|val, idx| insert_item(idx, lvitem, val)}
|
|
1324
|
+
}
|
|
1325
|
+
end
|
|
1326
|
+
|
|
1327
|
+
def __deleteitem__(nmlistview)
|
|
1328
|
+
return unless @_ar_data # recycled?
|
|
1329
|
+
lparam = nmlistview.lParam #; dpp lparam
|
|
1330
|
+
if (lparam&1)==0 && lparam>NilID
|
|
1331
|
+
data = (ObjectSpace._id2ref(lparam) rescue nil) #; dp "@data=%p", data
|
|
1332
|
+
if data && (n = @_ar_data.index(data))
|
|
1333
|
+
@_ar_data.delete_at(n)
|
|
1334
|
+
end
|
|
1335
|
+
end
|
|
1336
|
+
end
|
|
1337
|
+
end
|
|
1338
|
+
end
|
|
1339
|
+
|
|
1340
|
+
module WR
|
|
1341
|
+
class Form1 < Form
|
|
1342
|
+
def initialize()
|
|
1343
|
+
self.windowsize = 640, 480
|
|
1344
|
+
_<< Imagelist.loadb64(:image1, "JJMAIBAYAAwAAgACAACAAf7/f7/AsAYoBQkImnYAAAAACAIEAgRRAMAgQEAEEBQADAwCA2QEgQoAAAAAAAABANhAAAAICB6CAQEAc4BoQCwADAYDAACAgEiAH+AAA/4LoP9/wBzgIBALCEAMFH4MfwdfhD/CZ+FX8L34Z/w4fh5/EF+Iv8Sn4nfxTfiv/Fx+MH8ZX40/xufjl/Hd+Pf8gH5CfyJfkb/JJ+S38o4hmMxmMxmMAAAEQiEQiERJkEEQCilEsP1+v1+v4EAwKRHEsEARLWF8SqWHb7fb7fcEAEWg4JQyqABD/RCIR8CB4ICo9cQQUggfBAN9wQUggfCAJHr9cQmThAfBASESEMAoQFw4FR8MgYEBzlwhgOi33D4NFwCEAEMDAQiJ2pgiAQkCAH/DiCdT87tYgBTrRnmfP/KKAMExZ9/gAARgBgf/QZ+hX9D36OAEImj6jskAgaO1gGkgYBo7fSpGl8FI/6UP0s/pi/TX+nT9Pv6aJVRBqbgHwAH3AA4BBA+AQgHgIIA4DCAGBAgAgUJAwUPwEJR7/R7/gkDWaFwAepqFaMHAD4BCB+AgdTpIf5A=")
|
|
1345
|
+
_<< Listview[:listview1, '', 10, 30, 300, 200, :smalliconview,:smallimagelist=>_image1]
|
|
1346
|
+
# _listview1.columns[0, 0] = ['a', 80], ['b', 100, 1]
|
|
1347
|
+
_<< Button[:button1, "Test", 0, 0, 80, 24]
|
|
1348
|
+
end
|
|
1349
|
+
|
|
1350
|
+
def created()
|
|
1351
|
+
# _listview1.columns = 'a', 75, 2, 'b', 100, 2, 'c'
|
|
1352
|
+
_listview1.columns[0, 0] = ["a", 80], ["b", 100, 1]
|
|
1353
|
+
# _listview1.columns[0].format = 2
|
|
1354
|
+
# _listview1.fullrowselect = true
|
|
1355
|
+
dpp Listview::NMLISTVIEW::Offsets
|
|
1356
|
+
|
|
1357
|
+
controls.listview1 << ["text_1\t123\tabc", 1, 1]
|
|
1358
|
+
_listview1[0].data = 1000
|
|
1359
|
+
controls.listview1 << ["text_2\t456\tdef", 2, 2]
|
|
1360
|
+
# dpp _listview1.columns.each{|i| dpp i}
|
|
1361
|
+
# @bmp = Bitmap.fromfile('../../../tests/resources/win32.png')
|
|
1362
|
+
# dpp @bmp.width, @bmp.height, @bmp.depth
|
|
1363
|
+
# dpp _listview1.setbkimage @bmp, 0, 0, true
|
|
1364
|
+
#dpp _listview1.setbkimage "file:///D:/Users/78071071/hg/wrb_sandbox/tests/resources/win32.bmp"
|
|
1365
|
+
end
|
|
1366
|
+
|
|
1367
|
+
def listview1_itemchanged(nmlv)
|
|
1368
|
+
dpp _listview1[nmlv.iItem].data
|
|
1369
|
+
end
|
|
1370
|
+
|
|
1371
|
+
def button1_clicked(*)
|
|
1372
|
+
_listview1.columns.clear
|
|
1373
|
+
_listview1.columns[0, 0] = ["a", 80], ["b", 100, 1]
|
|
1374
|
+
#_listview1.columns.each{|i| dpp i}
|
|
1375
|
+
end
|
|
1376
|
+
|
|
1377
|
+
self.start
|
|
1378
|
+
end
|
|
1379
|
+
|
|
1380
|
+
# class Form1 < Form
|
|
1381
|
+
# def initialize()
|
|
1382
|
+
# self.caption = "Ruby #{RUBY_VERSION}"
|
|
1383
|
+
# resize 640, 480
|
|
1384
|
+
# inheritfont 'Meiryo', -12
|
|
1385
|
+
# _<< Menubar[:main, Menu[:viewmode, "Viewmode", :vmode, "Listview", :vmode, "Iconview", :vmode, "SmallIconview", :vmode, "Reportview"]]
|
|
1386
|
+
# _<< Menu[:popup1, :delete1, "Delete"]
|
|
1387
|
+
# @lv1 = controls << Listview[:listview1, '', 10, 30, 300, 200, :reportview, :gridlines, :fullrowselect, :showselalways , :margin=>[0, 30, 0, 0], :imagelist=>
|
|
1388
|
+
#["JJMAIBAYAAwAAgACAACAAf7/f7/AsAYoBQkImnYAAAAACAIEAgRRAMAgQEAEEBQADAwCA2QEgQoAAAAAAAABANhAAAAICB6CAQEAc4BoQCwADAYDAACAgEiAH+AAA/4LoP9/wBzgIBALCEAMFH4MfwdfhD/CZ+FX8L34Z/w4fh5/EF+Iv8Sn4nfxTfiv/Fx+MH8ZX40/xufjl/Hd+Pf8gH5CfyJfkb/JJ+S38o4hmMxmMxmMAAAEQiEQiERJkEEQCilEsP1+v1+v4EAwKRHEsEARLWF8SqWHb7fb7fcEAEWg4JQyqABD/RCIR8CB4ICo9cQQUggfBAN9wQUggfCAJHr9cQmThAfBASESEMAoQFw4FR8MgYEBzlwhgOi33D4NFwCEAEMDAQiJ2pgiAQkCAH/DiCdT87tYgBTrRnmfP/KKAMExZ9/gAARgBgf/QZ+hX9D36OAEImj6jskAgaO1gGkgYBo7fSpGl8FI/6UP0s/pi/TX+nT9Pv6aJVRBqbgHwAH3AA4BBA+AQgHgIIA4DCAGBAgAgUJAwUPwEJR7/R7/gkDWaFwAepqFaMHAD4BCB+AgdTpIf5A="]]
|
|
1389
|
+
#
|
|
1390
|
+
## controls.listview1.columns << ["aaa", 80]
|
|
1391
|
+
## controls.listview1.columns << ["bbb", 80, :center]
|
|
1392
|
+
#
|
|
1393
|
+
# controls.listview1 << ["text_0", 1, 0, [1]]
|
|
1394
|
+
# controls.listview1 << ["text_1\t123\tabc", 2, 1]
|
|
1395
|
+
# controls.listview1 << ["text_2\t456\tdef", 2, 1, 2]
|
|
1396
|
+
# _<< Button[:btn1, "Send", 0, 0, 80, 24]
|
|
1397
|
+
# _<< Button[:btn2, "Set Columns", 80, 0, 100, 24]
|
|
1398
|
+
# _<< Button[:btn3, "Find", 180, 0, 80, 24]
|
|
1399
|
+
# _<< Button[:btn4, "ClearSel", 260, 0, 80, 24]
|
|
1400
|
+
# @lv1.accept_events :keydown
|
|
1401
|
+
# @lv1.normalimagelist = Imagelist.new(32, 32, true) << Bitmap.fromfile('../resources/fileimg32.bmp')
|
|
1402
|
+
# @lv1.accept_events :rclick
|
|
1403
|
+
# @lv1.columns[0] = ['a', 80, 1], ['b', 100, 1]
|
|
1404
|
+
# end
|
|
1405
|
+
#
|
|
1406
|
+
# def created_()
|
|
1407
|
+
## @lv1.columns = 'a', 'b'
|
|
1408
|
+
# controls.listview1.columns << Listview::Column["ccc", 50, :right]
|
|
1409
|
+
# controls.listview1.columns[2, 0] = ['ddd', 50]
|
|
1410
|
+
## _.listview1.columns[0].image = 1
|
|
1411
|
+
# controls.listview1 << ["text_3\t789\tghi", 2, nil, 1]
|
|
1412
|
+
# controls.listview1.columns[2].delete
|
|
1413
|
+
# @lv1[0,0] = 'aaaa', 'bbbb', 'cccc', 'dddd'
|
|
1414
|
+
# @lv1.insert 0, 0, [['pqw', nil], ['xyz', 2]]
|
|
1415
|
+
# @lv1[-1, 0] = ["cc\txx", 1, 0, [1]], 'mno', 'Tabcde'
|
|
1416
|
+
# dpp @lv1.columns[1].image
|
|
1417
|
+
# end
|
|
1418
|
+
#
|
|
1419
|
+
# def btn1_clicked(*)
|
|
1420
|
+
# @lv1.SetFocus
|
|
1421
|
+
# @lv1.count.times{|i| @lv1[i].selected = false}
|
|
1422
|
+
# @lv1[2].selected = true
|
|
1423
|
+
# @lv1[2].focused = true
|
|
1424
|
+
# end
|
|
1425
|
+
#
|
|
1426
|
+
# def btn2_clicked(*)
|
|
1427
|
+
# @lv1.columns = ['aa'], ['bb', 100, 2]
|
|
1428
|
+
# end
|
|
1429
|
+
# def btn3_clicked(*)
|
|
1430
|
+
# dpp @lv1.find string: "cc"
|
|
1431
|
+
# end
|
|
1432
|
+
#
|
|
1433
|
+
# def btn4_clicked(*)
|
|
1434
|
+
# dpp @lv1.selections
|
|
1435
|
+
# @lv1.selections.clear
|
|
1436
|
+
# end
|
|
1437
|
+
#
|
|
1438
|
+
# def listview1_rclick(nmact)
|
|
1439
|
+
# px, py = *nmact.ptAction
|
|
1440
|
+
# TrackPopupMenu(_.popup1, @lv1.x+px, @lv1.y+py)
|
|
1441
|
+
# end
|
|
1442
|
+
#
|
|
1443
|
+
# def delete1_clicked(*)
|
|
1444
|
+
# @lv1[@lv1.focused].delete
|
|
1445
|
+
# end
|
|
1446
|
+
#
|
|
1447
|
+
# def listview1_itemchanged(nmlistview)
|
|
1448
|
+
# return unless nmlistview.uOldState == 0
|
|
1449
|
+
# dpp @lv1[nmlistview.iItem].data, @lv1[nmlistview.iItem].indent
|
|
1450
|
+
# end
|
|
1451
|
+
#
|
|
1452
|
+
# def vmode_clicked(id, state)
|
|
1453
|
+
# case _.main.viewmode.index(id)
|
|
1454
|
+
# when 0 # Listview
|
|
1455
|
+
# @lv1.viewmode = :listview
|
|
1456
|
+
# when 1 # Iconview
|
|
1457
|
+
# @lv1.viewmode = :iconview
|
|
1458
|
+
# when 2 # SmallIconview
|
|
1459
|
+
# @lv1.viewmode = :smalliconview
|
|
1460
|
+
# when 3 # Reportview
|
|
1461
|
+
# @lv1.viewmode = :reportview
|
|
1462
|
+
# end
|
|
1463
|
+
# end
|
|
1464
|
+
# self.start
|
|
1465
|
+
# end
|
|
1466
|
+
end if $0 == __FILE__
|
|
1467
|
+
|