class

Term2::MouseEvent

Inherits Term2::Message < Reference < Object

MouseEvent represents a mouse action in the terminal.

Mouse events are sent when mouse tracking is enabled via ProgramOptions#with_mouse_all_motion or similar options.

def update(model : MyModel, msg : Term2::Message) : {MyModel, Term2::Cmd?}
  case msg
  when Term2::MouseEvent
    puts "Mouse #{msg.action} at #{msg.x}, #{msg.y}"
    puts "Button: #{msg.button}"
    puts "Modifiers: ctrl=#{msg.ctrl?}, alt=#{msg.alt?}, shift=#{msg.shift?}"
  end
  {model, nil}
end

Constructors

new(x : Int32, y : Int32, button : Button, action : Action, alt : Bool = false, ctrl : Bool = false, shift : Bool = false)
Source

Instance methods

==(other : self)

Returns true if this reference is the same as other. Invokes same?.

Source
action

What action occurred

Source
alt?

Whether Alt was held

Source
button

Which button is involved

Source
ctrl?

Whether Ctrl was held

Source
shift?

Whether Shift was held

Source
to_s

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.

Source
x

X coordinate (0-based, from left)

Source
y

Y coordinate (0-based, from top)

Source

Nested types