summaryrefslogtreecommitdiff
path: root/scene/gui/grid_container.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-06-08 09:39:20 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-06-08 10:36:26 -0300
commit7590f3db21f486988d8d59c4e6151344e3d40961 (patch)
treeb8006004ff68afb8db55a5ff6a2066ae296d5ca8 /scene/gui/grid_container.cpp
parentade337c3405815207560ddcb0f3b17dd7a87fd5e (diff)
grid container supports separate h and v spacing
closes #2049
Diffstat (limited to 'scene/gui/grid_container.cpp')
-rw-r--r--scene/gui/grid_container.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/scene/gui/grid_container.cpp b/scene/gui/grid_container.cpp
index 214d874675..105f66f368 100644
--- a/scene/gui/grid_container.cpp
+++ b/scene/gui/grid_container.cpp
@@ -40,7 +40,8 @@ void GridContainer::_notification(int p_what) {
Set<int> col_expanded;
Set<int> row_expanded;
- int sep=get_constant("separation");
+ int hsep=get_constant("hseparation");
+ int vsep=get_constant("vseparation");
int idx=0;
int max_row=0;
@@ -97,8 +98,8 @@ void GridContainer::_notification(int p_what) {
expand_rows++;
}
- ms.height+=sep*max_row;
- ms.width+=sep*max_col;
+ ms.height+=vsep*max_row;
+ ms.width+=hsep*max_col;
int row_expand = expand_rows?(size.y-ms.y)/expand_rows:0;
int col_expand = expand_cols?(size.x-ms.x)/expand_cols:0;
@@ -119,7 +120,7 @@ void GridContainer::_notification(int p_what) {
if (col==0) {
col_ofs=0;
if (row>0 && row_minh.has(row-1))
- row_ofs+=row_minh[row-1]+sep+(row_expanded.has(row-1)?row_expand:0);
+ row_ofs+=row_minh[row-1]+vsep+(row_expanded.has(row-1)?row_expand:0);
}
Size2 s;
@@ -140,7 +141,7 @@ void GridContainer::_notification(int p_what) {
//print_line("col: "+itos(col)+" row: "+itos(row)+" rect: "+Rect2(p,s));
if (col_minw.has(col)) {
- col_ofs+=col_minw[col]+sep+(col_expanded.has(col)?col_expand:0);
+ col_ofs+=col_minw[col]+hsep+(col_expanded.has(col)?col_expand:0);
}
idx++;
@@ -178,7 +179,8 @@ Size2 GridContainer::get_minimum_size() const {
Map<int,int> col_minw;
Map<int,int> row_minh;
- int sep=get_constant("separation");
+ int hsep=get_constant("hseparation");
+ int vsep=get_constant("vseparation");
int idx=0;
int max_row=0;
@@ -216,8 +218,8 @@ Size2 GridContainer::get_minimum_size() const {
ms.height+=E->get();
}
- ms.height+=sep*max_row;
- ms.width+=sep*max_col;
+ ms.height+=vsep*max_row;
+ ms.width+=hsep*max_col;
return ms;