Shiokaze Framework
A research-oriented fluid solver for computer graphics
UI_interface Class Reference

Interface for input APIs. More...

#include <UI_interface.h>

Inheritance diagram for UI_interface:
camera2_interface camera3_interface drawable

Classes

struct  event_structure
 Event information structure. More...
 

Public Types

enum  ACTION { RELEASE = 0, PRESS = 1, REPEAT = 2 }
 Key and mose action type. More...
 
enum  MODIFIER {
  MOD_SHIFT = 0x0001, MOD_CONTROL = 0x0002, MOD_ALT = 0x0004, MOD_SUPER = 0x0008,
  MOD_CAPS_LOCK = 0x0010, MOD_NUM_LOCK = 0x0020
}
 Modifier bits. More...
 
enum  MOUSE_BUTTON { LEFT = 1, RIGHT = 2, MIDDLE = 3 }
 Mouse button type. More...
 
enum  CURSOR_TYPE {
  ARROW_CURSOR = 0, HAND_CURSOR = 1, IBEAM_CURSOR = 2, CROSSHAIR_CURSOR = 3,
  HRESIZE_CURSOR = 4, VRESIZE_CURSOR = 5
}
 Cursor icon type. More...
 

Public Member Functions

virtual bool handle_event (const event_structure &event)
 
virtual bool relay_event (const event_structure &event) const
 Get if the event shoule be relayed to other instances after handle_event of this instance is called. More...
 
virtual CURSOR_TYPE get_current_cursor () const
 Get current cursor icon. More...
 

Static Public Member Functions

static bool has_graphical_interface ()
 Get if a graphical interface is available. More...
 

Protected Member Functions

virtual void resize (int width, int height)
 Function that catches window resizing events. More...
 
virtual void draw (graphics_engine &g) const
 Function that catches draw event. More...
 
virtual bool keyboard (int key, int action, int mods)
 Function that catches key down event. More...
 
virtual void cursor (double x, double y, double z)
 Function that catches passive cursor event. More...
 
virtual void mouse (double x, double y, double z, int button, int action, int mods)
 Function that catches mouse event. More...
 
virtual void scroll (double xoffset, double yoffset)
 Function that catches scroll event. More...
 
virtual void drag (double x, double y, double z, double u, double v, double w)
 Function that catches drag event. More...
 

Detailed Description

Interface for input APIs.

Member Enumeration Documentation

◆ ACTION

Key and mose action type.

Enumerator
RELEASE 

Release event.

PRESS 

Press event.

REPEAT 

Repeat event.

◆ CURSOR_TYPE

Cursor icon type.

Enumerator
ARROW_CURSOR 

Regular arrow cursor.

HAND_CURSOR 

Hand cursor.

IBEAM_CURSOR 

Text input I beam cursor.

CROSSHAIR_CURSOR 

Cross hair cursor.

HRESIZE_CURSOR 

Horizontal resizing cursor.

VRESIZE_CURSOR 

Vertical resizing cursor.

◆ MODIFIER

Modifier bits.

Enumerator
MOD_SHIFT 

Shift modifier bit.

MOD_CONTROL 

Control modifier bit.

MOD_ALT 

ALT modifier bit.

MOD_SUPER 

SUPER modifier bit.

MOD_CAPS_LOCK 

Capslock modifier bit.

MOD_NUM_LOCK 

NUM lock modifier bit.

◆ MOUSE_BUTTON

Mouse button type.

Enumerator
LEFT 

Left button.

RIGHT 

Right button.

MIDDLE 

Middle button.

Member Function Documentation

◆ cursor()

virtual void UI_interface::cursor ( double  x,
double  y,
double  z 
)
inlineprotectedvirtual

Function that catches passive cursor event.

Parameters
[in]xCursor position on x pixel coordinate.
[in]yCursor position on y pixel coordinate.
[in]zCursor position on y pixel coordinate.

◆ drag()

virtual void UI_interface::drag ( double  x,
double  y,
double  z,
double  u,
double  v,
double  w 
)
inlineprotectedvirtual

Function that catches drag event.

Parameters
[in]xCursor position on x pixel coordinate.
[in]yCursor position on y pixel coordinate.
[in]uDrag vector on x pixel coordinate.
[in]vDrag vector on y pixel coordinate.
[in]wDrag vector on z pixel coordinate.

◆ draw()

virtual void UI_interface::draw ( graphics_engine g) const
inlineprotectedvirtual

Function that catches draw event.

Parameters
[in]gGraphics engine.

◆ get_current_cursor()

virtual CURSOR_TYPE UI_interface::get_current_cursor ( ) const
inlinevirtual

Get current cursor icon.

Returns
Current icon.

Reimplemented in drawable.

◆ handle_event()

virtual bool UI_interface::handle_event ( const event_structure event)
inlinevirtual

Handle an UI input event.

Parameters
[in]Eventinformation.

Reimplemented in drawable.

◆ has_graphical_interface()

static bool UI_interface::has_graphical_interface ( )
inlinestatic

Get if a graphical interface is available.

Parameters
[in]valueBoolean value to set force single thread.

◆ keyboard()

virtual bool UI_interface::keyboard ( int  key,
int  action,
int  mods 
)
inlineprotectedvirtual

Function that catches key down event.

Parameters
[in]keyCapitalized key.
[in]actionAction code.
[in]modsModifier bits.

◆ mouse()

virtual void UI_interface::mouse ( double  x,
double  y,
double  z,
int  button,
int  action,
int  mods 
)
inlineprotectedvirtual

Function that catches mouse event.

Parameters
[in]buttonMouse button number.
[in]actionMouse action (Mouse down = 1 Mouse release = 0)
[in]modsModifier bit.

◆ relay_event()

virtual bool UI_interface::relay_event ( const event_structure event) const
inlinevirtual

Get if the event shoule be relayed to other instances after handle_event of this instance is called.

Parameters
[in]eventCorresponding event.
Returns
t/rue if the event should be relayed to others.

◆ resize()

virtual void UI_interface::resize ( int  width,
int  height 
)
inlineprotectedvirtual

Function that catches window resizing events.

Parameters
[in]widthWidth of the window.
[in]heightHeight of the window.

◆ scroll()

virtual void UI_interface::scroll ( double  xoffset,
double  yoffset 
)
inlineprotectedvirtual

Function that catches scroll event.

Parameters
[in]xoffsetX coordinate offset.
[in]yoffsetY coordinate offset.

The documentation for this class was generated from the following file: