cgv
|
gui independent group class which is a container for gui elements More...
#include <gui_group.h>
Public Member Functions | |
void | register_object (cgv::base::base_ptr object, const std::string &options) |
interface of adding an object | |
void | unregister_object (cgv::base::base_ptr object, const std::string &options) |
overload to handle unregistration events | |
gui_group (const std::string &name="") | |
construct from name | |
std::string | get_type_name () const |
overload to return the type name of this object | |
unsigned int | get_nr_children () const |
return the number of children | |
base_ptr | get_child (unsigned int i) const |
return the i-th child | |
virtual unsigned int | append_child (base_ptr child) |
append child and return index of appended child | |
virtual unsigned int | remove_child (base_ptr child) |
remove all elements of the vector that point to child, return the number of removed children | |
virtual void | remove_all_children () |
remove all children | |
virtual void | insert_child (unsigned int i, base_ptr child) |
insert a child at the given position | |
data::ref_ptr< group, true > | get_group () |
cast upward to group | |
node_ptr | get_parent () const |
return the parent node | |
base_ptr | get_root () const |
return the root node by traversing parents until no more parent is available | |
void | set_parent (node_ptr _parent) |
set a new parent node | |
data::ref_ptr< node, true > | get_node () |
cast upward to node | |
const std::string & | get_name () const |
return the parent node | |
void | set_name (const std::string &_name) |
set a new parent node | |
data::ref_ptr< named, true > | get_named () |
cast upward to named | |
virtual std::string | get_default_options () const |
overload to provide default options for registration | |
virtual void | on_register () |
overload to handle register events that is sent after the instance has been registered More... | |
virtual void | unregister () |
overload to handle unregistration of instances | |
virtual void | stream_stats (std::ostream &) |
overload to show the content of this object | |
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 > | |
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 More... | |
int | get_ref_count () const |
read access to current count | |
Protected Member Functions | |
void | link (base_ptr b) |
check if the base class is a node and set the parent of the node | |
void | unlink (base_ptr b) |
check if the base class is a node and clear the parent of the node | |
void | set_ref_count (int c) const |
write access is also const to allow ref counted pointers to const instances | |
Static Protected Member Functions | |
static void | set_provider_parent (provider *p, gui_group_ptr g) |
access to protected provider method | |
static gui_group_ptr | get_provider_parent (const provider *p) |
driver specific handle for the group gui element managing the gui built in the provider | |
template<class T > | |
static data::ref_ptr< T, true > | cast_dynamic (base *b) |
use dynamic cast for upcast to given class | |
Protected Attributes | |
std::vector< cgv::base::base_ptr > | managed_objects |
managed objects can be add to the group such that | |
std::vector< base_ptr > | children |
store a list of children | |
node_ptr | parent |
store a pointer to the parent node | |
std::string | name |
store the name as a string | |
property interface | |
virtual bool | self_reflect (cgv::reflect::reflection_handler &) |
used for simple self reflection More... | |
virtual std::string | get_property_declarations () |
return a semicolon separated list of property declarations More... | |
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. More... | |
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. More... | |
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 More... | |
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. More... | |
template<typename T > | |
T | get (const std::string &property) |
query a property of the element and perform standard conversions if necessary. More... | |
void | multi_set (const std::string &property_assignments, bool report_error=true) |
set several properties More... | |
bool | is_property (const std::string &property_name, std::string *type_name=0) |
check if the given name specifies a property. More... | |
void * | find_member_ptr (const std::string &property_name, std::string *type_name=0) |
find a member pointer by name. More... | |
selection of children | |
cgv::signal::signal< base_ptr, bool > | on_selection_change |
This signal is emitted for every change of the selection of a child. More... | |
virtual bool | multiple_selection () const |
return whether several children of the group can be selected at the same time | |
virtual void | select_child (unsigned ci, bool exclusive=false) |
select the ci-th child of the group. More... | |
virtual void | select_child (base_ptr ci, bool exclusive=false) |
same as version with child index | |
virtual bool | unselect_child (unsigned ci) |
unselect the ci-th child. More... | |
virtual bool | unselect_child (base_ptr ci) |
same as version with child index | |
virtual int | get_selected_child_index () const |
return the index of the currently selected child. More... | |
virtual base_ptr | get_selected_child () const |
return the currently selected child. More... | |
virtual bool | is_selected (base_ptr c) const |
return whether the given child is selected | |
bool | is_selected (unsigned ci) const |
return whether the given child is selected. More... | |
opening and closing of child groups | |
cgv::signal::signal< gui_group_ptr, bool > | on_open_state_change |
this signal is emitted, when a child group is opened or closed More... | |
virtual bool | can_open_and_close () const |
returns whether open and close of sub groups is allowed | |
virtual bool | is_open_child_group (gui_group_ptr g) const |
return whether the given child is open | |
bool | is_open_child_group (unsigned ci) const |
return whether the ci-th child is an open gui group | |
virtual bool | open_child_group (gui_group_ptr g) |
try to open given child group and return whether this was successful More... | |
virtual bool | close_child_group (gui_group_ptr g) |
try to close given child group and return whether this was successful More... | |
gui independent group class which is a container for gui elements
void cgv::gui::gui_group::add_managed_objects | ( | cgv::base::base_ptr | object | ) |
add the passed object as an managed object.
This will simply add a reference counted pointer to the object into a list of managed elements. This pointer is released whenever the gui group is destroyed or when the gui is recreated. This functionality can be used by gui_creators to manage objects that are not managed by the user of the gui library. An example usage can be found in the bit_field_controler found in the plugin plugins/cg_ext.
|
virtualinherited |
abstract interface to call an action
overload to implement the execution of a method based on the method name and the given parameters
, i.e. a class method based on the action name and the given parameters. The default implementation uses the self_reflect() method to dispatch this call. If not found, the get_void method returns false.
|
virtual |
try to close given child group and return whether this was successful
close the given child group
|
inline |
find the next control of the given value in the current group.
If the index pointer is given, start at the index to which the pointer points and set this index to the index of the child index of the found control
|
inherited |
find a member pointer by name.
If not found the null pointer is returned. If the type name string pointer is provided, the type of the property is copied to the referenced string.
|
inline |
find the next view of the given value in the current group.
If the index pointer is given, start at the index to which the pointer points and set this index to the index of the child index of the found view
|
inlineinherited |
query a property of the element and perform standard conversions if necessary.
This templated version simply extracts the type of the value from the reference and calls the set_void() method. Note that this only works if the template cgv::type::info::type_name<T> is overloaded for the value type.
|
virtualinherited |
return a semicolon separated list of property declarations
return a semicolon separated list of property declarations of the form "name:type", by default an empty list is returned
of the form "name1:type1;name2:type2;...", by default an empty list is returned. The types should by consistent with the names returned by cgv::type::info::type_name::get_name. The default implementation extracts names and types from the self_reflect() method and the meta type information provided by the get_type() method.
Reimplemented in cgv::base::factory, cgv::base::base_generator, cgv::media::image::image_reader, cgv::media::video::video_writer, cgv::media::image::image_writer, cgv::media::video::video_reader, and cgv::base::console.
|
virtual |
return the currently selected child.
In case of multiple_selection, this function returns the first selected child. In this case it can also happen that the returned base_ptr is empty if no child is selected.
|
virtual |
return the index of the currently selected child.
In case of multiple_selection, this function returns the index of the first selected child. In this case it can also happen that the returned index is -1 if no child is selected.
|
virtualinherited |
this virtual method allows to pass application specific data for internal purposes
this virtual method allows derived classes to pass application specific data
|
virtualinherited |
abstract interface for the getter of a dynamic property.
abstract interface for the getter, by default it simply returns false
The default implementation uses the self_reflect() method to find a member with the given property as name. If not found, the get_void method returns false.
Reimplemented in cgv::base::factory, cgv::base::base_generator, cgv::base::console, cgv::media::image::image_reader, cgv::media::image::image_writer, cgv::media::video::video_reader, and cgv::media::video::video_writer.
|
inherited |
check if the given name specifies a property.
If the type name string pointer is provided, the type of the property is copied to the referenced string.
bool cgv::gui::gui_group::is_selected | ( | unsigned | ci | ) | const |
return whether the given child is selected.
the implementation simply calls the virtual variant with get_child(ci).
|
inherited |
set several properties
set several properties, which are defined as colon separated assignments, where the types are derived automatically
, which are defined as colon separated assignments, where the types are derived automatically to bool, int, double or std::string.
|
virtualinherited |
overload to handle register events that is sent after the instance has been registered
overload to return a type info structure. By default an empty pointer is returned.
|
virtual |
try to open given child group and return whether this was successful
open the given child group
|
virtual |
select the ci-th child of the group.
If multiple_selection() returns true, the exclusive
flag can be used to unselect all other previously selected children except the newly selected one. Typically, an exclusively selected child will gain input focus.
|
virtualinherited |
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 in cgv::render::render_config, and cgv::render::shader_config.
|
inlineinherited |
set a property of the element to the given value and perform standard conversions if necessary.
This templated version simply extracts the type of the value from the reference and calls the set_void() method. Note that this only works if the template cgv::type::info::type_name<T> is overloaded for the value type.
|
virtualinherited |
abstract interface for the setter of a dynamic property.
abstract interface for the setter, by default it simply returns false
The default implementation uses the self_reflect() method to find a member with the given property as name. If not found, the set_void method returns false.
Reimplemented in cgv::base::factory, cgv::base::base_generator, cgv::base::console, cgv::media::image::image_reader, cgv::media::image::image_writer, cgv::media::video::video_reader, and cgv::media::video::video_writer.
|
virtual |
unselect the ci-th child.
If no multiple_selection is allowed, unselection can fail if the group does not support an empty selection.
cgv::signal::signal<gui_group_ptr,bool> cgv::gui::gui_group::on_open_state_change |
this signal is emitted, when a child group is opened or closed
The first argument specifies the group and the second whether it has been opened.
cgv::signal::signal<base_ptr, bool> cgv::gui::gui_group::on_selection_change |
This signal is emitted for every change of the selection of a child.
The first argument is simply the pointer to the child whose selection state has been changed. The second argument is the new selection state.