cgv
|
Public Member Functions | |
base_provider (cgv::base::base_ptr _instance=cgv::base::base_ptr(), const std::string &gui_def="", bool _is_named_gui_assignment=false) | |
construct from instance and gui definition | |
base_provider (const std::string &file_name, cgv::base::base_ptr _instance=cgv::base::base_ptr()) | |
construct from gui definition file and instance | |
~base_provider () | |
destruct base provider | |
bool | self_reflect (cgv::reflect::reflection_handler &rh) |
used for simple self reflection | |
std::string | get_parent_type () const |
Returns the group type that should be used by the class embedding the gui of the provider. | |
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. | |
data::ref_ptr< cgv::base::named, true > | get_named () |
perform downcast to named | |
void | read_gui_definition (const std::string &file_name) |
void | set_gui_definition (const std::string &new_def) |
const std::string & | get_gui_definition () const |
bool | is_named_gui_assignment () const |
void | set_named_gui_assignment (bool value=true) |
void | set_instance (cgv::base::base_ptr _instance) |
cgv::base::base_ptr | get_instance () const |
void | create_gui () |
you must overload this for gui creation | |
![]() | |
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< node, true > | get_node () |
perform downcast to node | |
virtual data::ref_ptr< group, true > | get_group () |
perform downcast to group | |
virtual data::ref_ptr< const named, true > | get_named_const () const |
perform downcast to const named | |
virtual data::ref_ptr< const node, true > | get_node_const () const |
perform downcast to const node | |
virtual data::ref_ptr< const group, true > | get_group_const () const |
perform downcast to const group | |
template<class T > | |
data::ref_ptr< T, true > | cast () |
cast to arbitrary class, but use the casts to named, node and group from the interface | |
template<class T > | |
data::ref_ptr< const T, true > | cast_const () |
const cast to arbitrary class, but use the casts to named, node and group from the interface | |
template<class T > | |
T * | get_interface () |
use dynamic type cast to check for the given interface | |
template<class T > | |
const T * | get_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 void * | get_user_data () const |
this virtual method allows to pass application specific data for internal purposes | |
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 > ¶m_value_types, const std::vector< const void * > ¶m_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. | |
void * | find_member_ptr (const std::string &property_name, std::string *type_name=0) |
find a member pointer by name. | |
![]() | |
int | get_ref_count () const |
read access to current count | |
![]() | |
void | remove_element (cgv::base::base_ptr) |
remove a single element from the gui | |
void | remove_all_elements () |
this method removes all elements from the gui and can be used in a method that rebuilds the complete gui | |
cgv::base::base_ptr | find_element (const std::string &name) |
find a gui element by name in the current group, return empty pointer if not found | |
template<typename T > | |
data::ref_ptr< view< T > > | find_view (const T &value, int *idx_ptr=0) |
find a view of a given class member | |
template<typename T > | |
data::ref_ptr< control< T > > | find_control (T &value, int *idx_ptr=0) |
find a control of a given class member | |
control_ptr | find_control_void (void *value_ptr, int *idx_ptr) |
access to control of untyped member pointer | |
view_ptr | find_view_void (void *value_ptr, int *idx_ptr) |
access to view of untyped member pointer | |
template<typename T > | |
void | set_control_property (T &value, const std::string &property_name, const std::string &property_value) |
Set the property value of all controls of a given class member. | |
gui_group_ptr | get_parent_group () const |
use the parent group to append to be managed elements that should be destroyed in a post_recreate_gui event | |
view_ptr | add_view_void (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) |
add a newly created view to the group | |
control_ptr | add_control_void (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, void *user_data) |
add a newly created control to the group | |
provider () | |
default construction | |
~provider () | |
ensure to remove posted recreation callbacks | |
virtual std::string | get_gui_name () const |
Derive a name for this instance that can be used in the gui as heading. | |
virtual bool | ensure_selected_in_tab_group_parent () |
ensure that my UI is selected in the parent group in case this is a tab group, otherwise return false | |
virtual void | update_member (void *member_ptr) |
call this to update all views and controls of a member | |
virtual void | update_all_members () |
call this to update all views and controls of all member | |
virtual std::string | get_menu_path () const |
return a path in the main menu to select the gui | |
virtual shortcut | get_shortcut () const |
return a shortcut to activate the gui without menu navigation | |
virtual void | recreate_gui () |
Recreate the gui of this instance right now. | |
virtual void | post_recreate_gui () |
delayed recreation of gui | |
void | align (const std::string &_align) |
send pure alignment information | |
std::string | concat_enum_def (const std::vector< std::string > &names, const std::string &additional_first_name="", const std::string &additional_last_name="") |
add a new group to the given parent group, not supported yet | |
gui_group_ptr | add_object_gui (cgv::base::base_ptr object, const std::string &label, const std::string &group_type, const std::string &options, const std::string &align) |
void | integrate_object_gui (cgv::base::base_ptr object) |
call this in create_gui() function to integrate gui of another provider object by setting the parent group and parent provider of the other object | |
void | inline_object_gui (cgv::base::base_ptr object) |
integrate (if not explicitly done before) and inline the gui of another object that must be derived from provider | |
gui_group_ptr | add_group (const std::string &label, const std::string &group_type, const std::string &options="", const std::string &align="\n") |
add a newly created subgroup to the group | |
cgv::base::base_ptr | add_decorator (const std::string &label, const std::string &decorator_type, const std::string &options="", const std::string &align="\n") |
add a newly created decorator to the group | |
button_ptr | add_button (const std::string &label, const std::string &options="", const std::string &align="\n") |
use the current gui driver to append a new button with the given label | |
template<typename T > | |
data::ref_ptr< view< T > > | add_view (const std::string &label, const T &value, const std::string &gui_type="", const std::string &options="", const std::string &align="\n") |
use this to add a new view to the gui with a given value type, gui type and init options | |
template<typename T > | |
data::ref_ptr< control< T > > | add_control (const std::string &label, T &value, const std::string &gui_type="", const std::string &options="", const std::string &align="\n") |
use this to add a new control to the gui with a given value type, gui type and init options | |
template<typename T > | |
data::ref_ptr< control< T > > | add_control (const std::string &label, control_provider< T > *provider, const std::string &gui_type="", const std::string &options="", const std::string &align="\n", void *user_data=0) |
use this to add a new control to the gui, where the control is implemented with a control provider class | |
template<typename T > | |
data::ref_ptr< control< T > > | add_member_control (cgv::base::base *base_ptr, const std::string &label, T &value, const std::string &gui_type="", const std::string &options="", const std::string &align="\n") |
add control with callback to cgv::base::on_set method on cgv::gui::control::value_change | |
bool | add_tree_node (const std::string &label, bool &toggle, int level, const std::string &a="\n", gui_group_ptr ggp=gui_group_ptr()) |
add a collapsable node to the gui (deprecated) | |
template<typename T > | |
bool | begin_tree_node (const std::string &label, const T &value, bool initial_visibility=false, const std::string &options="", gui_group_ptr ggp=gui_group_ptr()) |
Begin a sub tree of a tree structured gui. | |
template<typename T > | |
void | end_tree_node (const T &value) |
template specialization that allows to specify value reference plus node_instance by using the result of the function with_instance(value,idx) for the value argument finish a sub tree begun with begin_tree_node | |
template<typename T > | |
bool | is_tree_node_visible (const T &value) const |
return whether the sub tree attached to a value is visible | |
template<typename T > | |
void | set_tree_node_visibility (const T &value, bool is_visible) |
set the visibility status of sub tree attached to a value. This calls the post_recreate method if needed. | |
bool | begin_tree_node_void (const std::string &label, const void *value_ptr, int index=-1, bool initial_visibility=false, const std::string &options="", gui_group_ptr ggp=gui_group_ptr()) |
void version of the templated functions | |
void | end_tree_node_void (const void *value_ptr, int index=-1) |
bool | is_tree_node_visible_void (const void *value_ptr, int index) const |
void | set_tree_node_visibility_void (const void *value_ptr, int index, bool is_visible) |
template<typename T > | |
bool | add_gui (const std::string &label, T &value, const std::string &gui_type="", const std::string &options="") |
Add a composed gui of the given gui_type for the given value. | |
Protected Types | |
enum | ParsingTasks { PT_NR_TOGGLES , PT_INIT_TOGGLES , PT_CREATE_GUI } |
Protected Member Functions | |
void | parse_definition (ParsingTasks pt) |
std::string | error_start (const char *ptr) const |
bool | find_member (const std::string &name, void *&member_ptr, std::string &member_type) |
![]() | |
virtual | ~base () |
make destructor virtual and not accessible from outside | |
![]() | |
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 | |
![]() | |
void | set_parent (gui_group_ptr) |
the gui window sets the parent group through this method | |
void | update_parent () |
update the parent group | |
virtual void | on_select () |
called by selection_change_cb whenever the gui of this provider is selected | |
virtual void | on_deselect () |
called by selection_change_cb whenever the gui of this provider is deselected | |
virtual void | selection_change_cb (cgv::base::base_ptr new_child, bool selected) |
this is called by the gui group when the selection changes | |
Protected Attributes | |
std::string | parent_type |
std::string | parent_options |
cgv::base::base_ptr | instance |
std::string | textual_gui_definition |
bool | is_named_gui_assignment_m |
unsigned | nr_toggles |
bool * | toggles |
![]() | |
gui_group_ptr | parent_group |
driver specific handle for the group gui element managing the gui built in the provider | |
provider * | parent_provider |
Additional Inherited Members | |
![]() | |
template<typename T > | |
static bool & | ref_tree_node_visible_flag (const T &value) |
return a reference to the boolean flag, that tells whether the tree node for the passed value is visible | |
static bool & | ref_tree_node_visible_flag_void (const void *value_ptr, int index=-1) |
![]() | |
template<class T > | |
static data::ref_ptr< T, true > | cast_dynamic (base *b) |
use dynamic cast for upcast to given class | |
Definition at line 12 of file base_provider.h.
|
protected |
Definition at line 21 of file base_provider.h.
cgv::gui::base_provider::base_provider | ( | cgv::base::base_ptr | _instance = cgv::base::base_ptr() , |
const std::string & | gui_def = "" , |
||
bool | _is_named_gui_assignment = false |
||
) |
construct from instance and gui definition
Definition at line 17 of file base_provider.cxx.
cgv::gui::base_provider::base_provider | ( | const std::string & | file_name, |
cgv::base::base_ptr | _instance = cgv::base::base_ptr() |
||
) |
construct from gui definition file and instance
Definition at line 28 of file base_provider.cxx.
cgv::gui::base_provider::~base_provider | ( | ) |
destruct base provider
Definition at line 38 of file base_provider.cxx.
|
virtual |
you must overload this for gui creation
Implements cgv::gui::provider.
Definition at line 457 of file base_provider.cxx.
References cgv::gui::provider::parent_group.
Definition at line 59 of file base_provider.cxx.
|
protected |
Definition at line 174 of file base_provider.cxx.
const std::string & cgv::gui::base_provider::get_gui_definition | ( | ) | const |
Definition at line 116 of file base_provider.cxx.
cgv::base::base_ptr cgv::gui::base_provider::get_instance | ( | ) | const |
Definition at line 129 of file base_provider.cxx.
|
virtual |
perform downcast to named
Reimplemented from cgv::base::base.
Definition at line 85 of file base_provider.cxx.
References cgv::base::base::get_named().
|
virtual |
Returns the group type that should be used by the class embedding the gui of the provider.
The default is to use a group of type "align_group". Overload this virtual method to use a different group type, such as layout group.
Reimplemented from cgv::gui::provider.
Definition at line 46 of file base_provider.cxx.
|
virtual |
overload to return the type name of this object. By default the type interface is queried over get_type.
Reimplemented from cgv::base::base.
Definition at line 77 of file base_provider.cxx.
References cgv::base::base::get_type_name().
|
inline |
Definition at line 49 of file base_provider.h.
|
protected |
Definition at line 181 of file base_provider.cxx.
Definition at line 93 of file base_provider.cxx.
|
virtual |
used for simple self reflection
is used by default implementation of set_void, get_void and get_property_declarations
The overloaded implementation is used by the default implementations of set_void, get_void and get_property_declarations with corresponding reflection handlers. The default implementation of self_reflect is empty.
Reimplemented from cgv::base::base.
Definition at line 52 of file base_provider.cxx.
References cgv::reflect::reflection_handler::reflect_member().
Definition at line 103 of file base_provider.cxx.
void cgv::gui::base_provider::set_instance | ( | cgv::base::base_ptr | _instance | ) |
Definition at line 122 of file base_provider.cxx.
|
inline |
Definition at line 51 of file base_provider.h.
|
protected |
Definition at line 16 of file base_provider.h.
|
protected |
Definition at line 18 of file base_provider.h.
|
protected |
Definition at line 19 of file base_provider.h.
|
protected |
Definition at line 15 of file base_provider.h.
|
protected |
Definition at line 15 of file base_provider.h.
|
protected |
Definition at line 17 of file base_provider.h.
|
protected |
Definition at line 20 of file base_provider.h.