Class: Crimson::Titlebar
- Defined in:
- lib/crimson/widgets/titlebar.rb
Instance Attribute Summary collapse
-
#close_button ⇒ Object
readonly
Returns the value of attribute close_button.
-
#hide_button ⇒ Object
readonly
Returns the value of attribute hide_button.
-
#resize_button ⇒ Object
readonly
Returns the value of attribute resize_button.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes inherited from Object
#added_children, #event_handlers, #id, #node, #removed_children, #tag
Attributes inherited from Model
#local, #observers, #revision_number, #revisions
Instance Method Summary collapse
- #buttons ⇒ Object
-
#initialize(window_title) ⇒ Titlebar
constructor
A new instance of Titlebar.
Methods inherited from Object
#==, #add, #breadth_each, #children, #commit_tree!, #eql?, #find_descendant, #hash, #hidden?, #hide, #inspect, #move, #on, #on_event, #parent, #parent=, #postordered_each, #preordered_each, #remove, #root, #show, #shown?, #siblings, #to_s, #un
Methods inherited from Model
#add_observer, #apply_changes!, #changed?, #changes, #commit!, #master, #modify, #new_changes, #notify_observers, #reload!, #remove_observer, #rollback!
Constructor Details
#initialize(window_title) ⇒ Titlebar
Returns a new instance of Titlebar.
9 10 11 12 13 14 15 16 17 18 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 61 62 63 64 65 |
# File 'lib/crimson/widgets/titlebar.rb', line 9 def initialize(window_title) super(:div) @title = Object.new(:div) self.title = window_title title.style.color = 'white' title.style.fontFamily = 'Verdana' title.style.fontWeight = 'bold' title.style.textAlign = 'center' title.style.margin = 'auto' add(title) @hide_button = Object.new(:img) .src = 'crimson/icons/hide.png' .style.padding = '10px 20px' .on('mouseenter') do |_data| .style.backgroundColor = 'rgba(0, 0, 0, 0.6)' .commit! end .on('mouseleave') do |_data| .style.backgroundColor = 'rgba(0, 0, 0, 0.0)' .commit! end add() @resize_button = Object.new(:img) .src = 'crimson/icons/resize.png' .style.padding = '8px 16px' .on('mouseenter') do |_data| .style.backgroundColor = 'rgba(0, 0, 0, 0.6)' .commit! end .on('mouseleave') do |_data| .style.backgroundColor = 'rgba(0, 0, 0, 0.0)' .commit! end add() @close_button = Object.new(:img) .src = 'crimson/icons/close.png' .style.padding = '10px 20px' .on('mouseenter') do |_data| .style.backgroundColor = 'rgba(0, 0, 0, 0.6)' .commit! end .on('mouseleave') do |_data| .style.backgroundColor = 'rgba(0, 0, 0, 0.0)' .commit! end add() style.backgroundColor = '#2ecc71' style.width = '100%' style.height = '35px' style.display = 'flex' style.userSelect = 'none' end |
Instance Attribute Details
#close_button ⇒ Object (readonly)
Returns the value of attribute close_button.
7 8 9 |
# File 'lib/crimson/widgets/titlebar.rb', line 7 def @close_button end |
#hide_button ⇒ Object (readonly)
Returns the value of attribute hide_button.
7 8 9 |
# File 'lib/crimson/widgets/titlebar.rb', line 7 def @hide_button end |
#resize_button ⇒ Object (readonly)
Returns the value of attribute resize_button.
7 8 9 |
# File 'lib/crimson/widgets/titlebar.rb', line 7 def @resize_button end |
#title ⇒ Object
Returns the value of attribute title.
7 8 9 |
# File 'lib/crimson/widgets/titlebar.rb', line 7 def title @title end |
Instance Method Details
#buttons ⇒ Object
71 72 73 |
# File 'lib/crimson/widgets/titlebar.rb', line 71 def [, , ] end |