Class: Fzeet::Control
- Includes:
- WindowMethods
- Defined in:
- lib/fzeet/Control/Common.rb
Direct Known Subclasses
Button, ComboBox, ComboBoxEx, DateTimePicker, Edit, Header, ListBox, ListView, MonthCalendar, ProgressBar, Static, SysLink, TreeView, UpDown
Constant Summary
Constants included from WindowMethods
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Attributes inherited from Handle
Class Method Summary collapse
Instance Method Summary collapse
- #dispose ⇒ Object
-
#initialize(className, parent, id, opts = {}) ⇒ Control
constructor
A new instance of Control.
Methods included from WindowMethods
#[], #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, #show, #size, #size=, #style, #style?, #text, #text=, #textlen, #topmost=, #topmost?, #update, #visible=, #visible?, #xstyle, #xstyle?
Methods included from Toggle
Methods inherited from Handle
#attach, #detach, #dup, instance, instance?, wrap
Constructor Details
#initialize(className, parent, id, opts = {}) ⇒ Control
Returns a new instance of Control.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/fzeet/Control/Common.rb', line 19 def initialize(className, parent, id, opts = {}) @parent = parent @id = Command[id] handlers = {} opts.delete_if { |k, v| next false unless v.kind_of?(Proc) handlers[k] = v; true } _opts = { xstyle: [], caption: id.capitalize, style: [], x: Windows::CW_USEDEFAULT, y: Windows::CW_USEDEFAULT, width: Windows::CW_USEDEFAULT, height: Windows::CW_USEDEFAULT, position: [] } badopts = opts.keys - _opts.keys; raise "Bad option(s): #{badopts.join(', ')}." unless badopts.empty? _opts.merge!(opts) _opts[:xstyle] = Fzeet.flags(_opts[:xstyle], *self.class::Prefix[:xstyle]) _opts[:caption] = _opts[:caption].to_s _opts[:style] = Fzeet.flags([:child, :visible, :tabstop], :ws_) | Fzeet.flags(_opts[:style], *self.class::Prefix[:style]) _opts[:x], _opts[:y], _opts[:width], _opts[:height] = _opts[:position] unless _opts[:position].empty? @handle = Windows.DetonateLastError(FFI::Pointer::NULL, :CreateWindowEx, _opts[:xstyle], className, _opts[:caption], _opts[:style], _opts[:x], _opts[:y], _opts[:width], _opts[:height], @parent.handle, FFI::Pointer.new(@id), Windows.GetModuleHandle(nil), nil ) attach sendmsg(:setfont, Font.handle, 1) handlers.each { |k, v| on(k, &v) } end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
62 63 64 |
# File 'lib/fzeet/Control/Common.rb', line 62 def id @id end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
62 63 64 |
# File 'lib/fzeet/Control/Common.rb', line 62 def parent @parent end |
Class Method Details
.crackNotification(args) ⇒ Object
17 |
# File 'lib/fzeet/Control/Common.rb', line 17 def self.crackNotification(args) end |
Instance Method Details
#dispose ⇒ Object
64 |
# File 'lib/fzeet/Control/Common.rb', line 64 def dispose; detach end |