5#include <cgv/signal/signal.h>
24 bool shows(
const void* ptr)
const;
26 virtual bool controls(
const void* ptr)
const = 0;
46 virtual bool controls(
const void* ptr,
void* user_data)
const = 0;
59 virtual void set_value(
const T& value,
void* user_data) = 0;
63 virtual bool controls(
const void* ptr,
void* user_data)
const {
return false; }
94 void set_value(
const T& v) {
103 const T* get_value_ptr()
const {
return cp ? 0 : value_ptr; }
110 control(
const std::string& _name, T& _value) :
abst_control(_name), value_ptr(&_value), new_value(_value), cp(0) {
126 (
void*&)value_ptr = user_data;
130 value_ptr = (T*)user_data;
131 new_value = *value_ptr;
143 T
get_value()
const {
return cp ? cp->get_value(value_ptr) : *value_ptr; }
163 bool controls(
const void* ptr)
const {
return cp ? cp->controls(ptr,value_ptr) : (value_ptr == ptr); }
177#include <cgv/config/lib_end.h>
std::string name
store the name as a string
reference counted pointer, which can work together with types that are derived from ref_counted,...
virtual bool controls(const void *ptr) const =0
return whether the control controls the value pointed to by ptr
static bool access_on_release(const void *value_ptr, char access_mode)
access on_release value for given value ptr to 'q'uery, 's'et or 'u'nset
static bool on_release(const void *value_ptr)
return whether value_change signal was sent due to a release event
bool shows(const void *ptr) const
add default implementation passing the query to the controls() method
virtual void attach_to_value_change(cgv::signal::functor_base *func)=0
attach a functor to the value change signal
abst_control(const std::string &name)
construct from name
virtual void attach_to_check_value(cgv::signal::functor_base *bool_func)=0
attach a functor to the value change signal
abst_view(const std::string &name)
pass name on to node, careful the implementation of this is in the source file control....
void attach_to_reference(const void *ptr)
links all views to a reference into a doubly linked list in order to allow controls of the reference ...
control(const std::string &_name, T *_value)
construct abstract element from control_provider
T get_value() const
return a reference to the current value
cgv::signal::bool_signal< control< T > & > value_check_signal_type
type of the value check signal
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 ...
const T & get_new_value() const
return the new value to the callbacks attached to the check_value signal
void set_new_value(const T &nv)
set a different new value from the callbacks attached to the check_value signal
cgv::signal::signal< control< T > & > value_change
this signal is sent after the user triggered a change of value and the check_value succeeded.
control(const std::string &_name, T &_value)
construct abstract element from reference to value
const T & get_old_value() const
return the old value to the callbacks attached to the change_value signal
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...
void attach_to_value_change(cgv::signal::functor_base *func)
attach a functor to the value change signal
void attach_to_check_value(cgv::signal::functor_base *bool_func)
attach a functor to the value change signal
bool controls(const void *ptr) const
check whether the value represented by this element is pointing to the passed pointer
control(const std::string &_name, abst_control_provider *_cp, void *user_data)
cgv::signal::signal< control< T > & > value_change_signal_type
type of the value change signal
namespace that holds the abstract gui interface
data::ref_ptr< abst_control > control_ptr
ref counted pointer to abst control
this header is dependency free
type independent base class of control provider interface
virtual bool controls(const void *ptr, void *user_data) const =0
overload to check if ptr points to the controlled value
virtual void set_value(const T &value, void *user_data)=0
overload to set the value
virtual T get_value(void *user_data) const =0
overload to get the value
virtual bool controls(const void *ptr, void *user_data) const
the default implementation compares ptr to &get_value().