class Fzeet::FontDialog

Constants

DialogStruct
HookProc

Public Class Methods

new(opts = {}) click to toggle source
Calls superclass method Fzeet::CommonDialog::new
# File lib/fzeet/windows/comdlg/FontDialog.rb, line 103
def initialize(opts = {})
        _opts = {
                font: Control::Font,
                color: 0
        }
        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[:lpLogFont] = _opts[:font].logfont.pointer
        @struct[:Flags] = Fzeet.flags([:enablehook, :both, :inittologfontstruct, :effects], :cf_)
        @struct[:rgbColors] = _opts[:color]
        @struct[:lCustData] = object_id
        @struct[:lpfnHook] = HookProc

        super()
end

Public Instance Methods

color() click to toggle source
# File lib/fzeet/windows/comdlg/FontDialog.rb, line 131
def color; @struct[:rgbColors] end
font() click to toggle source
# File lib/fzeet/windows/comdlg/FontDialog.rb, line 130
def font; IndirectFont.new(Windows::LOGFONT.new(@struct[:lpLogFont])) end
show(window = Application.window) click to toggle source
# File lib/fzeet/windows/comdlg/FontDialog.rb, line 124
def show(window = Application.window)
        @struct[:hwndOwner] = window.handle

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