Class: Fzeet::ColorDialog
Constant Summary
collapse
- DialogStruct =
Windows::CHOOSECOLOR
- HookProc =
-> *args { CommonDialog::HookProc.(*args.unshift(DialogStruct)) }
WindowMethods::EnumChildProc
Instance Attribute Summary
Attributes inherited from CommonDialog
#struct
Instance Method Summary
collapse
crackMessage, #hookProc, #on
#[], #capture=, #capture?, #dialog=, #dialog?, #dlgmsg?, #drawMenuBar, #eachChild, #enabled=, #enabled?, #focus=, #focus?, #invalidate, #location, #location=, #long, #menu, #menu=, #message, #paint, #position, #position=, #postmsg, #question, #rect, #reframe, #sendmsg, #size, #size=, #style, #style?, #text, #text=, #textlen, #topmost=, #topmost?, #update, #visible=, #visible?, #xstyle, #xstyle?
Methods included from Toggle
#toggle
Constructor Details
#initialize(opts = {}) ⇒ ColorDialog
Returns a new instance of ColorDialog.
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/fzeet/windows/comdlg/ColorDialog.rb', line 40
def initialize(opts = {})
_opts = {
}
badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty?
_opts.merge!(opts)
@struct = DialogStruct.new
@struct[:lStructSize] = @struct.size
@struct[:hInstance] = Windows.GetModuleHandle(nil)
@struct[:lpCustColors] = @buf = FFI::MemoryPointer.new(:ulong, 16)
@struct[:Flags] = Fzeet.flags(:enablehook, :cc_)
@struct[:lCustData] = object_id
@struct[:lpfnHook] = HookProc
super()
begin
yield self
ensure
dispose
end if block_given?
end
|
Instance Method Details
#color ⇒ Object
73
|
# File 'lib/fzeet/windows/comdlg/ColorDialog.rb', line 73
def color; result = @struct[:rgbResult]; [Windows.GetRValue(result), Windows.GetBValue(result), Windows.GetBValue(result)] end
|
#dispose ⇒ Object
65
|
# File 'lib/fzeet/windows/comdlg/ColorDialog.rb', line 65
def dispose; @buf.free end
|
#show(window = Application.window) ⇒ Object