Class: Plushie::Event::Window

Inherits:
Data
  • Object
show all
Defined in:
lib/plushie/event.rb

Overview

Window lifecycle events (open, close, resize, move, focus, etc.). Triggered by window manager actions or user interaction with window chrome. Subscribe via Subscription.on_window_close, on_window_open, on_window_resize, etc.

Examples:

Window close requested

in Event::Window[type: :close_requested, window_id:]

Window resized

in Event::Window[type: :resized, width:, height:]

Display scale changed

in Event::Window[type: :rescaled, scale_factor:]

File drop cancelled (cursor left the window while hovering)

in Event::Window[type: :files_hovered_left, window_id:]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, window_id: nil, x: nil, y: nil, width: nil, height: nil, scale_factor: nil, path: nil) ⇒ Window

Returns a new instance of Window.



165
166
167
168
# File 'lib/plushie/event.rb', line 165

def initialize(type:, window_id: nil, x: nil, y: nil,
  width: nil, height: nil, scale_factor: nil, path: nil)
  super
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height

Returns:

  • (Object)

    the current value of height



163
164
165
# File 'lib/plushie/event.rb', line 163

def height
  @height
end

#height [Float, nil] window height (for :resized, :opened)([Float, nil]() ⇒ Object (readonly)

Window lifecycle events (open, close, resize, move, focus, etc.). Triggered by window manager actions or user interaction with window chrome. Subscribe via Subscription.on_window_close, on_window_open, on_window_resize, etc.

Examples:

Window close requested

in Event::Window[type: :close_requested, window_id:]

Window resized

in Event::Window[type: :resized, width:, height:]

Display scale changed

in Event::Window[type: :rescaled, scale_factor:]

File drop cancelled (cursor left the window while hovering)

in Event::Window[type: :files_hovered_left, window_id:]


163
164
165
166
167
168
169
# File 'lib/plushie/event.rb', line 163

Window = Data.define(:type, :window_id, :x, :y, :width, :height,
  :scale_factor, :path) do
  def initialize(type:, window_id: nil, x: nil, y: nil,
    width: nil, height: nil, scale_factor: nil, path: nil)
    super
  end
end

#pathObject (readonly)

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



163
164
165
# File 'lib/plushie/event.rb', line 163

def path
  @path
end

#path [String, nil] file path (for :file_dropped, :file_hovered)([String, nil]() ⇒ Object (readonly)

Window lifecycle events (open, close, resize, move, focus, etc.). Triggered by window manager actions or user interaction with window chrome. Subscribe via Subscription.on_window_close, on_window_open, on_window_resize, etc.

Examples:

Window close requested

in Event::Window[type: :close_requested, window_id:]

Window resized

in Event::Window[type: :resized, width:, height:]

Display scale changed

in Event::Window[type: :rescaled, scale_factor:]

File drop cancelled (cursor left the window while hovering)

in Event::Window[type: :files_hovered_left, window_id:]


163
164
165
166
167
168
169
# File 'lib/plushie/event.rb', line 163

Window = Data.define(:type, :window_id, :x, :y, :width, :height,
  :scale_factor, :path) do
  def initialize(type:, window_id: nil, x: nil, y: nil,
    width: nil, height: nil, scale_factor: nil, path: nil)
    super
  end
end

#scale_factorObject (readonly)

Returns the value of attribute scale_factor

Returns:

  • (Object)

    the current value of scale_factor



163
164
165
# File 'lib/plushie/event.rb', line 163

def scale_factor
  @scale_factor
end

#scale_factor [Float, nil] display scale factor (for :rescaled)([Float, nil]() ⇒ Object (readonly)

Window lifecycle events (open, close, resize, move, focus, etc.). Triggered by window manager actions or user interaction with window chrome. Subscribe via Subscription.on_window_close, on_window_open, on_window_resize, etc.

Examples:

Window close requested

in Event::Window[type: :close_requested, window_id:]

Window resized

in Event::Window[type: :resized, width:, height:]

Display scale changed

in Event::Window[type: :rescaled, scale_factor:]

File drop cancelled (cursor left the window while hovering)

in Event::Window[type: :files_hovered_left, window_id:]


163
164
165
166
167
168
169
# File 'lib/plushie/event.rb', line 163

Window = Data.define(:type, :window_id, :x, :y, :width, :height,
  :scale_factor, :path) do
  def initialize(type:, window_id: nil, x: nil, y: nil,
    width: nil, height: nil, scale_factor: nil, path: nil)
    super
  end
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



163
164
165
# File 'lib/plushie/event.rb', line 163

def type
  @type
end

#type [Symbol] :opened, :close_requested, :closed,([Symbol], : close_requested, : closed) ⇒ Object (readonly)

:resized, :rescaled, :moved, :focused, :unfocused, :file_dropped, :file_hovered, :files_hovered_left



163
164
165
166
167
168
169
# File 'lib/plushie/event.rb', line 163

