cgv
Loading...
Searching...
No Matches
cgv::gui::gui_driver Class Referenceabstract

abstract base class for gui drivers More...

#include <gui_driver.h>

Inheritance diagram for cgv::gui::gui_driver:
cgv::base::base cgv::base::driver cgv::data::ref_counted cgv::reflect::self_reflection_tag

Public Member Functions

application management
virtual bool enumerate_monitors (std::vector< monitor_description > &monitor_descriptions)
 fill list of monitor descriptions
 
virtual window_ptr create_window (int w, int h, const std::string &title, const std::string &window_type)=0
 create a window of the given type. Currently only the types "viewer with gui", "viewer" and "gui" are supported
 
virtual void remove_window (window_ptr w)=0
 remove a window that has been destroyed
 
virtual void destroy_all_windows ()=0
 destroy every window, releasing all their resources.
 
virtual bool set_focus (const_window_ptr)=0
 set the input focus to the given window
 
virtual unsigned int get_nr_windows ()=0
 return the number of created windows
 
virtual window_ptr get_window (unsigned int i)=0
 return the i-th created window
 
virtual bool run ()=0
 run the main loop of the window system
 
virtual void quit (int exit_code)=0
 quit the application by closing all windows
 
virtual void copy_to_clipboard (const std::string &s)=0
 copy text to the clipboard
 
virtual std::string paste_from_clipboard ()=0
 retreive text from clipboard
 
some basic functionality
virtual void message (const std::string &_message)=0
 show the user a _message that can be dismissed with the answer
 
virtual int question (const std::string &_question, const std::vector< std::string > &answers, int default_answer=-1)=0
 ask the user with _question to select one of the answers, where default_answer specifies index of default answer
 
virtual bool query (const std::string &question, std::string &text, bool password=false)=0
 query the user for a text, where the second parameter is the default text as well as the returned text.
 
virtual text_editor_ptr create_text_editor (unsigned int w, unsigned int h, const std::string &title, int x, int y)=0
 create a text editor
 
virtual std::string files_open_dialog (std::vector< std::string > &file_names, const std::string &title, const std::string &filter, const std::string &path)=0
 ask user for an open dialog that can select multiple files, return common path prefix and fill field of filenames
 
virtual std::string file_open_dialog (const std::string &title, const std::string &filter, const std::string &path)=0
 ask user for a file to open
 
virtual std::string file_save_dialog (const std::string &title, const std::string &filter, const std::string &path)=0
 ask user for a file to save
 
threading based functionality
virtual void lock ()=0
 lock the main thread of the gui from a child thread before any gui specific call.
 
virtual void unlock ()=0
 unlock the main thread
 
virtual void wake (const std::string &message="")=0
 wake main thread.
 
virtual std::string get_wakeup_message ()=0
 return the message send by the thread that woke up the main thread with wake()
 
virtual void sleep (float time_in_seconds)=0
 let the main thread sleep for the given number of seconds
 
gui elements
virtual bool process_gui_file (const std::string &file_name)=0
 process the gui declarations in the given gui file
 
virtual gui_group_ptr add_group (gui_group_ptr parent, const std::string &label, const std::string &group_type, const std::string &options, const std::string &align)=0
 add a new gui group to the given parent group
 
virtual cgv::base::base_ptr add_decorator (gui_group_ptr parent, const std::string &label, const std::string &decorator_type, const std::string &options, const std::string &align)=0
 add a newly created decorator to the parent group
 
virtual button_ptr add_button (gui_group_ptr parent, const std::string &label, const std::string &options, const std::string &align)=0
 add new button to the parent group
 
virtual view_ptr add_view (gui_group_ptr parent, const std::string &label, const void *value_ptr, const std::string &value_type, const std::string &gui_type, const std::string &options, const std::string &align)=0
 add new view to the parent group
 
virtual view_ptr find_view (gui_group_ptr parent, const void *value_ptr, int *idx_ptr)=0
 find a view in the group
 
virtual control_ptr add_control (gui_group_ptr parent, const std::string &label, void *value_ptr, abst_control_provider *acp, const std::string &value_type, const std::string &gui_type, const std::string &options, const std::string &align)=0
 add new control to the parent group
 
virtual control_ptr find_control (gui_group_ptr parent, void *value_ptr, int *idx_ptr)=0
 find a control in a group
 
menu elements
virtual cgv::base::base_ptr add_menu_separator (const std::string &menu_path)=0
 add a newly created decorator to the menu
 
virtual button_ptr add_menu_button (const std::string &menu_path, const std::string &options)=0
 use the current gui driver to append a new button in the menu, where menu path is a '/' separated path
 
virtual data::ref_ptr< control< bool > > add_menu_bool_control (const std::string &menu_path, bool &value, const std::string &options)=0
 use this to add a new control to the gui with a given value type, gui type and init options
 
virtual cgv::base::base_ptr find_menu_element (const std::string &menu_path) const =0
 return the element of the given menu path
 
