5 #include <cgv/signal/signal.h>
19 bool shows(
const void* ptr)
const;
21 virtual bool controls(
const void* ptr)
const = 0;
41 virtual bool controls(
const void* ptr,
void* user_data)
const = 0;
54 virtual void set_value(
const T& value,
void* user_data) = 0;
56 virtual const T
get_value(
void* user_data)
const = 0;
58 virtual bool controls(
const void* ptr,
void* user_data)
const {
return false; }
89 void set_value(
const T& v) {
98 const T* get_value_ptr()
const {
return cp ? 0 : value_ptr; }
105 control(
const std::string& _name, T& _value) :
abst_control(_name), value_ptr(&_value), new_value(_value), cp(0) {
106 attach_to_reference(value_ptr);
113 attach_to_reference(value_ptr);
121 (
void*&)value_ptr = user_data;
125 value_ptr = (T*)user_data;
126 new_value = *value_ptr;
127 attach_to_reference(value_ptr);
148 if (check_value(*
this)) {
149 T tmp_value = get_value();
150 set_value(this->get_new_value());
151 set_new_value(tmp_value);
158 bool controls(
const void* ptr)
const {
return cp ? cp->
controls(ptr,value_ptr) : (value_ptr == ptr); }
161 value_change.connect_abst(func);
165 check_value.connect_abst(bool_func);
172 #include <cgv/config/lib_end.h>
const T & get_old_value() const
return the old value to the callbacks attached to the change_value signal
Definition: control.h:144
cgv::signal::signal< control< T > & > value_change
this signal is sent after the user triggered a change of value and the check_value succeeded.
Definition: control.h:136
virtual const T get_value(void *user_data) const =0
overload to get the value
virtual void attach_to_value_change(cgv::signal::functor_base *func)=0
attach a functor to the value change signal
type independent base class of control provider interface
Definition: control.h:37
cgv::signal::bool_signal< control< T > & > check_value
this signal is sent when the user triggered a change of value in order to check whether the new value...
Definition: control.h:133
virtual bool controls(const void *ptr) const =0
return whether the control controls the value pointed to by ptr
gui and type independent base class of all controls
Definition: control.h:14
bool controls(const void *ptr) const
check whether the value represented by this element is pointing to the passed pointer
Definition: control.h:158
bool check_and_set_value(const T &nv)
set new value only if check_value signal succeeds and send value_change signal. Return true if value ...
Definition: control.h:146
const T & get_new_value() const
return the new value to the callbacks attached to the check_value signal
Definition: control.h:140
cgv::signal::signal< control< T > & > value_change_signal_type
type of the value change signal
Definition: control.h:103
cgv::signal::bool_signal< control< T > & > value_check_signal_type
type of the value check signal
Definition: control.h:101
const T get_value() const
return a reference to the current value
Definition: control.h:138
virtual void set_value(const T &value, void *user_data)=0
overload to set the value
data::ref_ptr< abst_control > control_ptr
ref counted pointer to abst control
Definition: control.h:29
base class for all functor classes which provides access to the tacker interface of an involved insta...
Definition: abst_signal.h:40
control(const std::string &_name, T &_value)
construct abstract element from reference to value
Definition: control.h:105
virtual void attach_to_check_value(cgv::signal::functor_base *bool_func)=0
attach a functor to the value change signal
virtual bool controls(const void *ptr, void *user_data) const =0
overload to check if ptr points to the controlled value
type independent &base class of all views
Definition: view.h:13
control(const std::string &_name, T *_value)
construct abstract element from control_provider
Definition: control.h:109
virtual bool controls(const void *ptr, void *user_data) const
the default implementation compares ptr to &get_value().
Definition: control.h:58
void attach_to_value_change(cgv::signal::functor_base *func)
attach a functor to the value change signal
Definition: control.h:160
control(const std::string &_name, abst_control_provider *_cp, void *user_data)
Definition: control.h:118
void set_new_value(const T &nv)
set a different new value from the callbacks attached to the check_value signal
Definition: control.h:142
the cgv namespace
Definition: vr_calib.cxx:9
void attach_to_check_value(cgv::signal::functor_base *bool_func)
attach a functor to the value change signal
Definition: control.h:164