diff options
author | frosch <frosch@openttd.org> | 2012-11-11 16:07:46 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2012-11-11 16:07:46 +0000 |
commit | b998cbdff145cd005949b6a005f435a916b0ea06 (patch) | |
tree | e94ce652424a290b5feb66067ec8bdf18f9b36d0 /src | |
parent | cfccaff6457964db5245ac144e81b581146bfd75 (diff) | |
download | openttd-b998cbdff145cd005949b6a005f435a916b0ea06.tar.xz |
(svn r24697) -Codechange: Use WDF_UNCLICK_BUTTONS instead of duplicating the same functionality.
Diffstat (limited to 'src')
-rw-r--r-- | src/order_gui.cpp | 21 | ||||
-rw-r--r-- | src/station_gui.cpp | 10 | ||||
-rw-r--r-- | src/terraform_gui.cpp | 12 | ||||
-rw-r--r-- | src/town_gui.cpp | 18 | ||||
-rw-r--r-- | src/tree_gui.cpp | 12 |
5 files changed, 12 insertions, 61 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 0e7579546..b1ad635ff 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -1500,21 +1500,6 @@ public: this->vscroll->SetCapacityFromWidget(this, WID_O_ORDER_LIST); } - virtual void OnTimeout() - { - static const int raise_widgets[] = { - WID_O_TIMETABLE_VIEW, WID_O_SKIP, WID_O_DELETE, WID_O_STOP_SHARING, WID_O_REFIT, WID_O_SHARED_ORDER_LIST, WIDGET_LIST_END, - }; - - /* Unclick all buttons in raise_widgets[]. */ - for (const int *widnum = raise_widgets; *widnum != WIDGET_LIST_END; widnum++) { - if (this->IsWidgetLowered(*widnum)) { - this->RaiseWidget(*widnum); - this->SetWidgetDirty(*widnum); - } - } - } - static Hotkey<OrdersWindow> order_hotkeys[]; }; @@ -1568,7 +1553,7 @@ static const NWidgetPart _nested_orders_train_widgets[] = { SetDataTip(STR_ORDER_SERVICE, STR_ORDER_SERVICE_TOOLTIP), SetResize(1, 0), EndContainer(), NWidget(NWID_SELECTION, INVALID_COLOUR, WID_O_SEL_TOP_RIGHT), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_EMPTY), SetMinimalSize(93, 12), SetFill(1, 0), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_O_EMPTY), SetMinimalSize(93, 12), SetFill(1, 0), SetDataTip(STR_ORDER_REFIT, STR_ORDER_REFIT_TOOLTIP), SetResize(1, 0), NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, WID_O_REFIT_DROPDOWN), SetMinimalSize(93, 12), SetFill(1, 0), SetDataTip(STR_ORDER_REFIT_AUTO, STR_ORDER_REFIT_AUTO_TOOLTIP), SetResize(1, 0), @@ -1607,7 +1592,7 @@ static const NWidgetPart _nested_orders_train_widgets[] = { static const WindowDesc _orders_train_desc( WDP_AUTO, 384, 100, WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, - WDF_CONSTRUCTION, + WDF_UNCLICK_BUTTONS | WDF_CONSTRUCTION, _nested_orders_train_widgets, lengthof(_nested_orders_train_widgets) ); @@ -1678,7 +1663,7 @@ static const NWidgetPart _nested_orders_widgets[] = { static const WindowDesc _orders_desc( WDP_AUTO, 384, 100, WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, - WDF_CONSTRUCTION, + WDF_UNCLICK_BUTTONS | WDF_CONSTRUCTION, _nested_orders_widgets, lengthof(_nested_orders_widgets) ); diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 32aadbae7..48def98f3 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -535,8 +535,6 @@ public: case WID_STL_SORTBY: // flip sorting method asc/desc this->stations.ToggleSortOrder(); - this->SetTimeout(); - this->LowerWidget(WID_STL_SORTBY); this->SetDirty(); break; @@ -610,12 +608,6 @@ public: } } - virtual void OnTimeout() - { - this->RaiseWidget(WID_STL_SORTBY); - this->SetDirty(); - } - virtual void OnResize() { this->vscroll->SetCapacityFromWidget(this, WID_STL_LIST, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM); @@ -705,7 +697,7 @@ static const NWidgetPart _nested_company_stations_widgets[] = { NWidget(WWT_PANEL, COLOUR_GREY), SetDataTip(0x0, STR_NULL), SetResize(1, 0), SetFill(1, 1), EndContainer(), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_STL_SORTBY), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_STL_SORTBY), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_STL_SORTDROPBTN), SetMinimalSize(163, 12), SetDataTip(STR_SORT_BY_NAME, STR_TOOLTIP_SORT_CRITERIA), // widget_data gets overwritten. NWidget(WWT_PANEL, COLOUR_GREY), SetDataTip(0x0, STR_NULL), SetResize(1, 0), SetFill(1, 1), EndContainer(), EndContainer(), diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index b288f383d..b89e17e71 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -197,8 +197,6 @@ struct TerraformToolbarWindow : Window { break; case WID_TT_PLANT_TREES: // Plant trees button - /* This button is NOT a place-push-button, so don't treat it as such */ - this->HandleButtonClick(WID_TT_PLANT_TREES); ShowBuildTreesToolbar(); break; @@ -220,12 +218,6 @@ struct TerraformToolbarWindow : Window { } } - virtual void OnTimeout() - { - this->RaiseWidget(WID_TT_PLANT_TREES); - this->SetWidgetDirty(WID_TT_PLANT_TREES); - } - virtual EventState OnKeyPress(uint16 key, uint16 keycode) { int num = CheckHotkeyMatch(terraform_hotkeys, keycode, this); @@ -338,7 +330,7 @@ static const NWidgetPart _nested_terraform_widgets[] = { SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_BUY_LAND), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUY_LAND, STR_LANDSCAPING_TOOLTIP_PURCHASE_LAND), - NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_PLANT_TREES), SetMinimalSize(22, 22), + NWidget(WWT_PUSHIMGBTN, COLOUR_DARK_GREEN, WID_TT_PLANT_TREES), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_PLANTTREES, STR_SCENEDIT_TOOLBAR_PLANT_TREES), NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_PLACE_SIGN), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SIGN, STR_SCENEDIT_TOOLBAR_PLACE_SIGN), @@ -352,7 +344,7 @@ static const NWidgetPart _nested_terraform_widgets[] = { static const WindowDesc _terraform_desc( WDP_MANUAL, 0, 0, WC_SCEN_LAND_GEN, WC_NONE, - WDF_CONSTRUCTION, + WDF_UNCLICK_BUTTONS | WDF_CONSTRUCTION, _nested_terraform_widgets, lengthof(_nested_terraform_widgets) ); diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 6a6a32b3f..5700ec2b7 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -923,15 +923,15 @@ static const NWidgetPart _nested_found_town_widgets[] = { NWidget(NWID_SPACER), SetMinimalSize(0, 2), NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_TF_NEW_TOWN), SetMinimalSize(156, 12), SetFill(1, 0), SetDataTip(STR_FOUND_TOWN_NEW_TOWN_BUTTON, STR_FOUND_TOWN_NEW_TOWN_TOOLTIP), SetPadding(0, 2, 1, 2), - NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_TF_RANDOM_TOWN), SetMinimalSize(156, 12), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TF_RANDOM_TOWN), SetMinimalSize(156, 12), SetFill(1, 0), SetDataTip(STR_FOUND_TOWN_RANDOM_TOWN_BUTTON, STR_FOUND_TOWN_RANDOM_TOWN_TOOLTIP), SetPadding(0, 2, 1, 2), - NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_TF_MANY_RANDOM_TOWNS), SetMinimalSize(156, 12), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TF_MANY_RANDOM_TOWNS), SetMinimalSize(156, 12), SetFill(1, 0), SetDataTip(STR_FOUND_TOWN_MANY_RANDOM_TOWNS, STR_FOUND_TOWN_RANDOM_TOWNS_TOOLTIP), SetPadding(0, 2, 0, 2), /* Town name selection. */ NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetMinimalSize(156, 14), SetPadding(0, 2, 0, 2), SetDataTip(STR_FOUND_TOWN_NAME_TITLE, STR_NULL), NWidget(WWT_EDITBOX, COLOUR_WHITE, WID_TF_TOWN_NAME_EDITBOX), SetMinimalSize(156, 12), SetPadding(0, 2, 3, 2), SetDataTip(STR_FOUND_TOWN_NAME_EDITOR_TITLE, STR_FOUND_TOWN_NAME_EDITOR_HELP), - NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_TF_TOWN_NAME_RANDOM), SetMinimalSize(78, 12), SetPadding(0, 2, 0, 2), SetFill(1, 0), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_TF_TOWN_NAME_RANDOM), SetMinimalSize(78, 12), SetPadding(0, 2, 0, 2), SetFill(1, 0), SetDataTip(STR_FOUND_TOWN_NAME_RANDOM_BUTTON, STR_FOUND_TOWN_NAME_RANDOM_TOOLTIP), /* Town size selection. */ NWidget(NWID_HORIZONTAL), SetPIP(2, 0, 2), @@ -1070,7 +1070,6 @@ public: break; case WID_TF_RANDOM_TOWN: - this->HandleButtonClick(WID_TF_RANDOM_TOWN); this->ExecuteFoundTownCommand(0, true, STR_ERROR_CAN_T_GENERATE_TOWN, CcFoundRandomTown); break; @@ -1080,8 +1079,6 @@ public: break; case WID_TF_MANY_RANDOM_TOWNS: - this->HandleButtonClick(WID_TF_MANY_RANDOM_TOWNS); - _generating_world = true; UpdateNearestTownForRoadTiles(true); if (!GenerateTowns(this->town_layout)) { @@ -1110,13 +1107,6 @@ public: } } - virtual void OnTimeout() - { - this->RaiseWidget(WID_TF_RANDOM_TOWN); - this->RaiseWidget(WID_TF_MANY_RANDOM_TOWNS); - this->SetDirty(); - } - virtual void OnMouseLoop() { this->HandleEditBox(WID_TF_TOWN_NAME_EDITBOX); @@ -1157,7 +1147,7 @@ public: static const WindowDesc _found_town_desc( WDP_AUTO, 160, 162, WC_FOUND_TOWN, WC_NONE, - WDF_CONSTRUCTION, + WDF_UNCLICK_BUTTONS | WDF_CONSTRUCTION, _nested_found_town_widgets, lengthof(_nested_found_town_widgets) ); diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp index 60dcde6e4..fbc4d5baa 100644 --- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -134,8 +134,6 @@ public: break; case WID_BT_MANY_RANDOM: // place trees randomly over the landscape - this->LowerWidget(WID_BT_MANY_RANDOM); - this->SetTimeout(); SndPlayFx(SND_15_BEEP); PlaceTreesRandomly(); MarkWholeScreenDirty(); @@ -170,12 +168,6 @@ public: this->count = _tree_count_by_landscape[_settings_game.game_creation.landscape]; } - virtual void OnTimeout() - { - this->RaiseWidget(WID_BT_MANY_RANDOM); - this->SetWidgetDirty(WID_BT_MANY_RANDOM); - } - virtual void OnPlaceObjectAbort() { this->RaiseButtons(); @@ -238,7 +230,7 @@ static const NWidgetPart _nested_build_trees_widgets[] = { NWidget(NWID_SPACER), SetMinimalSize(0, 1), NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BT_TYPE_RANDOM), SetMinimalSize(139, 12), SetDataTip(STR_TREES_RANDOM_TYPE, STR_TREES_RANDOM_TYPE_TOOLTIP), NWidget(NWID_SPACER), SetMinimalSize(0, 1), - NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BT_MANY_RANDOM), SetMinimalSize(139, 12), SetDataTip(STR_TREES_RANDOM_TREES_BUTTON, STR_TREES_RANDOM_TREES_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BT_MANY_RANDOM), SetMinimalSize(139, 12), SetDataTip(STR_TREES_RANDOM_TREES_BUTTON, STR_TREES_RANDOM_TREES_TOOLTIP), NWidget(NWID_SPACER), SetMinimalSize(0, 2), EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(2, 0), @@ -249,7 +241,7 @@ static const NWidgetPart _nested_build_trees_widgets[] = { static const WindowDesc _build_trees_desc( WDP_AUTO, 0, 0, WC_BUILD_TREES, WC_NONE, - WDF_CONSTRUCTION, + WDF_UNCLICK_BUTTONS | WDF_CONSTRUCTION, _nested_build_trees_widgets, lengthof(_nested_build_trees_widgets) ); |