Class: Fidgit::ScrollBar Abstract
- Defined in:
- lib/fidgit/elements/scroll_bar.rb
Overview
Direct Known Subclasses
Defined Under Namespace
Classes: Handle
Constant Summary
Constants inherited from Composite
Constants inherited from Element
Element::DEFAULT_SCHEMA_FILE, Element::VALID_ALIGN_H, Element::VALID_ALIGN_V
Instance Attribute Summary
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
-
#initialize(options = {}) ⇒ ScrollBar
constructor
A new instance of ScrollBar.
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 = {}) ⇒ 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 |