cgv
cgv::gui Namespace Reference

namespace that holds the abstract gui interface More...

Classes

class  abst_control
 gui and type independent base class of all controls More...
 
struct  abst_control_provider
 type independent base class of control provider interface More...
 
class  abst_view
 type independent &base class of all views More...
 
class  application
 the application class is only a container for static methods that give access to the windows of the application More...
 
class  button
 gui independent button class that provides a click signal More...
 
class  choice_event
 class to represent choice events that include focus change and selection change events More...
 
class  control
 
struct  control_provider
 
class  dialog
 
class  event
 
class  event_handler
 interface for all classes that want to receive events More...
 
class  gamepad_key_event
 gamepad key events use the key codes defined in gamepad::GamepadKeys More...
 
class  gamepad_stick_event
 gamepad extension of stick events More...
 
class  gamepad_throttle_event
 gamepad extension of throttle events More...
 
struct  gui_creator
 interface for gui creators More...
 
class  gui_creator_registration
 helper template for registration of gui creators More...
 
class  gui_driver
 abstract base class for gui drivers More...
 
class  gui_group
 gui independent group class which is a container for gui elements More...
 
class  key_event
 class to represent all possible keyboard events with the EID_KEY More...
 
class  menu_provider
 derive from this class to provide a gui to the current viewer More...
 
struct  monitor_description
 monitor description More...
 
class  mouse_event
 class to represent all possible mouse events with the EID_MOUSE More...
 
class  pose_event
 class to represent all pose events from tracking systems with the EID_POSE More...
 
class  provider
 derive from this class to provide a gui to the current viewer More...
 
class  shortcut
 the shortcut class encapsulates a key with modifiers More...
 
class  stick_event
 class to represent stick events with the EID_STICK More...
 
class  text_editor
 abstract base class for text editors More...
 
struct  text_editor_callback_handler
 
struct  text_style
 
class  throttle_event
 class to represent events that inform on a change in a one axis controller with the EID_THROTTLE More...
 
class  trigger
 a trigger provides callbacks after a programmable time delay More...
 
class  view
 class for gui elements that view values of the type specified in the template argument More...
 
class  vr_calibration
 vr key events use the key codes defined in vr::VRKeys More...
 
class  vr_key_event
 vr key events use the key codes defined in vr::VRKeys More...
 
class  vr_pose_event
 vr extension of pose events More...
 
class  vr_server
 server for vr events More...
 
class  vr_stick_event
 vr extension of stick event More...
 
class  vr_throttle_event
 vr extension of throttle event More...
 
class  window
 gui independent window class More...
 
struct  with_index_struct
 helper struct to support value references as well as value references with index More...
 

Typedefs

typedef data::ref_ptr< buttonbutton_ptr
 ref counted pointer to button
 
typedef data::ref_ptr< abst_controlcontrol_ptr
 ref counted pointer to abst control
 
typedef data::ref_ptr< gui_drivergui_driver_ptr
 ref counted pointer to driver
 
typedef data::ref_ptr< gui_group, true > gui_group_ptr
 ref counted pointer to a gui group
 
typedef data::ref_ptr< const gui_group, true > const_gui_group_ptr
 ref counted pointer to const gui group
 
typedef cgv::data::ref_ptr< layout > layout_ptr
 ref counted pointer to layout
 
typedef cgv::data::ref_ptr< layout_inline > layout_inline_ptr
 ref counted pointer to table layout
 
typedef cgv::data::ref_ptr< layout_table > layout_table_ptr
 ref counted pointer to table layout
 
typedef data::ref_ptr< text_editortext_editor_ptr
 ref counted pointer to abst control
 
typedef data::ref_ptr< trigger_server > trigger_server_ptr
 ref counted pointer to trigger server
 
typedef data::ref_ptr< abst_viewview_ptr
 ref counted pointer to abst view
 
typedef data::ref_ptr< windowwindow_ptr
 ref counted pointer to &window
 
typedef data::ref_ptr< const windowconst_window_ptr
 ref counted pointer to const window
 

Enumerations