Window = Data.define(:type, :window_id, :x, :y, :width, :height,
  :scale_factor, :path) do
  def initialize(type:, window_id: nil, x: nil, y: nil,
    width: nil, height: nil, scale_factor: nil, path: nil)
    super
  end
end

#widthObject (readonly)

Returns the value of attribute width

Returns:

  • (Object)

    the current value of width



163
164
165
# File 'lib/plushie/event.rb', line 163

def width
  @width
end

#width [Float, nil] window width (for :resized, :opened)([Float, nil]() ⇒ Object (readonly)

Window lifecycle events (open, close, resize, move, focus, etc.). Triggered by window manager actions or user interaction with window chrome. Subscribe via Subscription.on_window_close, on_window_open, on_window_resize, etc.

Examples:

Window close requested

in Event::Window[type: :close_requested, window_id:]

Window resized

in Event::Window[type: :resized, width:, height:]

Display scale changed

in Event::Window[type: :rescaled, scale_factor:]

File drop cancelled (cursor left the window while hovering)

in Event::Window[type: :files_hovered_left, window_id:]


163
164
165
166
167
168
169
# File 'lib/plushie/event.rb', line 163

Window = Data.define(:type, :window_id, :x, :y, :width, :height,
  :scale_factor, :path) do
  def initialize(type:, window_id: nil, x: nil, y: nil,
    width: nil, height: nil, scale_factor: nil, path: nil)
    super
  end
end

#window_idObject (readonly)

Returns the value of attribute window_id

Returns:

  • (Object)

    the current value of window_id



163
164
165
# File 'lib/plushie/event.rb', line 163

def window_id
  @window_id
end

#window_id [String, nil] ID of the affected window([String, nil]) ⇒ Object (readonly)

Window lifecycle events (open, close, resize, move, focus, etc.). Triggered by window manager actions or user interaction with window chrome. Subscribe via Subscription.on_window_close, on_window_open, on_window_resize, etc.

Examples:

Window close requested

in Event::Window[type: :close_requested, window_id:]

Window resized

in Event::Window[type: :resized, width:, height:]

Display scale changed

in Event::Window[type: :rescaled, scale_factor:]

File drop cancelled (cursor left the window while hovering)

in Event::Window[type: :files_hovered_left, window_id:]


163
164
165
166
167
168
169
# File 'lib/plushie/event.rb', line 163

Window = Data.define(:type, :window_id, :x, :y, :width, :height,
  :scale_factor, :path) do
  def initialize(type:, window_id: nil, x: nil, y: nil,
    width: nil, height: nil, scale_factor: nil, path: nil)
    super
  end
end

#xObject (readonly)

Returns the value of attribute x

Returns:

  • (Object)

    the current value of x



163
164
165
# File 'lib/plushie/event.rb', line 163

def x
  @x
end

#x [Float, nil] window x position (for :moved)([Float, nil]() ⇒ Object (readonly)

Window lifecycle events (open, close, resize, move, focus, etc.). Triggered by window manager actions or user interaction with window chrome. Subscribe via Subscription.on_window_close, on_window_open, on_window_resize, etc.

Examples:

Window close requested

in Event::Window[type: :close_requested, window_id:]

Window resized

in Event::Window[type: :resized, width:, height:]

Display scale changed

in Event::Window[type: :rescaled, scale_factor:]

File drop cancelled (cursor left the window while hovering)

in Event::Window[type: :files_hovered_left, window_id:]


163
164
165
166
167
168
169
# File 'lib/plushie/event.rb', line 163

Window = Data.define(:type, :window_id, :x, :y, :width, :height,
  :scale_factor, :path) do
  def initialize(type:, window_id: nil, x: nil, y: nil,
    width: nil, height: nil, scale_factor: nil, path: nil)
    super
  end
end

#yObject (readonly)

Returns the value of attribute y

Returns:

  • (Object)

    the current value of y



163
164
165
# File 'lib/plushie/event.rb', line 163

def y
  @y
end

#y [Float, nil] window y position (for :moved)([Float, nil]() ⇒ Object (readonly)

Window lifecycle events (open, close, resize, move, focus, etc.). Triggered by window manager actions or user interaction with window chrome. Subscribe via Subscription.on_window_close, on_window_open, on_window_resize, etc.

Examples:

Window close requested

in Event::Window[type: :close_requested, window_id:]

Window resized

in Event::Window[type: :resized, width:, height:]

Display scale changed

in Event::Window[type: :rescaled, scale_factor:]

File drop cancelled (cursor left the window while hovering)

in Event::Window[type: :files_hovered_left, window_id:]


163
164
165
166
167
168
169
# File 'lib/plushie/event.rb', line 163

Window = Data.define(:type, :window_id, :x, :y, :width, :height,
  :scale_factor, :path) do
  def initialize(type:, window_id: nil, x: nil, y: nil,
    width: nil, height: nil, scale_factor: nil, path: nil)
    super
  end
end