class Fzeet::Button

Constants

Prefix

Public Class Methods

new(parent, id, opts = {}, &block) click to toggle source
Calls superclass method
# File lib/fzeet/windows/user/Control/Button.rb, line 88
def initialize(parent, id, opts = {}, &block)
        super('Button', parent, id, opts)

        width, height = 0, 0

        using(ScreenDC.new) { |dc| dc.select(Font) {
                minw = dc.textExtent('W' * 8).to_a[0]
                width, height = dc.textExtent("W#{text}W").to_a

                width = minw if width < minw; height = (height * 1.8).ceil
        }}

        self.location = 10, 10 if location.client!(parent).to_a == [0, 0]
        self.size = width, height if size.to_a == [0, 0]

        @parent.on(:command, @id, &block) if block
end

Public Instance Methods

on(notification, &block) click to toggle source
# File lib/fzeet/windows/user/Control/Button.rb, line 106
def on(notification, &block)
        if (notification = Fzeet.constant(notification, *self.class::Prefix[:notification])) < Windows::BCN_LAST
                @parent.on(:command, @id, notification, &block)
        else
                @parent.on(:notify, @id, notification, &block)
        end

        self
end