enum  VREventTypeFlags {
  VRE_NONE = 0, VRE_DEVICE = 1, VRE_STATUS = 2, VRE_KEY = 4,
  VRE_ONE_AXIS = 8, VRE_TWO_AXES = 16, VRE_ONE_AXIS_GENERATES_KEY =32, VRE_TWO_AXES_GENERATES_DPAD = 64,
  VRE_POSE = 128, VRE_ALL = 255
}
 flags to define which events should be generated by server More...
 
enum  VRFocus
 different types of event focus grabbing
 
enum  ChoiceEventType
 different choice event types
 
enum  EventId {
  EID_NONE, EID_KEY, EID_MOUSE, EID_THROTTLE,
  EID_STICK, EID_POSE, EID_CHOICE, EID_APPROACH,
  EID_ACTION, EID_LIFETIME
}
 define the ids of the most common events More...
 
enum  EventFlags { ,
  EF_MULTI = 1, EF_DND = 2, EF_PAD = 4, EF_VR = 8,
  EF_NUI = 16
}
 flags More...
 
enum  EventModifier { EM_SHIFT = 1, EM_ALT = 2, EM_CTRL = 4, EM_META = 8 }
 define constants for event modifiers More...
 
enum  EventToggleKeys { ETK_CAPS_LOCK = 1, ETK_NUM_LOCK = 2, ETK_SCROLL_LOCK = 4 }
 define constants for toggle keys More...
 
enum  KeyAction { KA_RELEASE, KA_PRESS, KA_REPEAT }
 different actions that a key can perform More...
 
enum  layout_hint
 
enum  MouseAction {
  MA_PRESS, MA_RELEASE, MA_WHEEL, MA_MOVE,
  MA_DRAG, MA_ENTER, MA_LEAVE
}
 different actions that a mouse can perform More...
 
enum  MouseButton { MB_NO_BUTTON = 0, MB_LEFT_BUTTON = 1, MB_MIDDLE_BUTTON = 2, MB_RIGHT_BUTTON = 4 }
 different mouse buttons that can be ored together to specify the button state More...
 
enum  Keys {
  KEY_F1 = 256, KEY_F2, KEY_F3, KEY_F4,
  KEY_F5, KEY_F6, KEY_F7, KEY_F8,
  KEY_F9, KEY_F10, KEY_F11, KEY_F12,
  KEY_Space, KEY_Enter, KEY_Tab, KEY_Print,
  KEY_Pause, KEY_Break, KEY_Escape, KEY_Left_Shift,
  KEY_Right_Shift, KEY_Left_Alt, KEY_Right_Alt, KEY_Left_Ctrl,
  KEY_Right_Ctrl, KEY_Left_Meta, KEY_Right_Meta, KEY_Left,
  KEY_Right, KEY_Up, KEY_Down, KEY_Home,
  KEY_End, KEY_Page_Up, KEY_Page_Down, KEY_Back_Space,
  KEY_Delete, KEY_Insert, KEY_Caps_Lock, KEY_Num_Lock,
  KEY_Scroll_Lock, KEY_Num_0, KEY_Num_1, KEY_Num_2,
  KEY_Num_3, KEY_Num_4, KEY_Num_5, KEY_Num_6,
  KEY_Num_7, KEY_Num_8, KEY_Num_9, KEY_Num_Div,
  KEY_Num_Mul, KEY_Num_Sub, KEY_Num_Add, KEY_Num_Dot,
  KEY_Num_Enter
}
 define the names of special keys More...
 
enum  StickAction {
  SA_TOUCH, SA_PRESS, SA_UNPRESS, SA_RELEASE,
  SA_MOVE, SA_DRAG
}
 different actions that a stick can perform More...
 
enum  GamepadEventTypeFlags
 flags to define which events should be generated by server
 

Functions

vr_calibrationref_vr_calibration ()
 access to singleton object of vr_calibration class More...
 
vr_serverref_vr_server ()
 return a reference to gamepad server singleton More...
 
void connect_vr_server (bool connect_device_change_only_to_animation_trigger, cgv::gui::window_ptr w)
 connect the gamepad server to the given window or the first window of the application, if window is not provided More...
 
std::string get_choice_type_string (ChoiceEventType type)
 convert a choice event type into a readable string
 
void message (const std::string &_message)
 tell the user something with a message box
 
