class Fzeet::ColorDialog

Constants

DialogStruct
HookProc

Public Class Methods

new(opts = {}) { |self| ... } click to toggle source
Calls superclass method
# File lib/fzeet/windows/comdlg/ColorDialog.rb, line 59
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

Public Instance Methods

color() click to toggle source
# File lib/fzeet/windows/comdlg/ColorDialog.rb, line 92
def color; result = @struct[:rgbResult]; [Windows.GetRValue(result), Windows.GetBValue(result), Windows.GetBValue(result)] end
dispose() click to toggle source
# File lib/fzeet/windows/comdlg/ColorDialog.rb, line 84
def dispose; @buf.free end
show(window = Application.window) click to toggle source
# File lib/fzeet/windows/comdlg/ColorDialog.rb, line 86
def show(window = Application.window)
        @struct[:hwndOwner] = window.handle

        DialogResult.new((Windows.ChooseColor(@struct) == 0) ? Windows::IDCANCEL : Windows::IDOK)
end