summaryrefslogtreecommitdiff
path: root/src/widget.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-12-22 20:43:25 +0000
committeralberth <alberth@openttd.org>2009-12-22 20:43:25 +0000
commit3323d64f280cea84addc96d0018adaf93bb4e43b (patch)
tree3b19aa044205e1e454be4842a12f956840d49b0b /src/widget.cpp
parent7dbc77a1e74be00f520e84fa1605a9ba42a05879 (diff)
downloadopenttd-3323d64f280cea84addc96d0018adaf93bb4e43b.tar.xz
(svn r18606) -Codechange: Introduce several forms of zero-size stacked display planes.
Diffstat (limited to 'src/widget.cpp')
-rw-r--r--src/widget.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/widget.cpp b/src/widget.cpp
index a79d01197..bf8a7d97b 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -965,11 +965,11 @@ void NWidgetStacked::SetupSmallestSize(Window *w, bool init_array)
}
/* Zero size plane selected */
- if (this->shown_plane == STACKED_SELECTION_ZERO_SIZE) {
- Dimension size = {0, 0};
+ if (this->shown_plane >= SZSP_BEGIN) {
+ Dimension size = {0, 0};
Dimension padding = {0, 0};
- Dimension fill = {0, 0};
- Dimension resize = {0, 0};
+ Dimension fill = {(this->shown_plane == SZSP_HORIZONTAL), (this->shown_plane == SZSP_VERTICAL)};
+ Dimension resize = {(this->shown_plane == SZSP_HORIZONTAL), (this->shown_plane == SZSP_VERTICAL)};
/* Here we're primarily interested in the value of resize */
if (this->index >= 0) w->UpdateWidgetSize(this->index, &size, padding, &fill, &resize);
@@ -1006,7 +1006,7 @@ void NWidgetStacked::AssignSizePosition(SizingType sizing, uint x, uint y, uint
assert(given_width >= this->smallest_x && given_height >= this->smallest_y);
StoreSizePosition(sizing, x, y, given_width, given_height);
- if (this->shown_plane == STACKED_SELECTION_ZERO_SIZE) return;
+ if (this->shown_plane >= SZSP_BEGIN) return;
for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) {
uint hor_step = (sizing == ST_SMALLEST) ? 1 : child_wid->GetHorizontalStepSize(sizing);
@@ -1029,7 +1029,7 @@ void NWidgetStacked::FillNestedArray(NWidgetBase **array, uint length)
void NWidgetStacked::Draw(const Window *w)
{
- if (this->shown_plane == STACKED_SELECTION_ZERO_SIZE) return;
+ if (this->shown_plane >= SZSP_BEGIN) return;
int plane = 0;
for (NWidgetBase *child_wid = this->head; child_wid != NULL; plane++, child_wid = child_wid->next) {
@@ -1044,7 +1044,7 @@ void NWidgetStacked::Draw(const Window *w)
NWidgetCore *NWidgetStacked::GetWidgetFromPos(int x, int y)
{
- if (this->shown_plane == STACKED_SELECTION_ZERO_SIZE) return NULL;
+ if (this->shown_plane >= SZSP_BEGIN) return NULL;
if (!IsInsideBS(x, this->pos_x, this->current_x) || !IsInsideBS(y, this->pos_y, this->current_y)) return NULL;
int plane = 0;