int question (const std::string &_question, const std::vector< std::string > &answers, int default_answer)
 ask the user with question to select one of the answers, where default_answer specifies index of default answer
 
int question (const std::string &_question, const std::string &answers, int default_answer)
 second question interface, where answers is a comma seprated list of enum declaration
 
bool query (const std::string &question, std::string &text, bool password=false)
 query the user for a text, where the second parameter is the default text as well as the returned text. More...
 
std::string get_modifier_string (EventModifier modifiers)
 convert a modifier combination into a readable string ending on a '+' sign if not empty, i.e. "Shift+Ctrl+"
 
std::string get_toggle_keys_string (EventToggleKeys toggle_keys)
 convert a toggle key combination into a readable string separated by '+' signs, i.e. "CapsLock+NumLock"
 
unsigned char stream_in_modifiers (std::istream &is)
 read modifiers in string format from a stream and set the passed reference to EventModifier s ored together.
 
unsigned char & ref_current_modifiers ()
 read out the current modifiers
 
CGV_API void stream_in_toggle_keys (std::istream &is, unsigned char &toggle_keys)
 read toggle keys in string format from a stream and set the passed reference to EventToggleKeys ored together.
 
std::string file_open_dialog (const std::string &title, const std::string &filter, const std::string &path)
 
std::string directory_open_dialog (const std::string &title, const std::string &path)
 
std::string directory_save_dialog (const std::string &title, const std::string &path)
 
std::string files_open_dialog (std::vector< std::string > &file_names, const std::string &title, const std::string &filter, const std::string &path)
 ask user for an open dialog that can select multiple files, return common path prefix and fill field of filenames
 
std::string file_save_dialog (const std::string &title, const std::string &filter, const std::string &path)
 
void register_gui_creator (gui_creator *gc, const char *creator_name)
 register a gui creator
 
bool create_gui (provider *p, const std::string &label, void *value_ptr, const std::string &value_type, const std::string &gui_type, const std::string &options, bool *toggles)
 create the gui for a composed structure
 
gui_driver_ptr get_gui_driver ()
 return the currently registered gui driver or an empty pointer if non has been registered
 
void register_gui_driver (gui_driver_ptr _driver)
 register a new gui driver. More...
 
cgv::signal::signal< gui_driver_ptr > & on_gui_driver_registration ()
 a signal that is emitted when a gui driver is registered
 
std::string get_key_action_string (KeyAction action)
 convert a key action into a readable string
 
template<typename T >
with_index_struct< T > with_index (const T &_value, int _index)
 helper function to support value references as well as value references with index for the tree_node functions of cgv::gui::provider
 
std::string get_key_string (unsigned short key)
 convert a key code into a readable string
 
std::ostream & operator<< (std::ostream &os, const shortcut &sc)
 stream a shortcut as text to an output stream
 
std::istream & operator>> (std::istream &is, shortcut &sc)
 stream in a shortcut from an input stream
 
std::string get_stick_action_string (StickAction action)
 convert a key action into a readable string More...
 
text_editor_ptr create_text_editor (unsigned int w, unsigned int h, const std::string &title, int x, int y)
 construct a new text editor in a separate window of given size, title and position More...
 
triggerget_animation_trigger ()
 return the global trigger used for animation, which runs by default with 60 Hz
 
trigger_server_ptr get_trigger_server ()
 returns the currently registered trigger server
 
void register_trigger_server (trigger_server_ptr)
 registeres a new trigger server, call this in the on_register method of the server implementation
 
gamepad_server & ref_gamepad_server ()
 return a reference to gamepad server singleton
 
void connect_gamepad_server (cgv::gui::window_ptr w)
 connect the gamepad server to the given window or the first window of the application, if window is not provided
 

Detailed Description

namespace that holds the abstract gui interface

Enumeration Type Documentation

◆ EventFlags

flags

Enumerator
EF_MULTI 

whether event is tagged with id of the device that generated the event

EF_DND 

whether mouse has a drag and drop target attached

EF_PAD 

whether event is from gamepad

EF_VR 

whether event is from VR kit

EF_NUI 

whether event is nature user interface event

◆ EventId

define the ids of the most common events

Enumerator
EID_NONE 

undefined event id

