Class: Sirens::ButtonView
- Inherits:
-
WidgetView
- Object
- AbstractView
- WidgetView
- Sirens::ButtonView
- Defined in:
- lib/views/button_view.rb
Class Method Summary collapse
-
.view_accepted_styles ⇒ Object
Answer the styles accepted by this view.
Instance Method Summary collapse
-
#click ⇒ Object
Actions.
-
#initialize_handles ⇒ Object
Initializing.
- #label ⇒ Object
-
#label=(value) ⇒ Object
Styles.
-
#on_clicked ⇒ Object
Events.
-
#on_clicked=(block) ⇒ Object
Handlers.
- #subscribe_to_ui_events ⇒ Object
Methods inherited from WidgetView
#add_view, #apply_prop, #apply_props, #initialize, #main_handle
Methods inherited from AbstractView
accepted_styles, #accepted_styles, #add_view, #attribute_at, #background_color=, #foreground_color=, #height, #height=, #initialize, #main_handle, #populate_popup_menu_block=, #remove_view, #set_attribute, #show, #show_popup_menu, #state_colors_from, #width, #width=
Constructor Details
This class inherits a constructor from Sirens::WidgetView
Class Method Details
.view_accepted_styles ⇒ Object
Answer the styles accepted by this view.
10 11 12 |
# File 'lib/views/button_view.rb', line 10 def view_accepted_styles() super() + [:label, :on_clicked].freeze end |
Instance Method Details
#click ⇒ Object
Actions
40 41 42 |
# File 'lib/views/button_view.rb', line 40 def click() main_handle.clicked end |
#initialize_handles ⇒ Object
Initializing
17 18 19 20 |
# File 'lib/views/button_view.rb', line 17 def initialize_handles() @main_handle = Gtk::Button.new() @on_clicked = nil end |
#label ⇒ Object
34 35 36 |
# File 'lib/views/button_view.rb', line 34 def label() main_handle.label end |
#label=(value) ⇒ Object
Styles
30 31 32 |
# File 'lib/views/button_view.rb', line 30 def label=(value) main_handle.label = value end |
#on_clicked ⇒ Object
Events
52 53 54 |
# File 'lib/views/button_view.rb', line 52 def on_clicked() @on_clicked.call(self) unless @on_clicked.nil? end |
#on_clicked=(block) ⇒ Object
Handlers
46 47 48 |
# File 'lib/views/button_view.rb', line 46 def on_clicked=(block) @on_clicked = block end |
#subscribe_to_ui_events ⇒ Object
22 23 24 25 26 |
# File 'lib/views/button_view.rb', line 22 def subscribe_to_ui_events() main_handle.signal_connect('clicked') { on_clicked } end |