3 #include <cgv/base/base.h> 
    4 #include <cgv/type/info/type_name.h> 
    5 #include <cgv/signal/rebind.h> 
    6 #include <cgv/utils/convert.h> 
    9 #include "gui_creator.h" 
   11 #include "lib_begin.h" 
   35 struct with_index_traits
 
   37         typedef const T* pointer_type;
 
   38         static pointer_type get_value_ptr(
const T& value) { 
return &value; }
 
   39         static int get_index(
const T& value) { 
return -1; }
 
   43 struct with_index_traits<with_index_struct<T> >
 
   45         typedef const T* pointer_type;
 
   46         static pointer_type get_value_ptr(
const with_index_struct<T>& value) { 
return &value.value; }
 
   47         static int get_index(
const with_index_struct<T>& value) { 
return value.index; }
 
   51 typename with_index_traits<T>::pointer_type wi_get_value_ptr(
const T& value)
 
   53         return with_index_traits<T>::get_value_ptr(value);
 
   57 int wi_get_index(
const T& value)
 
   59         return with_index_traits<T>::get_index(value);
 
   83         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);
 
   85         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);
 
   88         void align(
const std::string& _align);
 
   96         std::string concat_enum_def(
const std::vector<std::string>& names, 
const std::string& additional_first_name = 
"", 
const std::string& additional_last_name = 
"");
 
   99         gui_group_ptr add_object_gui(base_ptr 
object, 
const std::string& label, 
const std::string& group_type, 
const std::string& options, 
const std::string& align);
 
  101         void inline_object_gui(base_ptr 
object);
 
  103         gui_group_ptr add_group(
const std::string& label, 
const std::string& group_type, 
const std::string& options = 
"", 
const std::string& align = 
"\n");
 
  105         base_ptr add_decorator(
const std::string& label, 
const std::string& decorator_type, 
const std::string& options = 
"", 
const std::string& align = 
"\n");
 
  107         button_ptr add_button(
const std::string& label, 
const std::string& options = 
"", 
const std::string& align = 
"\n");
 
  109         template <
typename T>
 
  110         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") {
 
  111                 if (parent_group.
empty())
 
  113                 return parent_group->add_view(label, value, gui_type, options, align);
 
  116         template <
typename T>
 
  118                 if (parent_group.
empty())
 
  120                 return parent_group->add_control(label, value, gui_type, options,align); 
 
  123         template <
typename T>
 
  126                 const std::string& options = 
"", 
const std::string& align = 
"\n", 
void* user_data = 0) {
 
  127                 if (parent_group.
empty())
 
  129                 return parent_group->add_control(label, 
provider, gui_type, options,align,user_data); 
 
  134         template <
typename T>
 
  138                         connect_copy(cp->value_change,
 
  163         bool add_tree_node(
const std::string& label, 
bool& toggle, 
int level, 
const std::string& a= 
"\n", 
gui_group_ptr ggp = 
gui_group_ptr());
 
  209         template <
typename T>
 
  210         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()) { 
return begin_tree_node_void(label, wi_get_value_ptr(value), wi_get_index(value), initial_visibility, options, ggp); }
 
  214         template <
typename T>
 
  215         static bool& 
ref_tree_node_visible_flag(
const T& value) { 
return ref_tree_node_visible_flag_void(wi_get_value_ptr(value), wi_get_index(value)); }
 
  219         template <
typename T>
 
  220         void end_tree_node(
const T& value) { end_tree_node_void(wi_get_value_ptr(value), wi_get_index(value)); }
 
  222         template <
typename T>
 
  223         bool is_tree_node_visible(
const T& value)
 const { 
return is_tree_node_visible_void(wi_get_value_ptr(value), wi_get_index(value)); }
 
  225         template <
typename T>
 
  226         void set_tree_node_visibility(
const T& value, 
bool is_visible) { set_tree_node_visibility_void(wi_get_value_ptr(value), wi_get_index(value), is_visible); }
 
  228         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());
 
  230         static bool& ref_tree_node_visible_flag_void(
const void* value_ptr, 
int index = -1);
 
  232         void end_tree_node_void(
const void* value_ptr, 
int index = -1);
 
  234         bool is_tree_node_visible_void(
const void* value_ptr, 
int index) 
const;
 
  236         void set_tree_node_visibility_void(
const void* value_ptr, 
int index, 
bool is_visible);
 
  244         template <
typename T>
 
  245         bool add_gui(
const std::string& label, T& value, 
const std::string& gui_type = 
"", 
const std::string& options = 
"") 
 
  253         virtual void on_select();
 
  256         virtual void on_deselect();
 
  275         virtual std::string get_gui_name() 
const;
 
  279         virtual std::string get_parent_type() 
const;
 
  281         virtual bool ensure_selected_in_tab_group_parent();
 
  283         virtual void update_member(
void* member_ptr);
 
  285         virtual void update_all_members();
 
  287         virtual std::string get_menu_path() 
const;
 
  289         virtual shortcut get_shortcut() 
const;
 
  299         virtual void recreate_gui();
 
  303         virtual void post_recreate_gui();
 
  307         void remove_element(base_ptr);
 
  310         void remove_all_elements();
 
  312         base_ptr find_element(
const std::string& name);
 
  317         template <
typename T>
 
  319                 if (parent_group.
empty())
 
  321                 return parent_group->find_view(value,idx_ptr); 
 
  327         template <
typename T>
 
  329                 if (parent_group.
empty())
 
  331                 return parent_group->find_control(value,idx_ptr); 
 
  334         control_ptr find_control_void(
void* value_ptr, 
int* idx_ptr);
 
  336         view_ptr find_view_void(
void* value_ptr, 
int* idx_ptr);
 
  345 #include <cgv/config/lib_end.h> 
  
 
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 cl...
Definition: provider.h:124
data::ref_ptr< control< T > > find_control(T &value, int *idx_ptr=0)
find a control of a given class member
Definition: provider.h:328
type independent base class of control provider interface
Definition: control.h:37
void end_tree_node(const T &value)
Definition: provider.h:220
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.
Definition: provider.h:245
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 ...
Definition: provider.h:28
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
Definition: provider.h:117
Definition: abst_signal.h:63
bool is_tree_node_visible(const T &value) const
return whether the sub tree attached to a value is visible
Definition: provider.h:223
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
Definition: gui_creator.cxx:21
derive from this class to provide a gui to the current viewer
Definition: provider.h:64
bool empty() const
check if pointer is not yet set
Definition: ref_ptr.h:230
virtual void create_gui()=0
you must overload this for gui creation
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
Definition: provider.h:110
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 derive...
Definition: base.cxx:210
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 visi...
Definition: provider.h:215
helper struct to support value references as well as value references with index
Definition: provider.h:20
data::ref_ptr< gui_group, true > gui_group_ptr
ref counted pointer to a gui group
Definition: gui_group.h:33
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...
Definition: provider.h:81
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
Definition: provider.h:135
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 nee...
Definition: provider.h:226
data::ref_ptr< view< T > > find_view(const T &value, int *idx_ptr=0)
find a view of a given class member
Definition: provider.h:318
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.
Definition: provider.h:210
the shortcut class encapsulates a key with modifiers
Definition: shortcut.h:84
the cgv namespace
Definition: vr_calib.cxx:9
gui independent group class which is a container for gui elements
Definition: gui_group.h:40
Definition: type_name.h:54