EID_KEY 

id for key event

EID_MOUSE 

id for mouse event

EID_THROTTLE 

id of throttle event describing a one axis controller

EID_STICK 

id of a stick event describing a two axis controller that optionally can be touched and pressed

EID_POSE 

id for a 6D pose change events

EID_CHOICE 

id for focus or selection change events

EID_APPROACH 

id for nui approach events

EID_ACTION 

id for nui action events

EID_LIFETIME 

id for nui life time

◆ EventModifier

define constants for event modifiers

Enumerator
EM_SHIFT 

shift modifier

EM_ALT 

alt modifier

EM_CTRL 

ctrl modifier

EM_META 

meta modifier (windows or mac key)

◆ EventToggleKeys

define constants for toggle keys

Enumerator
ETK_CAPS_LOCK 

caps lock

ETK_NUM_LOCK 

num lock

ETK_SCROLL_LOCK 

scroll lock

◆ KeyAction

different actions that a key can perform

Enumerator
KA_RELEASE 

key release action

KA_PRESS 

key press action

KA_REPEAT 

key repeated press action

◆ Keys

define the names of special keys

Enumerator
KEY_F1 

F1 key.

KEY_F2 

F2 key.

KEY_F3 

F3 key.

KEY_F4 

F4 key.

KEY_F5 

F5 key.

KEY_F6 

F6 key.

KEY_F7 

F7 key.

KEY_F8 

F8 key.

KEY_F9 

F9 key.

KEY_F10 

F10 key.

KEY_F11 

F11 key.

KEY_F12 

F12 key.

KEY_Space 

space key

KEY_Enter 

enter key

KEY_Tab 

tab key

KEY_Print 

print key

KEY_Pause 

pause key

KEY_Break 

break key

KEY_Escape 

escape key

KEY_Left_Shift 

left shift key

KEY_Right_Shift 

right shift key

KEY_Left_Alt 

left alt key

KEY_Right_Alt 

right alt key

KEY_Left_Ctrl 

left ctrl key

KEY_Right_Ctrl 

right ctrl key

KEY_Left_Meta 

left meta key

KEY_Right_Meta 

right meta key

KEY_Left 

left arrow key

KEY_Right 

right arrow key

KEY_Up 

up arrow key

KEY_Down 

down arrow key

KEY_Home 

home key

KEY_End 

end key

KEY_Page_Up 

page up key

KEY_Page_Down 

page down key

KEY_Back_Space 

back space key

KEY_Delete 

delete key

KEY_Insert 

insert key

KEY_Caps_Lock 

caps lock key

KEY_Num_Lock 

num lock key

KEY_Scroll_Lock 

scroll lock key

KEY_Num_0 

num pad key 0

KEY_Num_1 

num pad key 1

KEY_Num_2 

num pad key 2

KEY_Num_3 

num pad key 3

KEY_Num_4 

num pad key 4

KEY_Num_5 

num pad key 5

KEY_Num_6 

num pad key 6

KEY_Num_7 

num pad key 7

KEY_Num_8 

num pad key 8

KEY_Num_9 

num pad key 9

KEY_Num_Div 

num pad key /

KEY_Num_Mul 

num pad key *

KEY_Num_Sub 

num pad key -

KEY_Num_Add 

num pad key +

KEY_Num_Dot 

num pad key .

KEY_Num_Enter 

num pad enter key

◆ layout_hint

Allowed hints: s - horizontal shrink S - vertical shrink x - horizontal expand X - vertical expand f - horizontal fill F - vertical fill l - align left r - align right c - align centered t - align top b - align bottom m - align middle (between top and bottom)

◆ MouseAction

different actions that a mouse can perform

Enumerator
MA_PRESS 

mouse button pressed

MA_RELEASE 

mouse button released

MA_WHEEL 

mouse wheel moved

MA_MOVE 

mouse pointer moved

MA_DRAG 

mouse drag action

MA_ENTER 

mouse enter window action

MA_LEAVE 

mouse leave window action

◆ MouseButton

different mouse buttons that can be ored together to specify the button state

Enumerator
MB_NO_BUTTON 

no button

MB_LEFT_BUTTON 

left button

MB_MIDDLE_BUTTON 

