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
data/lib/fzeet/Control.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require_relative 'Control/Button'
|
2
|
-
require_relative 'Control/SysLink' if Fzeet::Windows::WINVER.AtLeastWindowsXP?
|
3
|
-
require_relative 'Control/Static'
|
4
|
-
require_relative 'Control/Edit'
|
5
|
-
require_relative 'Control/Scintilla'
|
6
|
-
require_relative 'Control/UpDown'
|
7
|
-
require_relative 'Control/MonthCalendar'
|
8
|
-
require_relative 'Control/DateTimePicker'
|
9
|
-
require_relative 'Control/ListBox'
|
10
|
-
require_relative 'Control/ComboBox'
|
11
|
-
require_relative 'Control/ComboBoxEx'
|
12
|
-
require_relative 'Control/Header'
|
13
|
-
require_relative 'Control/ListView'
|
14
|
-
require_relative 'Control/TreeView'
|
15
|
-
require_relative 'Control/ProgressBar'
|
16
|
-
require_relative 'Control/PropertySheet'
|
17
|
-
require_relative 'Control/Tab'
|
18
|
-
require_relative 'Control/ExplorerBrowser' if Fzeet::Windows::WINVER.AtLeastWindowsVista?
|
19
|
-
require_relative 'Control/WebBrowser'
|
data/lib/fzeet/Control/Button.rb
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
require_relative 'Common'
|
2
|
-
|
3
|
-
module Fzeet
|
4
|
-
module ButtonMethods
|
5
|
-
def image=(image) sendmsg(:setimage, Windows::IMAGE_BITMAP, image.handle) end
|
6
|
-
|
7
|
-
def note=(text) Windows.LPWSTR(text) { |p| sendmsg(:setnote, 0, p) } end
|
8
|
-
|
9
|
-
def checked?; sendmsg(:getcheck) == Windows::BST_CHECKED end
|
10
|
-
def checked=(checked) sendmsg(:setcheck, (checked) ? Windows::BST_CHECKED : Windows::BST_UNCHECKED) end
|
11
|
-
|
12
|
-
def indeterminate?; sendmsg(:getcheck) == Windows::BST_INDETERMINATE end
|
13
|
-
def indeterminate=(indeterminate) sendmsg(:setcheck, (indeterminate) ? Windows::BST_INDETERMINATE : Windows::BST_UNCHECKED) end
|
14
|
-
|
15
|
-
def pushed?; (sendmsg(:getstate) & Windows::BST_PUSHED) == Windows::BST_PUSHED end
|
16
|
-
def pushed=(pushed) sendmsg(:setstate, (pushed) ? 1 : 0) end
|
17
|
-
end
|
18
|
-
|
19
|
-
class Button < Control
|
20
|
-
include ButtonMethods
|
21
|
-
|
22
|
-
Prefix = {
|
23
|
-
xstyle: [:ws_ex_],
|
24
|
-
style: [:bs_, :ws_],
|
25
|
-
message: [:bm_, :bcm_, :ccm_, :wm_],
|
26
|
-
notification: [:bn_, :bcn_, :nm_]
|
27
|
-
}
|
28
|
-
|
29
|
-
def initialize(parent, id, opts = {}, &block)
|
30
|
-
super('Button', parent, id, opts)
|
31
|
-
|
32
|
-
width, height = 0, 0
|
33
|
-
|
34
|
-
using(ScreenDC.new) { |dc| dc.select(Font) {
|
35
|
-
minw = dc.textExtent('W' * 8).to_a[0]
|
36
|
-
width, height = dc.textExtent("W#{text}W").to_a
|
37
|
-
|
38
|
-
width = minw if width < minw; height = (height * 1.8).ceil
|
39
|
-
}}
|
40
|
-
|
41
|
-
self.location = 10, 10 if location.client!(parent).to_a == [0, 0]
|
42
|
-
self.size = width, height if size.to_a == [0, 0]
|
43
|
-
|
44
|
-
@parent.on(:command, @id, &block) if block
|
45
|
-
end
|
46
|
-
|
47
|
-
def on(notification, &block)
|
48
|
-
if (notification = Fzeet.constant(notification, *self.class::Prefix[:notification])) < Windows::BCN_LAST
|
49
|
-
@parent.on(:command, @id, notification, &block)
|
50
|
-
else
|
51
|
-
@parent.on(:notify, @id, notification, &block)
|
52
|
-
end
|
53
|
-
|
54
|
-
self
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
require_relative 'ListBox'
|
2
|
-
|
3
|
-
module Fzeet
|
4
|
-
module ComboBoxMethods
|
5
|
-
include ListBoxMethods
|
6
|
-
|
7
|
-
def textlen(i) raise "GETLBTEXTLEN failed." if (len = sendmsg(:getlbtextlen, i)) == -1; len end
|
8
|
-
|
9
|
-
def [](i)
|
10
|
-
i = sendmsg(:getcursel) if i == :selected
|
11
|
-
|
12
|
-
return '' if i == -1 || (len = textlen(i) + 1) == 1
|
13
|
-
|
14
|
-
''.tap { |item|
|
15
|
-
FFI::MemoryPointer.new(:char, len) { |buf|
|
16
|
-
raise "GETLBTEXT failed." if sendmsg(:getlbtext, i, buf) == -1
|
17
|
-
|
18
|
-
item << buf.read_string
|
19
|
-
}
|
20
|
-
}
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
class ComboBox < Control
|
25
|
-
include ComboBoxMethods
|
26
|
-
|
27
|
-
Prefix = {
|
28
|
-
xstyle: [:ws_ex_],
|
29
|
-
style: [:cbs_, :ws_],
|
30
|
-
message: [:cb_, :wm_],
|
31
|
-
notification: [:cbn_]
|
32
|
-
}
|
33
|
-
|
34
|
-
def initialize(parent, id, opts = {}, &block)
|
35
|
-
super('ComboBox', parent, id, opts)
|
36
|
-
|
37
|
-
@parent.on(:command, @id, &block) if block
|
38
|
-
end
|
39
|
-
|
40
|
-
def on(notification, &block)
|
41
|
-
@parent.on(:command, @id, Fzeet.constant(notification, *self.class::Prefix[:notification]), &block)
|
42
|
-
|
43
|
-
self
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require_relative 'ComboBox'
|
2
|
-
|
3
|
-
module Fzeet
|
4
|
-
module ComboBoxExMethods
|
5
|
-
include ComboBoxMethods
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
class ComboBoxEx < Control
|
10
|
-
include ComboBoxExMethods
|
11
|
-
|
12
|
-
Prefix = {
|
13
|
-
xstyle: [:cbes_ex_, :ws_ex_],
|
14
|
-
style: [:cbs_, :ws_],
|
15
|
-
message: [:cb_, :cbem_, :ccm_, :wm_],
|
16
|
-
notification: [:cbn_, :cben_, :nm_]
|
17
|
-
}
|
18
|
-
|
19
|
-
def initialize(parent, id, opts = {}, &block)
|
20
|
-
super('ComboBoxEx32', parent, id, opts)
|
21
|
-
|
22
|
-
@parent.on(:command, @id, &block) if block
|
23
|
-
end
|
24
|
-
|
25
|
-
def on(notification, &block)
|
26
|
-
if (notification = Fzeet.constant(notification, *self.class::Prefix[:notification])) < Windows::CBEN_LAST
|
27
|
-
@parent.on(:command, @id, notification, &block)
|
28
|
-
else
|
29
|
-
@parent.on(:notify, @id, notification, &block)
|
30
|
-
end
|
31
|
-
|
32
|
-
self
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
data/lib/fzeet/Control/Common.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
require_relative '../Window/WindowMethods'
|
2
|
-
|
3
|
-
module Fzeet
|
4
|
-
class Control < Handle
|
5
|
-
include WindowMethods
|
6
|
-
|
7
|
-
Windows::NONCLIENTMETRICS.new.tap { |ncm|
|
8
|
-
ncm[:cbSize] = ncm.size
|
9
|
-
|
10
|
-
Windows.DetonateLastError(0, :SystemParametersInfo, Windows::SPI_GETNONCLIENTMETRICS, ncm.size, ncm, 0)
|
11
|
-
|
12
|
-
Font = IndirectFont.new(ncm[:lfMenuFont])
|
13
|
-
|
14
|
-
at_exit { Font.dispose }
|
15
|
-
}
|
16
|
-
|
17
|
-
def self.crackNotification(args) end
|
18
|
-
|
19
|
-
def initialize(className, parent, id, opts = {})
|
20
|
-
@parent = parent
|
21
|
-
@id = Command[id]
|
22
|
-
|
23
|
-
handlers = {}
|
24
|
-
|
25
|
-
opts.delete_if { |k, v|
|
26
|
-
next false unless v.kind_of?(Proc)
|
27
|
-
|
28
|
-
handlers[k] = v; true
|
29
|
-
}
|
30
|
-
|
31
|
-
_opts = {
|
32
|
-
xstyle: [],
|
33
|
-
caption: id.capitalize,
|
34
|
-
style: [],
|
35
|
-
x: 0,
|
36
|
-
y: 0,
|
37
|
-
width: 0,
|
38
|
-
height: 0,
|
39
|
-
position: [],
|
40
|
-
anchor: nil
|
41
|
-
}
|
42
|
-
badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty?
|
43
|
-
_opts.merge!(opts)
|
44
|
-
|
45
|
-
_opts[:xstyle] = Fzeet.flags(_opts[:xstyle], *self.class::Prefix[:xstyle])
|
46
|
-
_opts[:caption] = _opts[:caption].to_s
|
47
|
-
_opts[:style] = Fzeet.flags([:child, :visible, :tabstop], :ws_) | Fzeet.flags(_opts[:style], *self.class::Prefix[:style])
|
48
|
-
_opts[:x], _opts[:y], _opts[:width], _opts[:height] = _opts[:position] unless _opts[:position].empty?
|
49
|
-
|
50
|
-
@handle = Windows.DetonateLastError(FFI::Pointer::NULL, :CreateWindowEx,
|
51
|
-
_opts[:xstyle], className, _opts[:caption], _opts[:style],
|
52
|
-
_opts[:x], _opts[:y], _opts[:width], _opts[:height],
|
53
|
-
@parent.handle, FFI::Pointer.new(@id), Windows.GetModuleHandle(nil), nil
|
54
|
-
)
|
55
|
-
|
56
|
-
attach
|
57
|
-
|
58
|
-
sendmsg(:setfont, Font.handle, 1)
|
59
|
-
|
60
|
-
handlers.each { |k, v| on(k, &v) }
|
61
|
-
|
62
|
-
case _opts[:anchor]
|
63
|
-
when :ltr
|
64
|
-
@parent.on(:size) { |args|
|
65
|
-
self.position = @parent.rect.tap { |r| r[:bottom] = _opts[:height] }.to_a
|
66
|
-
|
67
|
-
args[:result] = nil if @parent.class == MDIChild
|
68
|
-
}
|
69
|
-
when :lrb
|
70
|
-
@parent.on(:size) { |args|
|
71
|
-
self.position = @parent.rect.tap { |r| r[:top] = r[:bottom] - _opts[:height]; r[:bottom] = _opts[:height] }.to_a
|
72
|
-
|
73
|
-
args[:result] = nil if @parent.class == MDIChild
|
74
|
-
}
|
75
|
-
when :ltrb
|
76
|
-
@parent.on(:size) { |args|
|
77
|
-
self.position = @parent.rect.to_a
|
78
|
-
|
79
|
-
args[:result] = nil if @parent.class == MDIChild
|
80
|
-
}
|
81
|
-
else raise ArgumentError, "Bad anchor spec: #{_opts[:anchor]}."
|
82
|
-
end if _opts[:anchor]
|
83
|
-
end
|
84
|
-
|
85
|
-
attr_reader :parent, :id
|
86
|
-
|
87
|
-
def dispose; detach end
|
88
|
-
end
|
89
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require_relative 'Common'
|
2
|
-
|
3
|
-
module Fzeet
|
4
|
-
module DateTimePickerMethods
|
5
|
-
|
6
|
-
end
|
7
|
-
|
8
|
-
class DateTimePicker < Control
|
9
|
-
include DateTimePickerMethods
|
10
|
-
|
11
|
-
Prefix = {
|
12
|
-
xstyle: [:ws_ex_],
|
13
|
-
style: [:dts_, :ws_],
|
14
|
-
message: [:dtm_, :ccm_, :wm_],
|
15
|
-
notification: [:dtn_, :nm_]
|
16
|
-
}
|
17
|
-
|
18
|
-
def self.crackNotification(args)
|
19
|
-
case args[:notification]
|
20
|
-
when Windows::DTN_DATETIMECHANGE
|
21
|
-
args[:dtc] = Windows::NMDATETIMECHANGE.new(FFI::Pointer.new(args[:lParam]))
|
22
|
-
args[:st] = args[:dtc][:st] if args[:dtc][:dwFlags] == Windows::GDT_VALID
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def initialize(parent, id, opts = {}, &block)
|
27
|
-
super('SysDateTimePick32', parent, id, opts)
|
28
|
-
|
29
|
-
@parent.on(:notify, @id, &block) if block
|
30
|
-
end
|
31
|
-
|
32
|
-
def on(notification, &block)
|
33
|
-
@parent.on(:notify, @id, Fzeet.constant(notification, *self.class::Prefix[:notification]), &block)
|
34
|
-
|
35
|
-
self
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
data/lib/fzeet/Control/Edit.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require_relative 'Common'
|
2
|
-
|
3
|
-
module Fzeet
|
4
|
-
module EditMethods
|
5
|
-
def clear; self.text = ''; self end
|
6
|
-
|
7
|
-
def select(s = 0, e = -1) sendmsg(:setsel, s, e); self end
|
8
|
-
|
9
|
-
def cuebanner=(text) Windows.LPWSTR(text) { |p| sendmsg(:setcuebanner, 1, p) } end
|
10
|
-
|
11
|
-
def showBalloontip(text, title = '', icon = 1)
|
12
|
-
Windows.LPWSTR(text) { |ptext| Windows.LPWSTR(title) { |ptitle|
|
13
|
-
ebt = Windows::EDITBALLOONTIP.new
|
14
|
-
|
15
|
-
ebt[:cbStruct] = ebt.size
|
16
|
-
ebt[:pszTitle] = ptitle
|
17
|
-
ebt[:pszText] = ptext
|
18
|
-
ebt[:ttiIcon] = Fzeet.constant(icon, :tti_)
|
19
|
-
|
20
|
-
sendmsg(:showBalloontip, 0, ebt.pointer)
|
21
|
-
}}
|
22
|
-
|
23
|
-
self
|
24
|
-
end
|
25
|
-
|
26
|
-
def hideBalloontip; sendmsg(:hideBalloontip); self end
|
27
|
-
end
|
28
|
-
|
29
|
-
class Edit < Control
|
30
|
-
include EditMethods
|
31
|
-
|
32
|
-
Prefix = {
|
33
|
-
xstyle: [:ws_ex_],
|
34
|
-
style: [:es_, :ws_],
|
35
|
-
message: [:em_, :wm_],
|
36
|
-
notification: [:en_]
|
37
|
-
}
|
38
|
-
|
39
|
-
def initialize(parent, id, opts = {}, &block)
|
40
|
-
super('Edit', parent, id, opts)
|
41
|
-
|
42
|
-
style << :border; reframe
|
43
|
-
|
44
|
-
@parent.on(:command, @id, &block) if block
|
45
|
-
end
|
46
|
-
|
47
|
-
def on(notification, &block)
|
48
|
-
@parent.on(:command, @id, Fzeet.constant(notification, *self.class::Prefix[:notification]), &block)
|
49
|
-
|
50
|
-
self
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require_relative 'Common'
|
2
|
-
|
3
|
-
module Fzeet
|
4
|
-
class ExplorerBrowser < Windows::ExplorerBrowser
|
5
|
-
def initialize(parent)
|
6
|
-
@parent = parent
|
7
|
-
|
8
|
-
super()
|
9
|
-
|
10
|
-
@events = Windows::ExplorerBrowserEvents.new
|
11
|
-
|
12
|
-
@events.instance_variable_set(:@browser, self)
|
13
|
-
|
14
|
-
class << @events
|
15
|
-
attr_reader :browser
|
16
|
-
|
17
|
-
(self::VTBL.members - Windows::IUnknown::VTBL.members).each { |name|
|
18
|
-
define_method(name) { |*args|
|
19
|
-
(handlers = browser.handlers && browser.handlers[name]) && handlers.each { |handler|
|
20
|
-
(handler.arity == 0) ? handler.call : handler.call(*args)
|
21
|
-
}
|
22
|
-
|
23
|
-
Windows::S_OK
|
24
|
-
}
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
@cookie = nil
|
29
|
-
FFI::MemoryPointer.new(:ulong) { |p| Advise(@events, p); @cookie = p.get_ulong(0) }
|
30
|
-
|
31
|
-
Initialize(@parent.handle, parent.rect, nil)
|
32
|
-
|
33
|
-
@parent.
|
34
|
-
on(:size) { SetRect(nil, @parent.rect) }.
|
35
|
-
on(:destroy) { Unadvise(@cookie); @events.Release; Destroy(); Release() }.
|
36
|
-
|
37
|
-
instance_variable_set(:@__ExplorerBrowser__, self)
|
38
|
-
end
|
39
|
-
|
40
|
-
attr_reader :parent, :events, :handlers
|
41
|
-
|
42
|
-
def on(event, &block)
|
43
|
-
((@handlers ||= {})["On#{event}".to_sym] ||= []) << block
|
44
|
-
|
45
|
-
self
|
46
|
-
end
|
47
|
-
|
48
|
-
def goto(where)
|
49
|
-
pidl = nil
|
50
|
-
|
51
|
-
FFI::MemoryPointer.new(:pointer) { |p|
|
52
|
-
Windows.SHGetKnownFolderIDList(Windows.const_get("FOLDERID_#{where}"), 0, nil, p)
|
53
|
-
|
54
|
-
BrowseToIDList(pidl = p.read_pointer, 0)
|
55
|
-
}
|
56
|
-
|
57
|
-
self
|
58
|
-
ensure
|
59
|
-
Windows.CoTaskMemFree(pidl)
|
60
|
-
end
|
61
|
-
|
62
|
-
def back; BrowseToIDList(nil, Windows::SBSP_NAVIGATEBACK); self end
|
63
|
-
def forward; BrowseToIDList(nil, Windows::SBSP_NAVIGATEFORWARD); self end
|
64
|
-
def up; BrowseToIDList(nil, Windows::SBSP_PARENT); self end
|
65
|
-
end
|
66
|
-
end
|
data/lib/fzeet/Control/Header.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
require_relative 'Common'
|
2
|
-
|
3
|
-
module Fzeet
|
4
|
-
module HeaderMethods
|
5
|
-
Prefix = {
|
6
|
-
xstyle: [:ws_ex_],
|
7
|
-
style: [:hds_, :ws_],
|
8
|
-
message: [:hdm_, :ccm_, :wm_],
|
9
|
-
notification: [:hdn_, :nm_]
|
10
|
-
}
|
11
|
-
|
12
|
-
def count; sendmsg(:getitemcount) end
|
13
|
-
|
14
|
-
def insertItem(i, text, width)
|
15
|
-
hdi = Windows::HDITEM.new
|
16
|
-
|
17
|
-
hdi[:mask] = Fzeet.flags([:width, :text, :format, :order], :hdi_)
|
18
|
-
hdi[:cxy] = width
|
19
|
-
hdi[:pszText] = ptext = FFI::MemoryPointer.from_string(text)
|
20
|
-
hdi[:fmt] = Fzeet.flags([:left, :string], :hdf_)
|
21
|
-
hdi[:iOrder] = i
|
22
|
-
|
23
|
-
sendmsg(:insertitem, 0, hdi.pointer)
|
24
|
-
|
25
|
-
self
|
26
|
-
ensure
|
27
|
-
ptext.free
|
28
|
-
end
|
29
|
-
|
30
|
-
def modifyItem(i, text, style = 0)
|
31
|
-
hdi = Windows::HDITEM.new
|
32
|
-
|
33
|
-
hdi[:mask] = Fzeet.flags([:text, :format], :hdi_)
|
34
|
-
hdi[:pszText] = ptext = FFI::MemoryPointer.from_string(text)
|
35
|
-
hdi[:fmt] = Fzeet.flags([:left, :string], :hdf_)
|
36
|
-
hdi[:fmt] |= Fzeet.flags([*style].compact, :hdf_)
|
37
|
-
|
38
|
-
sendmsg(:setitem, i, hdi.pointer)
|
39
|
-
|
40
|
-
self
|
41
|
-
ensure
|
42
|
-
ptext.free
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class Header < Control
|
47
|
-
include HeaderMethods
|
48
|
-
|
49
|
-
def self.crackNotification(args) end
|
50
|
-
|
51
|
-
def initialize(parent, id, opts = {}, &block)
|
52
|
-
super('SysHeader32', parent, id, opts)
|
53
|
-
|
54
|
-
@parent.on(:notify, @id, &block) if block
|
55
|
-
end
|
56
|
-
|
57
|
-
def on(notification, &block)
|
58
|
-
@parent.on(:notify, @id, Fzeet.constant(notification, *self.class::Prefix[:notification]), &block)
|
59
|
-
|
60
|
-
self
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|