Class: Ruflet::UI::Controls::RufletComponents::WindowControl
- Defined in:
- lib/ruflet_ui/ruflet/ui/controls/shared/window_control.rb
Constant Summary collapse
- TYPE =
"window".freeze
- WIRE =
"Window".freeze
- RESIZE_EDGES =
{ "top" => "top", "left" => "left", "right" => "right", "bottom" => "bottom", "top_left" => "topLeft", "bottom_left" => "bottomLeft", "top_right" => "topRight", "bottom_right" => "bottomRight" }.freeze
- KEYWORDS =
[:alignment, :always_on_bottom, :always_on_top, :aspect_ratio, :badge_label, :bgcolor, :brightness, :data, :focused, :frameless, :full_screen, :height, :icon, :ignore_mouse_events, :key, :left, :max_height, :max_width, :maximizable, :maximized, :min_height, :min_width, :minimizable, :minimized, :movable, :opacity, :prevent_close, :progress_bar, :resizable, :shadow, :skip_task_bar, :title_bar_buttons_hidden, :title_bar_hidden, :top, :visible, :width, :on_event].freeze
Constants inherited from Control
Control::HOST_EXPANDED_TYPES, Control::SCHEMA_METADATA_CACHE
Instance Attribute Summary
Attributes inherited from Control
#children, #id, #props, #runtime_page, #type, #wire_id
Instance Method Summary collapse
-
#initialize(id: nil, **props) ⇒ WindowControl
constructor
A new instance of WindowControl.
- #start_resizing(edge, timeout: 10, on_result: nil) ⇒ Object
Methods inherited from Control
#attach_handler, #emit, generate_id, #has_handler?, #merge_props, #on, #to_patch
Constructor Details
#initialize(id: nil, **props) ⇒ WindowControl
Returns a new instance of WindowControl.
23 24 25 26 27 28 29 30 |
# File 'lib/ruflet_ui/ruflet/ui/controls/shared/window_control.rb', line 23 def initialize(id: nil, **props) compact = {} props.each do |key, value| raise ArgumentError, "unknown keyword: :#{key}" unless KEYWORDS.include?(key) compact[key] = value unless value.nil? end super(type: TYPE, id: id, **compact) end |
Instance Method Details
#start_resizing(edge, timeout: 10, on_result: nil) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/ruflet_ui/ruflet/ui/controls/shared/window_control.rb', line 45 def start_resizing(edge, timeout: 10, on_result: nil) edge_value = RESIZE_EDGES.fetch(edge.to_s, edge.to_s) invoke_window( "start_resizing", args: { "edge" => edge_value }, timeout: timeout, on_result: on_result ) end |