cgv
Loading...
Searching...
No Matches
layout_table.h
1
#pragma once
2
3
#include <cgv/gui/layout.h>
4
5
#include <vector>
6
#include "lib_begin.h"
7
8
9
namespace
cgv
{
10
namespace
gui {
11
12
// struct containing information on one cell
13
struct
layout_table_cell
{
14
bool
can_shrink;
// can this cell be shrinked?
15
bool
can_expand;
// can this cell be expanded?
16
bool
can_fill;
// can this cell fill all avalable space?
17
int
min_size;
// minimum size for this cell
18
int
opt_size;
// optimal size for this cell
19
int
real_size;
20
21
void
reset() {
22
can_shrink =
false
;
23
can_expand =
false
;
24
can_fill =
false
;
25
min_size = 0;
26
opt_size = 0;
27
real_size = 0;
28
};
29
};
30
31
32
// layout to arrange children of a group that have a size and position
33
// (ie. are derived from resizable) in a table
34
class
CGV_API
layout_table
:
public
layout
35
{
36
public
:
37
layout_table
();
38
layout_table
(
cgv::base::group_ptr
container);
39
40
~layout_table
();
41
42
// the core update function to align the elements in a table
43
void
update();
44
45
// standard get and set methods
46
std::string get_property_declarations();
47
bool
set_void(
const
std::string& property,
const
std::string& value_type,
const
void
* value_ptr);
48
bool
get_void(
const
std::string& property,
const
std::string& value_type,
void
* value_ptr);
49
50
// get width of a column
51
int
get_column_width(
int
col);
52
// get height of a row
53
int
get_row_height(
int
row);
54
55
// get size of a cell
56
void
get_cell_size(
int
row,
int
col,
int
&width,
int
&height);
57
58
private
:
59
int
nr_cols, nr_rows;
60
layout_table_cell
*columns;
61
layout_table_cell
*rows;
62
bool
do_not_layout;
63
64
// calculate minimum and optimum size
65
void
initialize_space_tables();
66
67
void
delete_space_tables();
68
void
update_spaces_table(
layout_table_cell
&element,
int
opt_size,
int
min_size,
int
hints,
int
hints_shift);
69
bool
distribute_space(
layout_table_cell
*elements,
int
nr_elements,
int
new_size);
70
void
calculate_child_size(
layout_table_cell
&element,
int
opt_size,
int
min_size,
int
hints,
int
hints_shift,
int
&new_size);
71
void
calculate_child_pos(
layout_table_cell
&element,
int
child_size,
int
hints,
int
hints_shift,
int
&new_pos);
72
73
void
get_sizes(
layout_table_cell
*elements,
int
nr_elements,
int
*opt_size,
int
*min_size);
74
75
void
repair_default_values(
int
min_width,
int
min_height,
int
opt_width,
int
opt_height);
76
};
77
78
80
typedef
cgv::data::ref_ptr<layout_table>
layout_table_ptr
;
81
82
83
}
84
}
85
86
87
#include <cgv/config/lib_end.h>
cgv::data::ref_ptr< group, true >
cgv::gui::layout_table
Definition
layout_table.h:35
cgv::gui::layout
Definition
layout.h:55
cgv::gui::layout_table_ptr
cgv::data::ref_ptr< layout_table > layout_table_ptr
ref counted pointer to table layout
Definition
layout_table.h:80
cgv
the cgv namespace
Definition
print.h:11
cgv::gui::layout_table_cell
Definition
layout_table.h:13
cgv
gui
layout_table.h
Generated by
1.9.8