Class: Fidgit::Group
- Defined in:
- lib/fidgit/elements/group.rb
Constant Summary
Constants inherited from Element
Element::DEFAULT_SCHEMA_FILE, Element::VALID_ALIGN_H, Element::VALID_ALIGN_V
Instance Attribute Summary collapse
-
#selected ⇒ Object
readonly
Returns the value of attribute selected.
Attributes inherited from Packer
Attributes inherited from Element
#align_h, #align_v, #background_color, #border_thickness, #font, #padding_bottom, #padding_left, #padding_right, #padding_top, #parent, #tip, #z
Instance Method Summary collapse
- #add_button(button) ⇒ Object
-
#initialize(options = {}, &block) ⇒ Group
constructor
A new instance of Group.
- #remove_button(button) ⇒ Object
- #value ⇒ Object
- #value=(value) ⇒ Object
Methods inherited from Container
#add, #button, #clear, #color_picker, #color_well, #combo_box, #file_browser, #grid, #group, #hit_element, #horizontal, #image_frame, #insert, #label, #list, #radio_button, #remove, #scroll_area, #scroll_window, #slider, #text_area, #to_s, #toggle_button, #update, #vertical, #write_tree, #x=, #y=
Methods inherited from Element
#default, #drag?, #draw, #draw_frame, #draw_rect, #enabled=, #enabled?, #height, #height=, #hit?, #max_height, #max_width, #min_height, #min_width, new, original_new, #outer_height, #outer_width, #recalc, schema, #to_s, #update, #width, #width=, #with, #x, #x=, #y, #y=
Methods included from Event
#events, included, new_event_handlers, #publish, #subscribe, #unsubscribe
Constructor Details
#initialize(options = {}, &block) ⇒ Group
Returns a new instance of Group.
23 24 25 26 27 28 |
# File 'lib/fidgit/elements/group.rb', line 23 def initialize( = {}, &block) super() @selected = nil @buttons = [] end |
Instance Attribute Details
#selected ⇒ Object (readonly)
Returns the value of attribute selected.
3 4 5 |
# File 'lib/fidgit/elements/group.rb', line 3 def selected @selected end |
Instance Method Details
#add_button(button) ⇒ Object
30 31 32 33 34 |
# File 'lib/fidgit/elements/group.rb', line 30 def () @buttons.push self.value = .value if .checked? nil end |
#remove_button(button) ⇒ Object
36 37 38 39 40 |
# File 'lib/fidgit/elements/group.rb', line 36 def () self.value = nil if == @selected @buttons.delete nil end |
#value ⇒ Object
7 |
# File 'lib/fidgit/elements/group.rb', line 7 def value; @selected ? @selected.value : nil; end |
#value=(value) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/fidgit/elements/group.rb', line 52 def value=(value) if value != self.value = @buttons.find { |b| b.value == value } @selected.uncheck if @selected and @selected.checked? @selected = @selected.check if @selected and not @selected.checked? publish :changed, self.value end value end |