FTXUI  5.0.0
C++ functional terminal UI.
Mouse Struct Reference

A mouse event. It contains the coordinate of the mouse, the button pressed and the modifier (shift, ctrl, meta). More...

Public Types

enum  Button {
  Left = 0 , Middle = 1 , Right = 2 , None = 3 ,
  WheelUp = 4 , WheelDown = 5
}
 
enum  Motion { Released = 0 , Pressed = 1 }
 

Public Member Functions

bool IsPressed (Button btn=Left) const
 
bool IsHeld (Button btn=Left) const
 
bool IsReleased (Button btn=Left) const
 

Data Fields

Button button = Button::None
 
Motion motion = Motion::Pressed
 
bool shift = false
 
bool meta = false
 
bool control = false
 
int x = 0
 
int y = 0
 
Mouseprevious = nullptr
 

Detailed Description

A mouse event. It contains the coordinate of the mouse, the button pressed and the modifier (shift, ctrl, meta).

Definition at line 11 of file mouse.hpp.

Member Enumeration Documentation

◆ Button

enum Button
Enumerator
Left 
Middle 
Right 
None 
WheelUp 
WheelDown 

Definition at line 12 of file mouse.hpp.

◆ Motion

enum Motion
Enumerator
Released 
Pressed 

Definition at line 21 of file mouse.hpp.

Member Function Documentation

◆ IsPressed()

bool IsPressed ( Button  btn = Left) const

Return whether the mouse transitionned from released to pressed. This is useful to detect a click.

  • btn The button to check.

Definition at line 18 of file mouse.cpp.

◆ IsHeld()

bool IsHeld ( Button  btn = Left) const

Return whether the mouse is currently held. This is useful to detect a drag.

  • btn The button to check.

Definition at line 25 of file mouse.cpp.

◆ IsReleased()

bool IsReleased ( Button  btn = Left) const

Return whether the mouse transitionned from pressed to released. This is useful to detect a click.

  • btn The button to check.

Definition at line 32 of file mouse.cpp.

Field Documentation

◆ button

Button button = Button::None
Examples
examples/component/print_key_press.cpp.

Definition at line 32 of file mouse.hpp.

◆ motion

Motion motion = Motion::Pressed
Examples
examples/component/print_key_press.cpp.

Definition at line 35 of file mouse.hpp.

◆ shift

bool shift = false
Examples
examples/component/print_key_press.cpp.

Definition at line 38 of file mouse.hpp.

◆ meta

bool meta = false
Examples
examples/component/print_key_press.cpp.

Definition at line 39 of file mouse.hpp.

◆ control

bool control = false
Examples
examples/component/print_key_press.cpp.

Definition at line 40 of file mouse.hpp.

◆ x

int x = 0
Examples
examples/component/print_key_press.cpp.

Definition at line 43 of file mouse.hpp.

◆ y

int y = 0
Examples
examples/component/print_key_press.cpp.

Definition at line 44 of file mouse.hpp.

◆ previous

Mouse* previous = nullptr

Definition at line 47 of file mouse.hpp.


The documentation for this struct was generated from the following files: