fzeet 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE_CEF +29 -0
- data/checks/Bstr.rb +14 -0
- data/checks/Decimal.rb +27 -0
- data/checks/OSVERSIONINFOEX.rb +14 -0
- data/checks/Point.rb +65 -0
- data/checks/Rect.rb +104 -0
- data/checks/RunAll.rb +2 -0
- data/checks/SafeArray.rb +27 -0
- data/checks/Size.rb +45 -0
- data/checks/SystemTime.rb +43 -0
- data/checks/Variant.rb +160 -0
- data/examples/Control/DateTimePicker.rbw +1 -1
- data/examples/Control/MonthCalendar.rbw +1 -1
- data/examples/Control/{WebBrowser.rbw → WebBrowser/WebBrowser.rbw} +2 -2
- data/examples/Control/{WebBrowser1.rbw → WebBrowser/WebBrowser1.rbw} +0 -0
- data/examples/Control/WebBrowser/WebBrowser2.rbw +24 -0
- data/examples/Control/{WebBrowser3.rbw → WebBrowser/WebBrowser3.rbw} +0 -0
- data/examples/Control/{WebBrowser4.rbw → WebBrowser/WebBrowser4.rbw} +8 -3
- data/examples/Control/{WebBrowser4Sinatra.rb → WebBrowser/WebBrowser4Sinatra.rb} +0 -0
- data/examples/Control/{WebBrowser5.rbw → WebBrowser/WebBrowser5.rbw} +4 -2
- data/examples/Control/WebBrowser/jQueryUI.html +53 -0
- data/examples/Control/WebBrowser/jQueryUI.rbw +26 -0
- data/examples/MDI.rbw +2 -2
- data/examples/Raw/UIRibbon/Command.rbw +3 -3
- data/examples/Raw/UIRibbon/Minimal.rbw +3 -3
- data/examples/Version.rbw +1 -1
- data/lib/fzeet.rb +22 -7
- data/lib/fzeet/windows.rb +82 -5
- data/lib/fzeet/windows/com.rb +1 -318
- data/lib/fzeet/windows/com/Common.rb +318 -0
- data/lib/fzeet/windows/comctl.rb +1 -1
- data/lib/fzeet/windows/comctl/ComboBoxEx.rb +32 -0
- data/lib/fzeet/windows/comctl/DateTimePicker.rb +35 -0
- data/lib/fzeet/windows/comctl/Header.rb +61 -1
- data/lib/fzeet/windows/comctl/ListView.rb +133 -3
- data/lib/fzeet/windows/comctl/MonthCalendar.rb +35 -0
- data/lib/fzeet/windows/comctl/ProgressBar.rb +37 -0
- data/lib/fzeet/windows/comctl/PropertySheet.rb +50 -2
- data/lib/fzeet/windows/comctl/SysLink.rb +37 -0
- data/lib/fzeet/windows/comctl/Tab.rb +56 -0
- data/lib/fzeet/windows/comctl/TreeView.rb +81 -2
- data/lib/fzeet/windows/comctl/UpDown.rb +33 -0
- data/lib/fzeet/windows/comdlg.rb +1 -0
- data/lib/fzeet/windows/comdlg/ColorDialog.rb +41 -0
- data/lib/fzeet/windows/comdlg/Common.rb +87 -0
- data/lib/fzeet/windows/comdlg/FileDialog.rb +133 -0
- data/lib/fzeet/windows/comdlg/FindReplaceDialog.rb +102 -0
- data/lib/fzeet/windows/comdlg/FontDialog.rb +36 -0
- data/lib/fzeet/windows/comdlg/PrintDialog.rb +72 -0
- data/lib/fzeet/{Dialog → windows/comdlg}/ShellFileDialog.rb +0 -0
- data/lib/fzeet/windows/core.rb +5 -0
- data/lib/fzeet/windows/core/Common.rb +324 -0
- data/lib/fzeet/windows/core/Point.rb +42 -0
- data/lib/fzeet/windows/core/Rect.rb +114 -0
- data/lib/fzeet/windows/core/Size.rb +34 -0
- data/lib/fzeet/windows/core/SystemTime.rb +46 -0
- data/lib/fzeet/windows/core/Version.rb +57 -0
- data/lib/fzeet/windows/gdi.rb +1 -62
- data/lib/fzeet/windows/gdi/Common.rb +40 -0
- data/lib/fzeet/windows/gdi/Font.rb +64 -0
- data/lib/fzeet/windows/kernel.rb +1 -92
- data/lib/fzeet/windows/kernel/Common.rb +92 -0
- data/lib/fzeet/windows/libc.rb +1 -1
- data/lib/fzeet/windows/libcef.rb +1 -0
- data/lib/fzeet/windows/mshtml.rb +1 -1135
- data/lib/fzeet/windows/mshtml/Common.rb +1135 -0
- data/lib/fzeet/windows/ole.rb +1 -561
- data/lib/fzeet/windows/ole/Common.rb +112 -0
- data/lib/fzeet/windows/ole/PropVariant.rb +141 -0
- data/lib/fzeet/windows/oleaut.rb +3 -0
- data/lib/fzeet/windows/oleaut/Bstr.rb +39 -0
- data/lib/fzeet/windows/oleaut/Common.rb +187 -0
- data/lib/fzeet/windows/oleaut/SafeArray.rb +104 -0
- data/lib/fzeet/windows/oleaut/Variant.rb +269 -0
- data/lib/fzeet/windows/scintilla.rb +115 -1
- data/lib/fzeet/windows/{SciLexer.dll → scintilla/SciLexer.dll} +0 -0
- data/lib/fzeet/windows/shdocvw.rb +150 -0
- data/lib/fzeet/windows/shell.rb +1 -1
- data/lib/fzeet/windows/shell/Common.rb +94 -2
- data/lib/fzeet/windows/shlwapi.rb +1 -1
- data/lib/fzeet/windows/uiribbon.rb +416 -0
- data/lib/fzeet/windows/urlmon.rb +2 -2
- data/lib/fzeet/windows/user.rb +20 -0
- data/lib/fzeet/windows/user/Accelerator.rb +45 -0
- data/lib/fzeet/windows/user/Common.rb +3 -2
- data/lib/fzeet/windows/user/Control/Button.rb +54 -0
- data/lib/fzeet/windows/user/Control/ComboBox.rb +44 -1
- data/lib/fzeet/windows/user/Control/Common.rb +88 -1
- data/lib/fzeet/windows/user/Control/Edit.rb +50 -0
- data/lib/fzeet/windows/user/Control/ListBox.rb +69 -0
- data/lib/fzeet/windows/user/Control/Static.rb +31 -0
- data/lib/fzeet/windows/user/Menu.rb +130 -0
- data/lib/fzeet/windows/user/Message.rb +9 -0
- data/lib/fzeet/windows/user/MessageBox.rb +47 -0
- data/lib/fzeet/windows/user/SystemParametersInfo.rb +1 -1
- data/lib/fzeet/windows/user/Window.rb +5 -463
- data/lib/fzeet/{Window → windows/user/Window}/Common.rb +460 -0
- data/lib/fzeet/{Window → windows/user/Window}/Container.rb +0 -0
- data/lib/fzeet/{Window → windows/user/Window}/Dialog.rb +0 -0
- data/lib/fzeet/{Window → windows/user/Window}/MDI.rb +0 -0
- data/lib/fzeet/{Window → windows/user/Window}/View.rb +0 -0
- data/lib/fzeet/{Window → windows/user/Window}/Window.rb +0 -0
- data/lib/fzeet/{Window → windows/user/Window}/WindowMethods.rb +1 -1
- metadata +55 -61
- data/examples/Control/WebBrowser2.rbw +0 -39
- data/lib/fzeet/Accelerator.rb +0 -48
- data/lib/fzeet/Application.rb +0 -71
- data/lib/fzeet/Common.rb +0 -350
- data/lib/fzeet/Control.rb +0 -19
- data/lib/fzeet/Control/Button.rb +0 -57
- data/lib/fzeet/Control/ComboBox.rb +0 -46
- data/lib/fzeet/Control/ComboBoxEx.rb +0 -35
- data/lib/fzeet/Control/Common.rb +0 -89
- data/lib/fzeet/Control/DateTimePicker.rb +0 -38
- data/lib/fzeet/Control/Edit.rb +0 -53
- data/lib/fzeet/Control/ExplorerBrowser.rb +0 -66
- data/lib/fzeet/Control/Header.rb +0 -63
- data/lib/fzeet/Control/ListBox.rb +0 -72
- data/lib/fzeet/Control/ListView.rb +0 -133
- data/lib/fzeet/Control/MonthCalendar.rb +0 -38
- data/lib/fzeet/Control/ProgressBar.rb +0 -40
- data/lib/fzeet/Control/PropertySheet.rb +0 -51
- data/lib/fzeet/Control/Scintilla.rb +0 -117
- data/lib/fzeet/Control/Static.rb +0 -34
- data/lib/fzeet/Control/SysLink.rb +0 -40
- data/lib/fzeet/Control/Tab.rb +0 -59
- data/lib/fzeet/Control/TreeView.rb +0 -82
- data/lib/fzeet/Control/UpDown.rb +0 -36
- data/lib/fzeet/Control/WebBrowser.rb +0 -153
- data/lib/fzeet/Dialog.rb +0 -6
- data/lib/fzeet/Dialog/ColorDialog.rb +0 -44
- data/lib/fzeet/Dialog/Common.rb +0 -89
- data/lib/fzeet/Dialog/FileDialog.rb +0 -136
- data/lib/fzeet/Dialog/FindReplaceDialog.rb +0 -105
- data/lib/fzeet/Dialog/FontDialog.rb +0 -39
- data/lib/fzeet/Dialog/PrintDialog.rb +0 -75
- data/lib/fzeet/Menu.rb +0 -133
- data/lib/fzeet/UIRibbon.rb +0 -417
- data/lib/fzeet/Window.rb +0 -5
- data/lib/fzeet/windows/common.rb +0 -244
@@ -251,7 +251,7 @@ module Fzeet
|
|
251
251
|
:iSubItem, :int,
|
252
252
|
:iImage, :int,
|
253
253
|
:iOrder, :int,
|
254
|
-
(
|
254
|
+
(Version >= :vista) ? [
|
255
255
|
:cxMin, :int,
|
256
256
|
:cxDefault, :int,
|
257
257
|
:cxIdeal, :int
|
@@ -290,12 +290,12 @@ module Fzeet
|
|
290
290
|
:iImage, :int,
|
291
291
|
:lParam, :long,
|
292
292
|
:iIndent, :int,
|
293
|
-
(
|
293
|
+
(Version >= :xp) ? [
|
294
294
|
:iGroupId, :int,
|
295
295
|
:cColumns, :uint,
|
296
296
|
:puColumns, :pointer,
|
297
297
|
] : nil,
|
298
|
-
(
|
298
|
+
(Version >= :vista) ? [
|
299
299
|
:piColFmt, :pointer,
|
300
300
|
:iGroup, :int
|
301
301
|
] : nil
|
@@ -314,4 +314,134 @@ module Fzeet
|
|
314
314
|
:lParam, :long,
|
315
315
|
end
|
316
316
|
end
|
317
|
+
|
318
|
+
module ListViewMethods
|
319
|
+
class ExStyle
|
320
|
+
def initialize(listview) @listview = listview end
|
321
|
+
|
322
|
+
def <<(xstyle)
|
323
|
+
@listview.sendmsg(:setextendedlistviewstyle, 0,
|
324
|
+
@listview.sendmsg(:getextendedlistviewstyle) | Fzeet.constant(xstyle, *@listview.class::Prefix[:xstyle])
|
325
|
+
)
|
326
|
+
|
327
|
+
self
|
328
|
+
end
|
329
|
+
|
330
|
+
def >>(xstyle)
|
331
|
+
@listview.sendmsg(:setextendedlistviewstyle, 0,
|
332
|
+
@listview.sendmsg(:getextendedlistviewstyle) & ~Fzeet.constant(xstyle, *@listview.class::Prefix[:xstyle])
|
333
|
+
)
|
334
|
+
|
335
|
+
self
|
336
|
+
end
|
337
|
+
|
338
|
+
def toggle(what) send((@listview.xstyle?(what)) ? :>> : :<<, what); self end
|
339
|
+
end
|
340
|
+
|
341
|
+
def xstyle?(xstyle) (sendmsg(:getextendedlistviewstyle) & (xstyle = Fzeet.constant(xstyle, *self.class::Prefix[:xstyle]))) == xstyle end
|
342
|
+
def xstyle; ExStyle.new(self) end
|
343
|
+
|
344
|
+
def insertColumn(i, text, width)
|
345
|
+
lvc = Windows::LVCOLUMN.new
|
346
|
+
|
347
|
+
lvc[:mask] = Fzeet.flags([:fmt, :width, :text, :subitem], :lvcf_)
|
348
|
+
lvc[:fmt] = Fzeet.flags(:left, :lvcfmt_)
|
349
|
+
lvc[:cx] = width
|
350
|
+
lvc[:pszText] = ptext = FFI::MemoryPointer.from_string(text)
|
351
|
+
lvc[:iSubItem] = i
|
352
|
+
|
353
|
+
sendmsg(:insertcolumn, 0, lvc.pointer)
|
354
|
+
|
355
|
+
self
|
356
|
+
ensure
|
357
|
+
ptext.free if ptext
|
358
|
+
end
|
359
|
+
|
360
|
+
class Item
|
361
|
+
def initialize(lvi) @subitems = [lvi] end
|
362
|
+
|
363
|
+
attr_reader :subitems
|
364
|
+
end
|
365
|
+
|
366
|
+
def insertItem(i, j, text)
|
367
|
+
lvi = Windows::LVITEM.new
|
368
|
+
|
369
|
+
lvi[:mask] = Fzeet.flags(:text, :lvif_)
|
370
|
+
lvi[:iItem] = i
|
371
|
+
lvi[:iSubItem] = j
|
372
|
+
lvi[:pszText] = ptext = FFI::MemoryPointer.from_string(text)
|
373
|
+
|
374
|
+
if j == 0
|
375
|
+
@items << Item.new(lvi)
|
376
|
+
|
377
|
+
lvi[:mask] |= Windows::LVIF_PARAM
|
378
|
+
lvi[:lParam] = @items[i].object_id
|
379
|
+
|
380
|
+
sendmsg(:insertitem, 0, lvi.pointer)
|
381
|
+
else
|
382
|
+
@items[i].subitems << lvi
|
383
|
+
|
384
|
+
sendmsg(:setitem, 0, lvi.pointer)
|
385
|
+
end
|
386
|
+
|
387
|
+
@items[i].subitems[j].instance_variable_set(:@text, text)
|
388
|
+
|
389
|
+
class << @items[i].subitems[j]
|
390
|
+
attr_reader :text
|
391
|
+
end
|
392
|
+
|
393
|
+
self
|
394
|
+
ensure
|
395
|
+
ptext.free if ptext
|
396
|
+
end
|
397
|
+
|
398
|
+
def sort(j = 0)
|
399
|
+
sendmsg(:sortitems, j,
|
400
|
+
FFI::Function.new(:int, [:long, :long, :long], convention: :stdcall) { |lParam1, lParam2, lParamSort|
|
401
|
+
yield ObjectSpace._id2ref(lParam1).subitems[lParamSort], ObjectSpace._id2ref(lParam2).subitems[lParamSort], j
|
402
|
+
}
|
403
|
+
)
|
404
|
+
|
405
|
+
self
|
406
|
+
end
|
407
|
+
|
408
|
+
def clear; sendmsg(:deleteallitems); self end
|
409
|
+
end
|
410
|
+
|
411
|
+
class ListView < Control
|
412
|
+
include ListViewMethods
|
413
|
+
|
414
|
+
Prefix = {
|
415
|
+
xstyle: [:lvs_ex_, :ws_ex_],
|
416
|
+
style: [:lvs_, :ws_],
|
417
|
+
message: [:lvm_, :ccm_, :wm_],
|
418
|
+
notification: [:lvn_, :nm_]
|
419
|
+
}
|
420
|
+
|
421
|
+
def self.crackNotification(args)
|
422
|
+
case args[:notification]
|
423
|
+
when Windows::LVN_COLUMNCLICK
|
424
|
+
args[:nmlv] = Windows::NMLISTVIEW.new(FFI::Pointer.new(args[:lParam]))
|
425
|
+
args[:index] = args[:nmlv][:iSubItem]
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
def initialize(parent, id, opts = {}, &block)
|
430
|
+
super('SysListView32', parent, id, opts)
|
431
|
+
|
432
|
+
@header = Handle.wrap(FFI::Pointer.new(sendmsg(:getheader)), WindowMethods, HeaderMethods)
|
433
|
+
|
434
|
+
@items = []
|
435
|
+
|
436
|
+
@parent.on(:notify, @id, &block) if block
|
437
|
+
end
|
438
|
+
|
439
|
+
attr_reader :header, :items
|
440
|
+
|
441
|
+
def on(notification, &block)
|
442
|
+
@parent.on(:notify, @id, Fzeet.constant(notification, *self.class::Prefix[:notification]), &block)
|
443
|
+
|
444
|
+
self
|
445
|
+
end
|
446
|
+
end
|
317
447
|
end
|
@@ -59,4 +59,39 @@ module Fzeet
|
|
59
59
|
:stSelEnd, SYSTEMTIME
|
60
60
|
end
|
61
61
|
end
|
62
|
+
|
63
|
+
module MonthCalendarMethods
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
class MonthCalendar < Control
|
68
|
+
include MonthCalendarMethods
|
69
|
+
|
70
|
+
Prefix = {
|
71
|
+
xstyle: [:ws_ex_],
|
72
|
+
style: [:mcs_, :ws_],
|
73
|
+
message: [:mcm_, :ccm_, :wm_],
|
74
|
+
notification: [:mcn_, :nm_]
|
75
|
+
}
|
76
|
+
|
77
|
+
def self.crackNotification(args)
|
78
|
+
case args[:notification]
|
79
|
+
when Windows::MCN_SELCHANGE
|
80
|
+
args[:sc] = Windows::NMSELCHANGE.new(FFI::Pointer.new(args[:lParam]))
|
81
|
+
args[:st1], args[:st2] = args[:sc][:stSelStart], args[:sc][:stSelEnd]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def initialize(parent, id, opts = {}, &block)
|
86
|
+
super('SysMonthCal32', parent, id, opts)
|
87
|
+
|
88
|
+
@parent.on(:notify, @id, &block) if block
|
89
|
+
end
|
90
|
+
|
91
|
+
def on(notification, &block)
|
92
|
+
@parent.on(:notify, @id, Fzeet.constant(notification, *self.class::Prefix[:notification]), &block)
|
93
|
+
|
94
|
+
self
|
95
|
+
end
|
96
|
+
end
|
62
97
|
end
|
@@ -28,4 +28,41 @@ module Fzeet
|
|
28
28
|
PBST_ERROR = 0x0002
|
29
29
|
PBST_PAUSED = 0x0003
|
30
30
|
end
|
31
|
+
|
32
|
+
module ProgressBarMethods
|
33
|
+
def step=(step) sendmsg(:setstep, step) end
|
34
|
+
def step!; sendmsg(:stepit) end
|
35
|
+
|
36
|
+
def position=(position) sendmsg(:setpos, position) end
|
37
|
+
|
38
|
+
def marquee?; @marquee end
|
39
|
+
def marquee=(marquee) sendmsg(:setmarquee, (@marquee = marquee) ? 1 : 0) end
|
40
|
+
end
|
41
|
+
|
42
|
+
class ProgressBar < Control
|
43
|
+
include ProgressBarMethods
|
44
|
+
|
45
|
+
Prefix = {
|
46
|
+
xstyle: [:ws_ex_],
|
47
|
+
style: [:pbs_, :ws_],
|
48
|
+
message: [:pbm_, :ccm_, :wm_],
|
49
|
+
notification: [:nm_]
|
50
|
+
}
|
51
|
+
|
52
|
+
def self.crackNotification(args) end
|
53
|
+
|
54
|
+
def initialize(parent, id, opts = {}, &block)
|
55
|
+
super('msctls_progress32', parent, id, opts)
|
56
|
+
|
57
|
+
@marquee = false
|
58
|
+
|
59
|
+
@parent.on(:notify, @id, &block) if block
|
60
|
+
end
|
61
|
+
|
62
|
+
def on(notification, &block)
|
63
|
+
@parent.on(:notify, @id, Fzeet.constant(notification, *self.class::Prefix[:notification]), &block)
|
64
|
+
|
65
|
+
self
|
66
|
+
end
|
67
|
+
end
|
31
68
|
end
|
@@ -41,10 +41,10 @@ module Fzeet
|
|
41
41
|
:pcRefParent, :pointer,
|
42
42
|
:pszHeaderTitle, :pointer,
|
43
43
|
:pszHeaderSubTitle, :pointer,
|
44
|
-
(
|
44
|
+
(Version >= :xp) ? [
|
45
45
|
:hActCtx, :pointer
|
46
46
|
] : nil,
|
47
|
-
(
|
47
|
+
(Version >= :vista) ? [
|
48
48
|
:header, Class.new(FFI::Union) {
|
49
49
|
layout \
|
50
50
|
:hbmHeader, :pointer,
|
@@ -202,4 +202,52 @@ module Fzeet
|
|
202
202
|
PSNRET_INVALID_NOCHANGEPAGE = 2
|
203
203
|
PSNRET_MESSAGEHANDLED = 3
|
204
204
|
end
|
205
|
+
|
206
|
+
class PropertyPage
|
207
|
+
class PROPSHEETPAGEA1 < FFI::Struct
|
208
|
+
layout \
|
209
|
+
:array, [Windows::PROPSHEETPAGE, 1]
|
210
|
+
end
|
211
|
+
|
212
|
+
def initialize
|
213
|
+
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
class PropertySheet
|
218
|
+
def initialize(parent, opts = {wizard: false})
|
219
|
+
pointers = []
|
220
|
+
|
221
|
+
psps = PropertyPage::PROPSHEETPAGEA1.new
|
222
|
+
|
223
|
+
dt = Windows::DLGTEMPLATE.new
|
224
|
+
|
225
|
+
dt[:style] = Fzeet.flags([:'3dlook', :control, :child, :tabstop], :ds_, :ws_)
|
226
|
+
dt[:x], dt[:y], dt[:cx], dt[:cy] = 100, 100, 300, 150
|
227
|
+
|
228
|
+
psp = psps[:array][0]
|
229
|
+
|
230
|
+
psp[:dwSize] = psp.size
|
231
|
+
psp[:dwFlags] = Fzeet.flags([:dlgindirect, :usetitle], :psp_)
|
232
|
+
psp[:hInstance] = Windows.GetModuleHandle(nil)
|
233
|
+
psp[:template][:pResource] = dt
|
234
|
+
psp[:pszTitle] = pointers.push(FFI::MemoryPointer.from_string("Page")).last
|
235
|
+
|
236
|
+
psh = Windows::PROPSHEETHEADER.new
|
237
|
+
|
238
|
+
psh[:dwSize] = psh.size
|
239
|
+
psh[:dwFlags] = Fzeet.flags(:propsheetpage, :psh_)
|
240
|
+
psh[:dwFlags] |= Windows::PSH_WIZARD if opts[:wizard]
|
241
|
+
psh[:hwndParent] = parent.handle
|
242
|
+
psh[:hInstance] = Windows.GetModuleHandle(nil)
|
243
|
+
psh[:pszCaption] = pointers.push(FFI::MemoryPointer.from_string('Sheet')).last
|
244
|
+
psh[:nPages] = 1
|
245
|
+
psh[:start][:nStartPage] = 0
|
246
|
+
psh[:pages][:ppsp] = psps
|
247
|
+
|
248
|
+
Windows.DetonateLastError(-1, :PropertySheet, psh)
|
249
|
+
ensure
|
250
|
+
pointers.each(&:free)
|
251
|
+
end
|
252
|
+
end
|
205
253
|
end
|
@@ -31,4 +31,41 @@ module Fzeet
|
|
31
31
|
:item, LITEM
|
32
32
|
end
|
33
33
|
end
|
34
|
+
|
35
|
+
module SysLinkMethods
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
class SysLink < Control
|
40
|
+
include SysLinkMethods
|
41
|
+
|
42
|
+
Prefix = {
|
43
|
+
xstyle: [:ws_ex_],
|
44
|
+
style: [:lws_, :ws_],
|
45
|
+
message: [:lm_, :ccm_, :wm_],
|
46
|
+
notification: [:nm_]
|
47
|
+
}
|
48
|
+
|
49
|
+
def self.crackNotification(args)
|
50
|
+
case args[:notification]
|
51
|
+
when Windows::NM_CLICK
|
52
|
+
args[:link] = Windows::NMLINK.new(FFI::Pointer.new(args[:lParam]))
|
53
|
+
|
54
|
+
args[:id] = Windows.WCSTOMBS(args[:link][:item][:szID])
|
55
|
+
args[:url] = Windows.WCSTOMBS(args[:link][:item][:szUrl])
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def initialize(parent, id, opts = {}, &block)
|
60
|
+
super('SysLink', parent, id, opts)
|
61
|
+
|
62
|
+
@parent.on(:notify, @id, &block) if block
|
63
|
+
end
|
64
|
+
|
65
|
+
def on(notification, &block)
|
66
|
+
@parent.on(:notify, @id, Fzeet.constant(notification, *self.class::Prefix[:notification]), &block)
|
67
|
+
|
68
|
+
self
|
69
|
+
end
|
70
|
+
end
|
34
71
|
end
|
@@ -85,4 +85,60 @@ module Fzeet
|
|
85
85
|
:lParam, :long
|
86
86
|
end
|
87
87
|
end
|
88
|
+
|
89
|
+
module TabMethods
|
90
|
+
class Item
|
91
|
+
def initialize(tab, i) @tab, @index = tab, i end
|
92
|
+
|
93
|
+
attr_reader :tab, :index
|
94
|
+
end
|
95
|
+
|
96
|
+
def [](i) Item.new(self, i) end
|
97
|
+
|
98
|
+
def count; sendmsg(:getitemcount) end
|
99
|
+
alias :size :count
|
100
|
+
alias :length :count
|
101
|
+
|
102
|
+
def insert(text, i = count)
|
103
|
+
tci = Windows::TCITEM.new
|
104
|
+
|
105
|
+
tci[:mask] = Fzeet.flags(:text, :tcif_)
|
106
|
+
tci[:pszText] = ptext = FFI::MemoryPointer.from_string(text)
|
107
|
+
|
108
|
+
sendmsg(:insertitem, i, tci.pointer)
|
109
|
+
|
110
|
+
self
|
111
|
+
ensure
|
112
|
+
ptext.free
|
113
|
+
end
|
114
|
+
|
115
|
+
def current; self[sendmsg(:getcursel)] end
|
116
|
+
end
|
117
|
+
|
118
|
+
class Tab < Control
|
119
|
+
include TabMethods
|
120
|
+
|
121
|
+
Prefix = {
|
122
|
+
xstyle: [:tcs_ex_, :ws_ex_],
|
123
|
+
style: [:tcs_, :ws_],
|
124
|
+
message: [:tcm_, :ccm_, :wm_],
|
125
|
+
notification: [:tcn_, :nm_]
|
126
|
+
}
|
127
|
+
|
128
|
+
def self.crackNotification(args) end
|
129
|
+
|
130
|
+
def initialize(parent, id, opts = {}, &block)
|
131
|
+
super('SysTabControl32', parent, id, opts)
|
132
|
+
|
133
|
+
style << :clipsiblings
|
134
|
+
|
135
|
+
@parent.on(:notify, @id, &block) if block
|
136
|
+
end
|
137
|
+
|
138
|
+
def on(notification, &block)
|
139
|
+
@parent.on(:notify, @id, Fzeet.constant(notification, *self.class::Prefix[:notification]), &block)
|
140
|
+
|
141
|
+
self
|
142
|
+
end
|
143
|
+
end
|
88
144
|
end
|
@@ -157,12 +157,12 @@ module Fzeet
|
|
157
157
|
:cChildren, :int,
|
158
158
|
:lParam, :long,
|
159
159
|
:iIntegral, :int,
|
160
|
-
(
|
160
|
+
(Version >= :vista) ? [
|
161
161
|
:uStateEx, :uint,
|
162
162
|
:hwnd, :pointer,
|
163
163
|
:iExpandedImage, :int
|
164
164
|
] : nil,
|
165
|
-
(
|
165
|
+
(Version >= 7) ? [
|
166
166
|
:iReserved, :int
|
167
167
|
] : nil
|
168
168
|
].flatten.compact
|
@@ -195,4 +195,83 @@ module Fzeet
|
|
195
195
|
:ptDrag, POINT
|
196
196
|
end
|
197
197
|
end
|
198
|
+
|
199
|
+
module TreeViewMethods
|
200
|
+
class Item
|
201
|
+
def initialize(text) @text = text end
|
202
|
+
|
203
|
+
attr_reader :text, :root, :parent, :handle
|
204
|
+
|
205
|
+
def root=(root) raise 'Can\'t change established @root.' if @root; @root = root end
|
206
|
+
def parent=(parent) raise 'Can\'t change established @parent.' if @parent; @parent = parent end
|
207
|
+
def handle=(handle) raise 'Can\'t change established @handle.' if @handle; @handle = handle end
|
208
|
+
|
209
|
+
def append(text)
|
210
|
+
item = Item.new(text)
|
211
|
+
|
212
|
+
tvis = Windows::TVINSERTSTRUCT.new
|
213
|
+
|
214
|
+
tvis[:hInsertAfter] = Windows::TVI_LAST
|
215
|
+
tvis[:hParent] = @handle
|
216
|
+
|
217
|
+
tvi = tvis[:item]
|
218
|
+
|
219
|
+
tvi[:mask] = Windows::TVIF_TEXT
|
220
|
+
tvi[:pszText] = ptext = FFI::MemoryPointer.from_string(item.text)
|
221
|
+
|
222
|
+
item.root, item.parent = @root, self
|
223
|
+
item.handle = @root.sendmsg(:insertitem, 0, tvis.pointer)
|
224
|
+
|
225
|
+
item
|
226
|
+
ensure
|
227
|
+
ptext.free
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
def append(text)
|
232
|
+
item = Item.new(text)
|
233
|
+
|
234
|
+
tvis = Windows::TVINSERTSTRUCT.new
|
235
|
+
|
236
|
+
tvis[:hInsertAfter] = Windows::TVI_LAST
|
237
|
+
tvis[:hParent] = Windows::TVI_ROOT
|
238
|
+
|
239
|
+
tvi = tvis[:item]
|
240
|
+
|
241
|
+
tvi[:mask] = Windows::TVIF_TEXT
|
242
|
+
tvi[:pszText] = ptext = FFI::MemoryPointer.from_string(item.text)
|
243
|
+
|
244
|
+
item.root, item.parent = self, self
|
245
|
+
item.handle = sendmsg(:insertitem, 0, tvis.pointer)
|
246
|
+
|
247
|
+
item
|
248
|
+
ensure
|
249
|
+
ptext.free
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
class TreeView < Control
|
254
|
+
include TreeViewMethods
|
255
|
+
|
256
|
+
Prefix = {
|
257
|
+
xstyle: [:tvs_ex, :ws_ex_],
|
258
|
+
style: [:tvs_, :ws_],
|
259
|
+
message: [:tvm_, :ccm_, :wm_],
|
260
|
+
notification: [:tvn_, :nm_]
|
261
|
+
}
|
262
|
+
|
263
|
+
def self.crackNotification(args) end
|
264
|
+
|
265
|
+
def initialize(parent, id, opts = {}, &block)
|
266
|
+
super('SysTreeView32', parent, id, opts)
|
267
|
+
|
268
|
+
@parent.on(:notify, @id, &block) if block
|
269
|
+
end
|
270
|
+
|
271
|
+
def on(notification, &block)
|
272
|
+
@parent.on(:notify, @id, Fzeet.constant(notification, *self.class::Prefix[:notification]), &block)
|
273
|
+
|
274
|
+
self
|
275
|
+
end
|
276
|
+
end
|
198
277
|
end
|