Method: Fidgit::ScrollBar#initialize
- Defined in:
- lib/fidgit/elements/scroll_bar.rb
#initialize(options = {}) ⇒ ScrollBar
Returns a new instance of ScrollBar.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fidgit/elements/scroll_bar.rb', line 31 def initialize( = {}) = { background_color: default(:background_color), border_color: default(:border_color), rail_width: default(:rail_width), rail_color: default(:rail_color), handle_color: default(:handle_color), owner: nil, }.merge! @owner = [:owner] @rail_thickness = [:rail_width] @rail_color = [:rail_color] super @handle_container = Container.new(parent: self, width: [:width], height: [:height]) do @handle = Handle.new(parent: self, x: x, y: y, background_color: [:handle_color]) end subscribe :left_mouse_button do |sender, x, y| clicked_to_move x, y end end |