cgv
|
#include <callback_drawable.h>
Public Types | |
typedef cgv::media::color< float, cgv::media::RGB > | rgb |
declare rgb color type | |
typedef cgv::media::color< float, cgv::media::RGB, cgv::media::OPACITY > | rgba |
declare rgba color type | |
typedef cgv::media::color< cgv::type::uint8_type, cgv::media::RGB > | rgb8 |
declare rgb color type | |
typedef cgv::media::color< cgv::type::uint8_type, cgv::media::RGB, cgv::media::OPACITY > | rgba8 |
declare rgba color type | |
typedef cgv::math::fvec< float, 2 > | vec2 |
declare type of 2d vectors | |
typedef cgv::math::fvec< float, 3 > | vec3 |
declare type of 3d vectors | |
typedef cgv::math::fvec< float, 4 > | vec4 |
declare type of homogeneous vectors | |
typedef cgv::math::vec< float > | vecn |
declare type of vector with varying dimension | |
typedef cgv::math::fmat< float, 2, 2 > | mat2 |
declare type of 2x2 matrices | |
typedef cgv::math::fmat< float, 3, 3 > | mat3 |
declare type of 3x3 matrices | |
typedef cgv::math::fmat< float, 4, 4 > | mat4 |
declare type of 4x4 matrices | |
typedef cgv::math::fmat< float, 3, 4 > | mat34 |
declare type of 3x4 matrices which are often used to store a pose | |
typedef cgv::math::mat< float > | matn |
declare type of matrices of varying dimensions | |
typedef cgv::math::fvec< double, 2 > | dvec2 |
declare type of 2d vectors | |
typedef cgv::math::fvec< double, 3 > | dvec3 |
declare type of 3d vectors | |
typedef cgv::math::fvec< double, 4 > | dvec4 |
declare type of homogeneous vectors | |
typedef cgv::math::vec< double > | dvecn |
declare type of vector with varying dimension | |
typedef cgv::math::fmat< double, 2, 2 > | dmat2 |
declare type of 2x2 matrices | |
typedef cgv::math::fmat< double, 3, 3 > | dmat3 |
declare type of 3x3 matrices | |
typedef cgv::math::fmat< double, 4, 4 > | dmat4 |
declare type of 4x4 matrices | |
typedef cgv::math::fmat< double, 3, 4 > | dmat34 |
declare type of 3x4 matrices which are often used to store a pose | |
typedef cgv::math::mat< double > | dmatn |
declare type of matrices of varying dimensions | |
typedef cgv::media::axis_aligned_box< float, 2 > | box2 |
declare type of 2d boxes | |
typedef cgv::media::axis_aligned_box< float, 3 > | box3 |
declare type of 3d boxes | |
typedef cgv::media::axis_aligned_box< float, 4 > | box4 |
declare type of 4d boxes | |
typedef cgv::media::axis_aligned_box< double, 2 > | dbox2 |
declare type of 2d boxes | |
typedef cgv::media::axis_aligned_box< double, 3 > | dbox3 |
declare type of 3d boxes | |
typedef cgv::media::axis_aligned_box< double, 4 > | dbox4 |
declare type of 4d boxes | |
typedef cgv::math::quaternion< float > | quat |
declare type of quaternion | |
typedef cgv::math::quaternion< double > | dquat |
declare type of double quaternion | |
typedef cgv::math::fvec< int32_t, 2 > | ivec2 |
declare type of 2d integer vectors | |
typedef cgv::math::fvec< int32_t, 3 > | ivec3 |
declare type of 3d integer vectors | |
typedef cgv::math::fvec< int32_t, 4 > | ivec4 |
declare type of 4d integer vectors | |
typedef cgv::math::fvec< uint32_t, 2 > | uvec2 |
declare type of 2d unsigned integer vectors | |
typedef cgv::math::fvec< uint32_t, 3 > | uvec3 |
declare type of 3d unsigned integer vectors | |
typedef cgv::math::fvec< uint32_t, 4 > | uvec4 |
declare type of 4d unsigned integer vectors | |
Public Member Functions | |
bool | init (cgv::render::context &ctx) |
this method is called after creation or recreation of the context, return whether all necessary functionality is supported | |
void | clear (cgv::render::context &ctx) |
clear all objects living in the context like textures or display lists | |
void | init_frame (cgv::render::context &ctx) |
this method is called in one pass over all drawables before the draw method | |
void | draw (cgv::render::context &ctx) |
overload to draw the content of this drawable | |
void | finish_draw (cgv::render::context &ctx) |
this method is called when the current drawable is left in a tree traversal that calls the draw method | |
void | finish_frame (cgv::render::context &ctx) |
this method is called in one pass over all drawables after drawing | |
void | after_finish (cgv::render::context &ctx) |
this method is called in one pass over all drawables after finish frame | |
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 | |
std::string | get_type_name () const |
overload to return the type name of this object | |
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 | |
virtual data::ref_ptr< group, true > | get_group () |
cast upward to 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 > | |
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 | |
void | hide () |
hide the drawable | |
void | show () |
show the drawable | |
bool | is_visible () const |
check whether the drawable is visible | |
context * | get_context () const |
access the current context. The context will be available latestly in the init method but not in the contructor. | |
void | set_context (context *_ctx) |
set the current focus context, this should only be called by the context itself | |
cgv::render::view * | find_view_as_node (size_t view_idx=0) const |
convenience function to find the view control in the current hierarchy More... | |
bool | get_world_location (int x, int y, const cgv::render::view &V, cgv::math::fvec< double, 3 > &world_location, double *window_z_ptr=0) const |
use given view together with depth buffer of context in order to compute the world location of the point at mouse pointer location (x,y) More... | |
void | post_redraw () |
posts a redraw event to the current context if one is available | |
void | force_redraw () |
forces a redraw right now. This cannot be called from init, init_frame, draw, finish_draw, finish_frame and clear | |
virtual void | resize (unsigned int w, unsigned int h) |
callback to announce resizing of the output window More... | |
int | get_policy () const |
return the policy without the stop on success flag | |
bool | stop_on_success () const |
return whether to stop on success | |
bool | stop_on_failure () const |
return whether to stop on failure | |
void | set_policy (int _policy) |
set a new policy, always add stop on success flag if needed | |
int | get_focused_child () const |
return the focused child or -1 if none is focused | |
void | set_focused_child (int _focused_child) |
set the focused child | |
bool | get_active () const |
return whether the current node is active | |
void | set_active (bool _active) |
set the active flag of the current node | |
Protected Member Functions | |
void | set_ref_count (int c) const |
write access is also const to allow ref counted pointers to const instances | |
Static Protected Member Functions | |
template<class T > | |
static data::ref_ptr< T, true > | cast_dynamic (base *b) |
use dynamic cast for upcast to given class | |
Protected Attributes | |
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... | |
as a drawable can manage only a single context, this callback drawable is a work around for the case when a drawable should draw in several contexts (i.e. two windows). Then the callback drawable can be registered in the second window and its callback signals can be connected to methods in the primary drawable.
|
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.
|
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.
|
inherited |
convenience function to find the view control in the current hierarchy
this only works if your class inherits from the cgv::base::node class.
|
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.
|
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 |
use given view together with depth buffer of context in order to compute the world location of the point at mouse pointer location (x,y)
returns true if a world location could be computed which is the case when the context pointer of the drawable has been set and when the mouse location points inside a valid view panel.
|
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.
|
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.
|
virtualinherited |
callback to announce resizing of the output window
callback to anounce resizing of the output window
|
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.