Class: Plushie::Widget::Window
- Inherits:
-
Object
- Object
- Plushie::Widget::Window
- Defined in:
- lib/plushie/widget/window.rb
Overview
Constant Summary collapse
- PROPS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Supported property keys for this widget.
i[title size width height position min_size max_size maximized fullscreen visible resizable closeable minimizable decorations transparent blur level exit_on_close_request].freeze
Instance Attribute Summary collapse
-
#blur ⇒ Object
readonly
Returns the value of attribute blur.
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#closeable ⇒ Object
readonly
Returns the value of attribute closeable.
-
#decorations ⇒ Object
readonly
Returns the value of attribute decorations.
-
#exit_on_close_request ⇒ Object
readonly
Returns the value of attribute exit_on_close_request.
-
#fullscreen ⇒ Object
readonly
Returns the value of attribute fullscreen.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#max_size ⇒ Object
readonly
Returns the value of attribute max_size.
-
#maximized ⇒ Object
readonly
Returns the value of attribute maximized.
-
#min_size ⇒ Object
readonly
Returns the value of attribute min_size.
-
#minimizable ⇒ Object
readonly
Returns the value of attribute minimizable.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#resizable ⇒ Object
readonly
Returns the value of attribute resizable.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#transparent ⇒ Object
readonly
Returns the value of attribute transparent.
-
#visible ⇒ Object
readonly
Returns the value of attribute visible.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
-
#build ⇒ Plushie::Node
Build a Node from the current property values.
-
#initialize(id, **opts) ⇒ Window
constructor
A new instance of Window.
-
#push(child) ⇒ self
Return a copy with the given child appended.
Constructor Details
#initialize(id, **opts) ⇒ Window
Returns a new instance of Window.
20 21 22 23 24 |
# File 'lib/plushie/widget/window.rb', line 20 def initialize(id, **opts) @id = id.to_s @children = opts.delete(:children) || [] PROPS.each { |k| instance_variable_set(:"@#{k}", opts[k]) if opts.key?(k) } end |
Instance Attribute Details
#blur ⇒ Object (readonly)
Returns the value of attribute blur.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def blur @blur end |
#children ⇒ Object (readonly)
Returns the value of attribute children.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def children @children end |
#closeable ⇒ Object (readonly)
Returns the value of attribute closeable.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def closeable @closeable end |
#decorations ⇒ Object (readonly)
Returns the value of attribute decorations.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def decorations @decorations end |
#exit_on_close_request ⇒ Object (readonly)
Returns the value of attribute exit_on_close_request.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def exit_on_close_request @exit_on_close_request end |
#fullscreen ⇒ Object (readonly)
Returns the value of attribute fullscreen.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def fullscreen @fullscreen end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def height @height end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def id @id end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def level @level end |
#max_size ⇒ Object (readonly)
Returns the value of attribute max_size.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def max_size @max_size end |
#maximized ⇒ Object (readonly)
Returns the value of attribute maximized.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def maximized @maximized end |
#min_size ⇒ Object (readonly)
Returns the value of attribute min_size.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def min_size @min_size end |
#minimizable ⇒ Object (readonly)
Returns the value of attribute minimizable.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def minimizable @minimizable end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def position @position end |
#resizable ⇒ Object (readonly)
Returns the value of attribute resizable.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def resizable @resizable end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def size @size end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def title @title end |
#transparent ⇒ Object (readonly)
Returns the value of attribute transparent.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def transparent @transparent end |
#visible ⇒ Object (readonly)
Returns the value of attribute visible.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def visible @visible end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
1 2 3 |
# File 'lib/plushie/widget/window.rb', line 1 def width @width end |
Instance Method Details
#build ⇒ Plushie::Node
Build a Node from the current property values.
43 44 45 46 47 48 49 50 51 |
# File 'lib/plushie/widget/window.rb', line 43 def build props = {} PROPS.each do |key| val = instance_variable_get(:"@#{key}") Build.put_if(props, key, val) end Node.new(id: @id, type: "window", props: props, children: Build.children_to_nodes(@children)) end |
#push(child) ⇒ self
Return a copy with the given child appended.
36 37 38 |
# File 'lib/plushie/widget/window.rb', line 36 def push(child) dup.tap { _1.instance_variable_set(:@children, @children + [child]) } end |