summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-11-15 10:30:32 +0000
committerrubidium <rubidium@openttd.org>2009-11-15 10:30:32 +0000
commit9396a701fe74a998f9e677c15a4a768f5f3bd121 (patch)
tree8faad1dc55c65da7f7dd0e5a953619f7778a8bd4
parent3d2d7af88f95c2eb4e349c537f74eaf02e8db7f0 (diff)
downloadopenttd-9396a701fe74a998f9e677c15a4a768f5f3bd121.tar.xz
(svn r18087) -Codechange: remove NWID_LAYERED
-rw-r--r--src/smallmap_gui.cpp48
-rw-r--r--src/widget.cpp31
-rw-r--r--src/widget_type.h3
3 files changed, 33 insertions, 49 deletions
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index a9bb68492..9d39a4d94 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -67,32 +67,30 @@ static const NWidgetPart _nested_smallmap_widgets[] = {
/* Panel. */
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PANEL, COLOUR_BROWN, SM_WIDGET_LEGEND), SetMinimalSize(262, 44), SetResize(1, 0), EndContainer(),
- NWidget(NWID_LAYERED),
- NWidget(NWID_VERTICAL),
- /* Top button row. */
- NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, SM_WIDGET_CENTERMAP), SetMinimalSize(22, 22),
- SetDataTip(SPR_IMG_SMALLMAP, STR_SMALLMAP_CENTER),
- NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_CONTOUR), SetMinimalSize(22, 22),
- SetDataTip(SPR_IMG_SHOW_COUNTOURS, STR_SMALLMAP_TOOLTIP_SHOW_LAND_CONTOURS_ON_MAP),
- NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_VEHICLES), SetMinimalSize(22, 22),
- SetDataTip(SPR_IMG_SHOW_VEHICLES, STR_SMALLMAP_TOOLTIP_SHOW_VEHICLES_ON_MAP),
- NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_INDUSTRIES), SetMinimalSize(22, 22),
- SetDataTip(SPR_IMG_INDUSTRY, STR_SMALLMAP_TOOLTIP_SHOW_INDUSTRIES_ON_MAP),
- EndContainer(),
- /* Bottom button row. */
- NWidget(NWID_HORIZONTAL),
- NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_TOGGLETOWNNAME), SetMinimalSize(22, 22),
- SetDataTip(SPR_IMG_TOWN, STR_SMALLMAP_TOOLTIP_TOGGLE_TOWN_NAMES_ON_OFF),
- NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_ROUTES), SetMinimalSize(22, 22),
- SetDataTip(SPR_IMG_SHOW_ROUTES, STR_SMALLMAP_TOOLTIP_SHOW_TRANSPORT_ROUTES_ON),
- NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_VEGETATION), SetMinimalSize(22, 22),
- SetDataTip(SPR_IMG_PLANTTREES, STR_SMALLMAP_TOOLTIP_SHOW_VEGETATION_ON_MAP),
- NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_OWNERS), SetMinimalSize(22, 22),
- SetDataTip(SPR_IMG_COMPANY_GENERAL, STR_SMALLMAP_TOOLTIP_SHOW_LAND_OWNERS_ON_MAP),
- EndContainer(),
- NWidget(WWT_PANEL, COLOUR_BROWN, SM_WIDGET_BUTTONSPANEL), SetFill(true, true), EndContainer(),
+ NWidget(NWID_VERTICAL),
+ /* Top button row. */
+ NWidget(NWID_HORIZONTAL),
+ NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, SM_WIDGET_CENTERMAP), SetMinimalSize(22, 22),
+ SetDataTip(SPR_IMG_SMALLMAP, STR_SMALLMAP_CENTER),
+ NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_CONTOUR), SetMinimalSize(22, 22),
+ SetDataTip(SPR_IMG_SHOW_COUNTOURS, STR_SMALLMAP_TOOLTIP_SHOW_LAND_CONTOURS_ON_MAP),
+ NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_VEHICLES), SetMinimalSize(22, 22),
+ SetDataTip(SPR_IMG_SHOW_VEHICLES, STR_SMALLMAP_TOOLTIP_SHOW_VEHICLES_ON_MAP),
+ NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_INDUSTRIES), SetMinimalSize(22, 22),
+ SetDataTip(SPR_IMG_INDUSTRY, STR_SMALLMAP_TOOLTIP_SHOW_INDUSTRIES_ON_MAP),
+ EndContainer(),
+ /* Bottom button row. */
+ NWidget(NWID_HORIZONTAL),
+ NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_TOGGLETOWNNAME), SetMinimalSize(22, 22),
+ SetDataTip(SPR_IMG_TOWN, STR_SMALLMAP_TOOLTIP_TOGGLE_TOWN_NAMES_ON_OFF),
+ NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_ROUTES), SetMinimalSize(22, 22),
+ SetDataTip(SPR_IMG_SHOW_ROUTES, STR_SMALLMAP_TOOLTIP_SHOW_TRANSPORT_ROUTES_ON),
+ NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_VEGETATION), SetMinimalSize(22, 22),
+ SetDataTip(SPR_IMG_PLANTTREES, STR_SMALLMAP_TOOLTIP_SHOW_VEGETATION_ON_MAP),
+ NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_OWNERS), SetMinimalSize(22, 22),
+ SetDataTip(SPR_IMG_COMPANY_GENERAL, STR_SMALLMAP_TOOLTIP_SHOW_LAND_OWNERS_ON_MAP),
EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_BROWN, SM_WIDGET_BUTTONSPANEL), SetFill(true, true), EndContainer(),
EndContainer(),
EndContainer(),
/* Bottom button row and resize box. */
diff --git a/src/widget.cpp b/src/widget.cpp
index 21a3fc1f8..214570578 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -1175,9 +1175,8 @@ static inline uint ComputeOffset(uint space, uint max_space)
/**
* Widgets stacked on top of each other.
- * @param tp Kind of stacking, must be either #NWID_SELECTION or #NWID_LAYERED.
*/
-NWidgetStacked::NWidgetStacked(WidgetType tp) : NWidgetContainer(tp)
+NWidgetStacked::NWidgetStacked() : NWidgetContainer(NWID_SELECTION)
{
this->index = -1;
}
@@ -1268,21 +1267,15 @@ void NWidgetStacked::Draw(const Window *w)
{
if (this->shown_plane == STACKED_SELECTION_ZERO_SIZE) return;
- if (this->type == NWID_SELECTION) {
- int plane = 0;
- for (NWidgetBase *child_wid = this->head; child_wid != NULL; plane++, child_wid = child_wid->next) {
- if (plane == this->shown_plane) {
- child_wid->Draw(w);
- return;
- }
+ int plane = 0;
+ for (NWidgetBase *child_wid = this->head; child_wid != NULL; plane++, child_wid = child_wid->next) {
+ if (plane == this->shown_plane) {
+ child_wid->Draw(w);
+ return;
}
}
- assert(this->type == NWID_LAYERED);
- /* Render from back to front. */
- for (NWidgetBase *child_wid = this->tail; child_wid != NULL; child_wid = child_wid->prev) {
- child_wid->Draw(w);
- }
+ NOT_REACHED();
}
NWidgetCore *NWidgetStacked::GetWidgetFromPos(int x, int y)
@@ -2448,12 +2441,6 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest,
break;
}
- case NWID_LAYERED:
- if (*dest != NULL) return num_used;
- *dest = new NWidgetStacked(parts->type);
- *fill_dest = true;
- break;
-
case WPT_RESIZE: {
NWidgetResizeBase *nwrb = dynamic_cast<NWidgetResizeBase *>(*dest);
if (nwrb != NULL) {
@@ -2511,7 +2498,7 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest,
case NWID_SELECTION: {
if (*dest != NULL) return num_used;
- NWidgetStacked *nws = new NWidgetStacked(parts->type);
+ NWidgetStacked *nws = new NWidgetStacked();
*dest = nws;
*fill_dest = true;
nws->SetIndex(parts->u.widget.index);
@@ -2567,7 +2554,7 @@ static int MakeWidgetTree(const NWidgetPart *parts, int count, NWidgetBase *pare
/* If sub-widget is a container, recursively fill that container. */
WidgetType tp = sub_widget->type;
if (fill_sub && (tp == NWID_HORIZONTAL || tp == NWID_HORIZONTAL_LTR || tp == NWID_VERTICAL
- || tp == WWT_PANEL || tp == WWT_FRAME || tp == WWT_INSET || tp == NWID_SELECTION || tp == NWID_LAYERED)) {
+ || tp == WWT_PANEL || tp == WWT_FRAME || tp == WWT_INSET || tp == NWID_SELECTION)) {
int num_used = MakeWidgetTree(parts, count - total_used, sub_widget, biggest_index);
parts += num_used;
total_used += num_used;
diff --git a/src/widget_type.h b/src/widget_type.h
index f85c2ec3a..9c01a8b95 100644
--- a/src/widget_type.h
+++ b/src/widget_type.h
@@ -119,7 +119,6 @@ enum WidgetType {
NWID_VERTICAL, ///< Vertical container.
NWID_SPACER, ///< Invisible widget that takes some space.
NWID_SELECTION, ///< Stacked widgets, only one visible at a time (eg in a panel with tabs).
- NWID_LAYERED, ///< Widgets layered on top of each other, all visible at the same time.
NWID_VIEWPORT, ///< Nested widget containing a viewport.
NWID_BUTTON_DRPDOWN, ///< Button with a drop-down.
@@ -388,7 +387,7 @@ static const int STACKED_SELECTION_ZERO_SIZE = INT_MAX; ///< Display plane value
*/
class NWidgetStacked : public NWidgetContainer {
public:
- NWidgetStacked(WidgetType tp);
+ NWidgetStacked();
void SetIndex(int index);