virtual void remove_menu_element (cgv::base::base_ptr)=0
 remove a single element from the gui
 
- Public Member Functions inherited from cgv::base::base
virtual std::string get_type_name () const
 overload to return the type name of this object. By default the type interface is queried over get_type.
 
virtual std::string get_default_options () const
 overload to provide default options for registration
 
std::string get_name_or_type_name () const
 determine name of instance by checking cgv::base::named interface and in failure fallback to get_type_name()
 
virtual void on_register ()
 overload to handle register events that is sent after the instance has been registered
 
virtual void unregister ()
 overload to handle unregistration of instances
 
virtual bool on_exit_request ()
 overload to handle the appication exit request, return true if exiting is allowed and false otherwise
 
virtual void stream_stats (std::ostream &)
 overload to show the content of this object
 
virtual data::ref_ptr< named, trueget_named ()
 perform downcast to named
 
virtual data::ref_ptr< node, trueget_node ()
 perform downcast to node
 
virtual data::ref_ptr< group, trueget_group ()
 perform downcast to group
 
virtual data::ref_ptr< const named, trueget_named_const () const
 perform downcast to const named
 
virtual data::ref_ptr< const node, trueget_node_const () const
 perform downcast to const node
 
virtual data::ref_ptr< const group, trueget_group_const () const
 perform downcast to const group
 
template<class T >
data::ref_ptr< T, truecast ()
 cast to arbitrary class, but use the casts to named, node and group from the interface
 
template<class T >
data::ref_ptr< const T, truecast_const ()
 const cast to arbitrary class, but use the casts to named, node and group from the interface
 
template<class T >
Tget_interface ()
 use dynamic type cast to check for the given interface
 
template<class T >
const Tget_const_interface () const
 use dynamic type cast to check for the given interface
 
virtual void update ()
 this virtual update allows for example to ask a view to update the viewed value. The default implementation is empty.
 
virtual voidget_user_data () const
 this virtual method allows to pass application specific data for internal purposes
 
virtual bool self_reflect (cgv::reflect::reflection_handler &)
 used for simple self reflection
 
virtual std::string get_property_declarations ()
 return a semicolon separated list of property declarations
 
virtual bool set_void (const std::string &property, const std::string &value_type, const void *value_ptr)
 abstract interface for the setter of a dynamic property.
 
virtual void on_set (void *member_ptr)
 this callback is called when the set_void method has changed a member and can be overloaded in derived class
 
virtual bool get_void (const std::string &property, const std::string &value_type, void *value_ptr)
 abstract interface for the getter of a dynamic property.
 
virtual bool call_void (const std::string &method, const std::vector< std::string > &param_value_types, const std::vector< const void * > &param_value_ptrs, const std::string &result_type="", void *result_value_ptr=0)
 abstract interface to call an action
 
void set (const std::string &property, const char *value)
 specialization of set method to support const char* as strings
 
template<typename T >
void set (const std::string &property, const T &value)
 set a property of the element to the given value and perform standard conversions if necessary.
 
template<typename T >
T get (const std::string &property)
 query a property of the element and perform standard conversions if necessary.
 
void multi_set (const std::string &property_assignments, bool report_error=true)
 set several properties
 
bool is_property (const std::string &property_name, std::string *type_name=0)
 check if the given name specifies a property.
 
voidfind_member_ptr (const std::string &property_name, std::string *type_name=0)
 find a member pointer by name.
 
- Public Member Functions inherited from cgv::data::ref_counted
int get_ref_count () const
 read access to current count
 

Additional Inherited Members

- Protected Member Functions inherited from cgv::base::base
virtual ~base ()
 make destructor virtual and not accessible from outside
 
- Protected Member Functions inherited from cgv::data::ref_counted
 ref_counted ()
 constructor initializes the count to 0
 
void set_ref_count (int c) const
 write access is also const to allow ref counted pointers to const instances
 
- Static Protected Member Functions inherited from cgv::base::base
template<class T >
static data::ref_ptr< T, truecast_dynamic (base *b)
 use dynamic cast for upcast to given class
 

Detailed Description

abstract base class for gui drivers

Definition at line 19 of file gui_driver.h.

Member Function Documentation

◆ enumerate_monitors()

bool cgv::gui::gui_driver::enumerate_monitors ( std::vector< monitor_description > &  monitor_descriptions)
virtual

fill list of monitor descriptions

Definition at line 7 of file gui_driver.cxx.

◆ lock()

virtual void cgv::gui::gui_driver::lock ( )
pure virtual

lock the main thread of the gui from a child thread before any gui specific call.

If lock is called several times, the child thread must call unlock the same number of times

◆ query()

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

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.

◆ wake()

virtual void cgv::gui::gui_driver::wake ( const std::string &  message = "")
pure virtual

wake main thread.

Ensures that main thead is not going to sleep any longer with the given message, that can be queried by the main thread with get_wakeup_message().


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