Class: Fidgit::MenuPane::Item
Overview
An item within the menu.
Constant Summary
Constants inherited from Label
Constants inherited from Composite
Constants inherited from Element
Element::DEFAULT_SCHEMA_FILE, Element::VALID_ALIGN_H, Element::VALID_ALIGN_V
Instance Attribute Summary collapse
-
#shortcut_text ⇒ Object
readonly
Returns the value of attribute shortcut_text.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Label
#background_color, #border_color, #icon_position
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
- #draw_foreground ⇒ Object
-
#initialize(text, value, options = {}) ⇒ Item
constructor
A new instance of Item.
Methods inherited from Button
#activate, #clicked_left_mouse_button, #enabled=, #enter, #leave, #parent=, #text=
Methods inherited from Label
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(text, value, options = {}) ⇒ Item
Returns a new instance of Item.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fidgit/elements/menu_pane.rb', line 14 def initialize(text, value, = {}) = { enabled: true, border_color: default(:border_color), shortcut_text: '', }.merge! @value = value @shortcut_text = [:shortcut_text] super(text, ) end |
Instance Attribute Details
#shortcut_text ⇒ Object (readonly)
Returns the value of attribute shortcut_text.
7 8 9 |
# File 'lib/fidgit/elements/menu_pane.rb', line 7 def shortcut_text @shortcut_text end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/fidgit/elements/menu_pane.rb', line 7 def value @value end |
Instance Method Details
#draw_foreground ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/fidgit/elements/menu_pane.rb', line 27 def draw_foreground super unless @shortcut_text.empty? font.draw_rel("#{@shortcut_text}", rect.right - padding_right, y + ((height - font.height) / 2).floor, z, 1, 0, 1, 1, color) end nil end |