middle button

MB_RIGHT_BUTTON 

right button

◆ StickAction

different actions that a stick can perform

Enumerator
SA_TOUCH 

stick touch action

SA_PRESS 

stick press action

SA_UNPRESS 

stick unpress repeated press action

SA_RELEASE 

stick release action

SA_MOVE 

stick moved with respect to last event

SA_DRAG 

stick moved in pressed state

◆ VREventTypeFlags

flags to define which events should be generated by server

Enumerator
VRE_NONE 

no events

VRE_DEVICE 

device change events

VRE_STATUS 

status change events

VRE_KEY 

key events

VRE_ONE_AXIS 

trigger / throttle / pedal events

VRE_TWO_AXES 

pad / stick events

VRE_ONE_AXIS_GENERATES_KEY 

whether one axis events should generate a key event when passing inputs threshold value

VRE_TWO_AXES_GENERATES_DPAD 

whether two axes input generates direction pad keys when presses

VRE_POSE 

pose events

VRE_ALL 

all event types

Function Documentation

◆ connect_vr_server()

CGV_API void cgv::gui::connect_vr_server ( bool  connect_device_change_only_to_animation_trigger,
cgv::gui::window_ptr  w 
)

connect the gamepad server to the given window or the first window of the application, if window is not provided

connect the vr server to the given window or the first window of the application, if window is not provided

◆ create_text_editor()

CGV_API text_editor_ptr cgv::gui::create_text_editor ( unsigned int  w,
unsigned int  h,
const std::string &  title,
int  x,
int  y 
)

construct a new text editor in a separate window of given size, title and position

use the currently registered gui driver to construct a new text editor in a separate window of given size, title and position

◆ directory_open_dialog()

CGV_API std::string cgv::gui::directory_open_dialog ( const std::string &  title,
const std::string &  path 
)

ask the user for an existing directory.

◆ directory_save_dialog()

CGV_API std::string cgv::gui::directory_save_dialog ( const std::string &  title,
const std::string &  path 
)

ask the user for a new directory.

◆ file_open_dialog()

CGV_API std::string cgv::gui::file_open_dialog ( const std::string &  title,
const std::string &  filter,
const std::string &  path = "" 
)

ask the user for a file name to open a file. The filter string is composed of '|'-separated pairs of the form '<text>:<filter>', where <text> is an arbitrary text (without '|' and ':' symbols) shown with the filter and <filter> is one filter string or a ';'-separated list of filters. For example the filter parameter could be set to "Image Files (jpg,gif):*.jpg;*.gif|Video Files (avi):*.avi|All Files:*.*". The path parameter can be used to define an initial directory and or an initial file for the dialog:

  • if path is empty no initial directory not path are selected,
  • if path defines a directory, it is used as initial directory without initial file,
  • if path defines file without directory the initial file is set and the standard directory is used
  • if path defines a directory and file, both initial directory and file are set.

◆ file_save_dialog()

CGV_API std::string cgv::gui::file_save_dialog ( const std::string &  title,
const std::string &  filter,
const std::string &  path = "" 
)

ask the user for a file name to save a file. The filter string uses the syntax defined in the docu of file_open_dialog().

◆ get_stick_action_string()

CGV_API std::string cgv::gui::get_stick_action_string ( StickAction  action)

convert a key action into a readable string

convert a stick action into a readable string

◆ query()

CGV_API bool cgv::gui::query ( const std::string &  question,
std::string &  text,
bool  password = false 
)

query the user for a text, where the second parameter is the default text as well as the returned text.

If password is true, the text is hidden. The function returns false if the user canceled the input of if no gui driver is available.

◆ ref_vr_calibration()

CGV_API vr_calibration & cgv::gui::ref_vr_calibration ( )

access to singleton object of vr_calibration class

allow ref_vr_calibration() function to construct one instance

◆ ref_vr_server()

CGV_API vr_server & cgv::gui::ref_vr_server ( )

return a reference to gamepad server singleton

return a reference to vr server singleton

◆ register_gui_driver()

CGV_API void cgv::gui::register_gui_driver ( gui_driver_ptr  _driver)

register a new gui driver.

This overwrites a previously registered gui driver and should be called in the on_register method of the driver