1#include <cgv/gui/layout.h>
2#include <cgv/gui/resizable.h>
16 spacings_name =
"compact";
17 spacings = get_layout_spacings(spacings_name);
18 set_container(container);
32 std::cerr<<
"Error: A container was NULL (maybe an unsuccessfull dynamic_cast?)!"<<std::endl;
36 this->container = container;
51 std::cerr<<
"Layout is not connected to any container"<<std::endl;
55 return container->get_child(i);
66 std::string align(
"");
67 align = child->get<std::string>(
"alignment");
71 for (
unsigned int i=0; i<align.length(); i++)
123 width = child->get<
int>(
"w");
124 height = child->get<
int>(
"h");
134 child->set<
int>(
"w", width);
135 child->set<
int>(
"h", height);
136 child->set<
int>(
"dolayout", 0);
141 void layout::get_child_default_size(
const cgv::base::base_ptr child,
int &width,
int &height)
149 width = child->get<
int>(
"dw");
150 height = child->get<
int>(
"dh");
154 void layout::get_child_minimum_size(
const cgv::base::base_ptr child,
int &width,
int &height)
161 width = child->get<
int>(
"mw");
162 height = child->get<
int>(
"mh");
176 x = child->get<
int>(
"x");
177 y = child->get<
int>(
"y");
187 child->set<
int>(
"x", x);
188 child->set<
int>(
"y", y);
194 void layout::resize(
int w,
int h)
205 return "spacings:string";
209 bool layout::set_void(
const std::string &property,
const std::string &value_type,
const void *value_ptr)
211 if (property ==
"spacings") {
212 cgv::type::get_variant(spacings_name, value_type, value_ptr);
213 spacings = get_layout_spacings(spacings_name);
216 if (property ==
"mw")
217 cgv::type::get_variant(min_w, value_type, value_ptr);
219 if (property ==
"mh")
220 cgv::type::get_variant(min_h, value_type, value_ptr);
222 if (property ==
"dw")
223 cgv::type::get_variant(default_w, value_type, value_ptr);
225 if (property ==
"dh")
226 cgv::type::get_variant(default_h, value_type, value_ptr);
234 bool layout::get_void(
const std::string &property,
const std::string &value_type,
void *value_ptr)
236 if (property ==
"spacings")
237 cgv::type::set_variant(spacings_name, value_type, value_ptr);
239 if (property ==
"mw")
240 cgv::type::set_variant(min_w, value_type, value_ptr);
242 if (property ==
"mh")
243 cgv::type::set_variant(min_h, value_type, value_ptr);
245 if (property ==
"dw")
246 cgv::type::set_variant(default_w, value_type, value_ptr);
248 if (property ==
"dh")
249 cgv::type::set_variant(default_h, value_type, value_ptr);
bool empty() const
check if pointer is not yet set
virtual std::string get_property_declarations()
return a semicolon separated list of property declarations
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.
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.
virtual void update()
this virtual update allows for example to ask a view to update the viewed value. The default implemen...