(svn r8720) [cpp_gui] -Codechange: SetWindowWidgetLoweredState(), ToggleWidgetLoweredState(), LowerWindowWidget(), RaiseWindowWidget() and IsWindowWidgetLowered() turned into Window methods cpp_gui
authorKUDr
Tue, 13 Feb 2007 23:49:01 +0000
branchcpp_gui
changeset 6251 cd413fa2e252
parent 6250 5135b200b376
child 6252 ca57ad0b45ea
(svn r8720) [cpp_gui] -Codechange: SetWindowWidgetLoweredState(), ToggleWidgetLoweredState(), LowerWindowWidget(), RaiseWindowWidget() and IsWindowWidgetLowered() turned into Window methods
src/airport_gui.cpp
src/depot_gui.cpp
src/dock_gui.cpp
src/genworld_gui.cpp
src/graph_gui.cpp
src/intro_gui.cpp
src/main_gui.cpp
src/misc_gui.cpp
src/music_gui.cpp
src/network/network_gui.cpp
src/news_gui.cpp
src/order_gui.cpp
src/player_gui.cpp
src/rail_gui.cpp
src/road_gui.cpp
src/settings_gui.cpp
src/smallmap_gui.cpp
src/station_gui.cpp
src/widget.cpp
src/window.cpp
src/window.h
--- a/src/airport_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/airport_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -143,9 +143,9 @@
 {
 	switch (e->event) {
 	case WE_CREATE:
-		SetWindowWidgetLoweredState(w, 16, !_station_show_coverage);
-		SetWindowWidgetLoweredState(w, 17, _station_show_coverage);
-		LowerWindowWidget(w, _selected_airport_type + 7);
+		w->SetWidgetLoweredState(16, !_station_show_coverage);
+		w->SetWidgetLoweredState(17, _station_show_coverage);
+		w->LowerWidget(_selected_airport_type + 7);
 		break;
 
 	case WE_PAINT: {
@@ -158,10 +158,10 @@
 
 		avail_airports = GetValidAirports();
 
-		RaiseWindowWidget(w, _selected_airport_type + 7);
+		w->RaiseWidget(_selected_airport_type + 7);
 		if (!HASBIT(avail_airports, 0) && _selected_airport_type == AT_SMALL) _selected_airport_type = AT_LARGE;
 		if (!HASBIT(avail_airports, 1) && _selected_airport_type == AT_LARGE) _selected_airport_type = AT_SMALL;
-		LowerWindowWidget(w, _selected_airport_type + 7);
+		w->LowerWidget(_selected_airport_type + 7);
 
 		/* 'Country Airport' starts at widget 7, and if its bit is set, it is
 		 * available, so take its opposite value to set the disabled state.
@@ -202,16 +202,16 @@
 	case WE_CLICK: {
 		switch (e->we.click.widget) {
 		case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15:
-			RaiseWindowWidget(w, _selected_airport_type + 7);
+			w->RaiseWidget(_selected_airport_type + 7);
 			_selected_airport_type = e->we.click.widget - 7;
-			LowerWindowWidget(w, _selected_airport_type + 7);
+			w->LowerWidget(_selected_airport_type + 7);
 			SndPlayFx(SND_15_BEEP);
 			w->SetDirty();
 			break;
 		case 16: case 17:
 			_station_show_coverage = (e->we.click.widget != 16);
-			SetWindowWidgetLoweredState(w, 16, !_station_show_coverage);
-			SetWindowWidgetLoweredState(w, 17, _station_show_coverage);
+			w->SetWidgetLoweredState(16, !_station_show_coverage);
+			w->SetWidgetLoweredState(17, _station_show_coverage);
 			SndPlayFx(SND_15_BEEP);
 			w->SetDirty();
 			break;
--- a/src/depot_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/depot_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -803,9 +803,9 @@
 
 				case DEPOT_WIDGET_CLONE: // Clone button
 					w->InvalidateWidget(DEPOT_WIDGET_CLONE);
-					ToggleWidgetLoweredState(w, DEPOT_WIDGET_CLONE);
+					w->ToggleWidgetLoweredState(DEPOT_WIDGET_CLONE);
 
-					if (IsWindowWidgetLowered(w, DEPOT_WIDGET_CLONE)) {
+					if (w->IsWidgetLowered(DEPOT_WIDGET_CLONE)) {
 						static const CursorID clone_icons[] = {
 							SPR_CURSOR_CLONE_TRAIN, SPR_CURSOR_CLONE_ROADVEH,
 							SPR_CURSOR_CLONE_SHIP, SPR_CURSOR_CLONE_AIRPLANE
@@ -863,7 +863,7 @@
 		} break;
 
 		case WE_ABORT_PLACE_OBJ: {
-			RaiseWindowWidget(w, DEPOT_WIDGET_CLONE);
+			w->RaiseWidget(DEPOT_WIDGET_CLONE);
 			w->InvalidateWidget(DEPOT_WIDGET_CLONE);
 		} break;
 
@@ -872,7 +872,7 @@
 			const Vehicle *v = _place_clicked_vehicle;
 
 			/* since OTTD checks all open depot windows, we will make sure that it triggers the one with a clicked clone button */
-			if (v != NULL && IsWindowWidgetLowered(w, DEPOT_WIDGET_CLONE)) {
+			if (v != NULL && w->IsWidgetLowered(DEPOT_WIDGET_CLONE)) {
 				_place_clicked_vehicle = NULL;
 				HandleCloneVehClick(v, w);
 			}
--- a/src/dock_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/dock_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -226,7 +226,7 @@
 static void BuildDockStationWndProc(Window *w, WindowEvent *e)
 {
 	switch (e->event) {
-	case WE_CREATE: LowerWindowWidget(w, _station_show_coverage + 3); break;
+	case WE_CREATE: w->LowerWidget(_station_show_coverage + 3); break;
 
 	case WE_PAINT: {
 		int rad;
@@ -246,9 +246,9 @@
 		switch (e->we.click.widget) {
 			case 3:
 			case 4:
-				RaiseWindowWidget(w, _station_show_coverage + 3);
+				w->RaiseWidget(_station_show_coverage + 3);
 				_station_show_coverage = (e->we.click.widget != 3);
-				LowerWindowWidget(w, _station_show_coverage + 3);
+				w->LowerWidget(_station_show_coverage + 3);
 				SndPlayFx(SND_15_BEEP);
 				w->SetDirty();
 				break;
@@ -305,7 +305,7 @@
 static void BuildDocksDepotWndProc(Window *w, WindowEvent *e)
 {
 	switch (e->event) {
-	case WE_CREATE: LowerWindowWidget(w, _ship_depot_direction + 3); break;
+	case WE_CREATE: w->LowerWidget(_ship_depot_direction + 3); break;
 
 	case WE_PAINT:
 		w->DrawWidgets();
@@ -320,9 +320,9 @@
 		switch (e->we.click.widget) {
 		case 3:
 		case 4:
-			RaiseWindowWidget(w, _ship_depot_direction + 3);
+			w->RaiseWidget(_ship_depot_direction + 3);
 			_ship_depot_direction = (e->we.click.widget == 3 ? AXIS_X : AXIS_Y);
-			LowerWindowWidget(w, _ship_depot_direction + 3);
+			w->LowerWidget(_ship_depot_direction + 3);
 			SndPlayFx(SND_15_BEEP);
 			UpdateDocksDirection();
 			w->SetDirty();
--- a/src/genworld_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/genworld_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -223,7 +223,7 @@
 
 	switch (e->event) {
 	case WE_CREATE:
-		LowerWindowWidget(w, _opt_newgame.landscape + GLAND_TEMPERATE);
+		w->LowerWidget(_opt_newgame.landscape + GLAND_TEMPERATE);
 
 		snprintf(_genseed_buffer, sizeof(_genseed_buffer), "%u", _patches_newgame.generation_seed);
 		InitializeTextBuffer(&_genseed_query.text, _genseed_buffer, lengthof(_genseed_buffer), 120);
@@ -252,10 +252,10 @@
 		w->SetWidgetDisabledState(GLAND_SNOW_LEVEL_DOWN, _patches_newgame.snow_line_height <= 2 || _opt_newgame.landscape != LT_HILLY);
 		w->SetWidgetDisabledState(GLAND_SNOW_LEVEL_UP,   _patches_newgame.snow_line_height >= 13 || _opt_newgame.landscape != LT_HILLY);
 
-		SetWindowWidgetLoweredState(w, GLAND_TEMPERATE, _opt_newgame.landscape == LT_NORMAL);
-		SetWindowWidgetLoweredState(w, GLAND_ARCTIC,    _opt_newgame.landscape == LT_HILLY);
-		SetWindowWidgetLoweredState(w, GLAND_TROPICAL,  _opt_newgame.landscape == LT_DESERT);
-		SetWindowWidgetLoweredState(w, GLAND_TOYLAND,   _opt_newgame.landscape == LT_CANDY);
+		w->SetWidgetLoweredState(GLAND_TEMPERATE, _opt_newgame.landscape == LT_NORMAL);
+		w->SetWidgetLoweredState(GLAND_ARCTIC,    _opt_newgame.landscape == LT_HILLY);
+		w->SetWidgetLoweredState(GLAND_TROPICAL,  _opt_newgame.landscape == LT_DESERT);
+		w->SetWidgetLoweredState(GLAND_TOYLAND,   _opt_newgame.landscape == LT_CANDY);
 		w->DrawWidgets();
 
 		y = (mode == GLWP_HEIGHTMAP) ? 22 : 0;
@@ -330,7 +330,7 @@
 		switch (e->we.click.widget) {
 		case 0: w->Close(); break;
 		case GLAND_TEMPERATE: case GLAND_ARCTIC: case GLAND_TROPICAL: case GLAND_TOYLAND:
-			RaiseWindowWidget(w, _opt_newgame.landscape + GLAND_TEMPERATE);
+			w->RaiseWidget(_opt_newgame.landscape + GLAND_TEMPERATE);
 			SetNewLandscapeType(e->we.click.widget - GLAND_TEMPERATE);
 			break;
 		case GLAND_MAPSIZE_X_TEXT: case GLAND_MAPSIZE_X_PULLDOWN: // Mapsize X
@@ -579,7 +579,7 @@
 	static const StringID mapsizes[] = {STR_64, STR_128, STR_256, STR_512, STR_1024, STR_2048, INVALID_STRING_ID};
 
 	switch (e->event) {
-	case WE_CREATE: LowerWindowWidget(w, _opt_newgame.landscape + CSCEN_TEMPERATE); break;
+	case WE_CREATE: w->LowerWidget(_opt_newgame.landscape + CSCEN_TEMPERATE); break;
 
 	case WE_PAINT:
 		w->SetWidgetDisabledState(CSCEN_START_DATE_DOWN,       _patches_newgame.starting_year <= MIN_YEAR);
@@ -587,10 +587,10 @@
 		w->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_DOWN, _patches_newgame.se_flat_world_height <= 0);
 		w->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_UP,   _patches_newgame.se_flat_world_height >= 15);
 
-		SetWindowWidgetLoweredState(w, CSCEN_TEMPERATE, _opt_newgame.landscape == LT_NORMAL);
-		SetWindowWidgetLoweredState(w, CSCEN_ARCTIC,    _opt_newgame.landscape == LT_HILLY);
-		SetWindowWidgetLoweredState(w, CSCEN_TROPICAL,  _opt_newgame.landscape == LT_DESERT);
-		SetWindowWidgetLoweredState(w, CSCEN_TOYLAND,   _opt_newgame.landscape == LT_CANDY);
+		w->SetWidgetLoweredState(CSCEN_TEMPERATE, _opt_newgame.landscape == LT_NORMAL);
+		w->SetWidgetLoweredState(CSCEN_ARCTIC,    _opt_newgame.landscape == LT_HILLY);
+		w->SetWidgetLoweredState(CSCEN_TROPICAL,  _opt_newgame.landscape == LT_DESERT);
+		w->SetWidgetLoweredState(CSCEN_TOYLAND,   _opt_newgame.landscape == LT_CANDY);
 		w->DrawWidgets();
 
 		DrawStringRightAligned(211, 97, STR_MAPSIZE, 0);
@@ -610,7 +610,7 @@
 	case WE_CLICK:
 		switch (e->we.click.widget) {
 		case CSCEN_TEMPERATE: case CSCEN_ARCTIC: case CSCEN_TROPICAL: case CSCEN_TOYLAND:
-			RaiseWindowWidget(w, _opt_newgame.landscape + CSCEN_TEMPERATE);
+			w->RaiseWidget(_opt_newgame.landscape + CSCEN_TEMPERATE);
 			SetNewLandscapeType(e->we.click.widget - CSCEN_TEMPERATE);
 			break;
 		case CSCEN_MAPSIZE_X_TEXT: case CSCEN_MAPSIZE_X_PULLDOWN: // Mapsize X
--- a/src/graph_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/graph_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -251,7 +251,7 @@
 	case WE_CREATE: {
 		uint i;
 		for (i = 3; i < w->widget_count; i++) {
-			if (!HASBIT(_legend_excluded_players, i - 3)) LowerWindowWidget(w, i);
+			if (!HASBIT(_legend_excluded_players, i - 3)) w->LowerWidget(i);
 		}
 		break;
 	}
@@ -260,7 +260,7 @@
 		FOR_ALL_PLAYERS(p) {
 			if (!p->is_active) {
 				SETBIT(_legend_excluded_players, p->index);
-				RaiseWindowWidget(w, p->index + 3);
+				w->RaiseWidget(p->index + 3);
 			}
 		}
 		w->DrawWidgets();
@@ -280,7 +280,7 @@
 	case WE_CLICK:
 		if (IS_INT_INSIDE(e->we.click.widget, 3, 11)) {
 			TOGGLEBIT(_legend_excluded_players, e->we.click.widget - 3);
-			ToggleWidgetLoweredState(w, e->we.click.widget);
+			w->ToggleWidgetLoweredState(e->we.click.widget);
 			w->SetDirty();
 			InvalidateWindow(WC_INCOME_GRAPH, 0);
 			InvalidateWindow(WC_OPERATING_PROFIT, 0);
@@ -715,7 +715,7 @@
 	case WE_CREATE: {
 		uint i;
 		for (i = 3; i < w->widget_count; i++) {
-			if (!HASBIT(_legend_excluded_cargo, i - 3)) LowerWindowWidget(w, i);
+			if (!HASBIT(_legend_excluded_cargo, i - 3)) w->LowerWidget(i);
 		}
 		break;
 	}
@@ -748,7 +748,7 @@
 			 * both the text and the colored box have to be manually painted.
 			 * clk_dif will move one pixel down and one pixel to the right
 			 * when the button is clicked */
-			byte clk_dif = IsWindowWidgetLowered(w, i + 3) ? 1 : 0;
+			byte clk_dif = w->IsWidgetLowered(i + 3) ? 1 : 0;
 
 			GfxFillRect(x + clk_dif, y + clk_dif, x + 8 + clk_dif, y + 5 + clk_dif, 0);
 			GfxFillRect(x + 1 + clk_dif, y + 1 + clk_dif, x + 7 + clk_dif, y + 4 + clk_dif, _cargo_colours[i]);
@@ -773,7 +773,7 @@
 		case 7: case 8: case 9: case 10:
 		case 11: case 12: case 13: case 14:
 			TOGGLEBIT(_legend_excluded_cargo, e->we.click.widget - 3);
-			ToggleWidgetLoweredState(w, e->we.click.widget);
+			w->ToggleWidgetLoweredState(e->we.click.widget);
 			w->SetDirty();
 			break;
 		}
@@ -927,7 +927,7 @@
 			if (_performance_rating_detail_player == INVALID_PLAYER || !GetPlayer(_performance_rating_detail_player)->is_active) {
 				if (_performance_rating_detail_player != INVALID_PLAYER) {
 					/* Raise and disable the widget for the previous selection. */
-					RaiseWindowWidget(w, _performance_rating_detail_player + 13);
+					w->RaiseWidget(_performance_rating_detail_player + 13);
 					w->DisableWidget(_performance_rating_detail_player + 13);
 					w->SetDirty();
 
@@ -937,7 +937,7 @@
 				for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) {
 					if (GetPlayer(i)->is_active) {
 						/* Lower the widget corresponding to this player. */
-						LowerWindowWidget(w, i + 13);
+						w->LowerWidget(i + 13);
 						w->SetDirty();
 
 						_performance_rating_detail_player = i;
@@ -1054,9 +1054,9 @@
 			if (IS_INT_INSIDE(e->we.click.widget, 13, 21)) {
 				// Is it no on disable?
 				if (!w->IsWidgetDisabled(e->we.click.widget)) {
-					RaiseWindowWidget(w, _performance_rating_detail_player + 13);
+					w->RaiseWidget(_performance_rating_detail_player + 13);
 					_performance_rating_detail_player = (PlayerID)(e->we.click.widget - 13);
-					LowerWindowWidget(w, _performance_rating_detail_player + 13);
+					w->LowerWidget(_performance_rating_detail_player + 13);
 					w->SetDirty();
 				}
 			}
@@ -1079,7 +1079,7 @@
 			w->custom[0] = DAY_TICKS;
 			w->custom[1] = 5;
 
-			if (_performance_rating_detail_player != INVALID_PLAYER) LowerWindowWidget(w, _performance_rating_detail_player + 13);
+			if (_performance_rating_detail_player != INVALID_PLAYER) w->LowerWidget(_performance_rating_detail_player + 13);
 			w->SetDirty();
 
 			break;
--- a/src/intro_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/intro_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -50,13 +50,13 @@
 static void SelectGameWndProc(Window *w, WindowEvent *e)
 {
 	switch (e->event) {
-	case WE_CREATE: LowerWindowWidget(w, _opt_newgame.landscape + 8); break;
+	case WE_CREATE: w->LowerWidget(_opt_newgame.landscape + 8); break;
 
 	case WE_PAINT:
-		SetWindowWidgetLoweredState(w, 8,  _opt_newgame.landscape == LT_NORMAL);
-		SetWindowWidgetLoweredState(w, 9,  _opt_newgame.landscape == LT_HILLY);
-		SetWindowWidgetLoweredState(w, 10, _opt_newgame.landscape == LT_DESERT);
-		SetWindowWidgetLoweredState(w, 11, _opt_newgame.landscape == LT_CANDY);
+		w->SetWidgetLoweredState(8,  _opt_newgame.landscape == LT_NORMAL);
+		w->SetWidgetLoweredState(9,  _opt_newgame.landscape == LT_HILLY);
+		w->SetWidgetLoweredState(10, _opt_newgame.landscape == LT_DESERT);
+		w->SetWidgetLoweredState(11, _opt_newgame.landscape == LT_CANDY);
 		SetDParam(0, STR_6801_EASY + _opt_newgame.diff_level);
 		w->DrawWidgets();
 		break;
@@ -76,7 +76,7 @@
 			}
 			break;
 		case 8: case 9: case 10: case 11:
-			RaiseWindowWidget(w, _opt_newgame.landscape + 8);
+			w->RaiseWidget(_opt_newgame.landscape + 8);
 			SetNewLandscapeType(e->we.click.widget - 8);
 			break;
 		case 12: ShowGameOptions(); break;
--- a/src/main_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/main_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -113,13 +113,13 @@
 	SndPlayFx(SND_15_BEEP);
 	w->SetDirty();
 
-	if (IsWindowWidgetLowered(w, widget)) {
+	if (w->IsWidgetLowered(widget)) {
 		ResetObjectToPlace();
 		return false;
 	}
 
 	SetObjectToPlace(cursor, PAL_NONE, mode, w->window_class, w->window_number);
-	LowerWindowWidget(w, widget);
+	w->LowerWidget(widget);
 	_place_proc = placeproc;
 	return true;
 }
@@ -457,7 +457,7 @@
 
 	case WE_DESTROY: {
 			Window *v = Window::FindById(WC_MAIN_TOOLBAR, 0);
-			RaiseWindowWidget(v, WP(w,menu_d).main_button);
+			v->RaiseWidget(WP(w,menu_d).main_button);
 			v->SetDirty();
 			return;
 		}
@@ -592,7 +592,7 @@
 
 	case WE_DESTROY: {
 		Window *v = Window::FindById(WC_MAIN_TOOLBAR, 0);
-		RaiseWindowWidget(v, WP(w,menu_d).main_button);
+		v->RaiseWidget(WP(w,menu_d).main_button);
 		v->SetDirty();
 		return;
 		}
@@ -694,7 +694,7 @@
 	int x = w->widget[GB(parent_button, 0, 8)].left;
 
 	assert(disabled_mask == 0 || item_count <= 8);
-	LowerWindowWidget(w, parent_button);
+	w->LowerWidget(parent_button);
 	w->InvalidateWidget(parent_button);
 
 	DeleteWindowById(WC_TOOLBAR_MENU, 0);
@@ -729,7 +729,7 @@
 {
 	x += w->left;
 
-	LowerWindowWidget(w, main_button);
+	w->LowerWidget(main_button);
 	w->InvalidateWidget(main_button);
 
 	DeleteWindowById(WC_TOOLBAR_MENU, 0);
@@ -1289,7 +1289,7 @@
 			} while (--n);
 		}
 
-		if (IsWindowWidgetLowered(w, 5) || IsWindowWidgetLowered(w, 6)) // change area-size if raise/lower corner is selected
+		if (w->IsWidgetLowered(5) || w->IsWidgetLowered(6)) // change area-size if raise/lower corner is selected
 			SetTileSelectSize(_terraform_size, _terraform_size);
 
 		break;
@@ -1339,8 +1339,8 @@
 	case WE_TIMEOUT: {
 		uint i;
 		for (i = 0; i < w->widget_count; i++) {
-			if (IsWindowWidgetLowered(w, i)) {
-				RaiseWindowWidget(w, i);
+			if (w->IsWidgetLowered(i)) {
+				w->RaiseWidget(i);
 				w->InvalidateWidget(i);
 			}
 			if (i == 3) i = 11;
@@ -1426,7 +1426,7 @@
 		break;
 
 	case WE_CREATE:
-		LowerWindowWidget(w, (_scengen_town_size - 1)+ 7);
+		w->LowerWidget((_scengen_town_size - 1)+ 7);
 		break;
 
 	case WE_CLICK:
@@ -1460,17 +1460,17 @@
 		}
 
 		case 7: case 8: case 9:
-			RaiseWindowWidget(w, (_scengen_town_size - 1) + 7);
+			w->RaiseWidget((_scengen_town_size - 1) + 7);
 			_scengen_town_size = (e->we.click.widget - 7) + 1;
-			LowerWindowWidget(w, (_scengen_town_size - 1) + 7);
+			w->LowerWidget((_scengen_town_size - 1) + 7);
 			w->SetDirty();
 			break;
 		}
 		break;
 
 	case WE_TIMEOUT:
-		RaiseWindowWidget(w, 5);
-		RaiseWindowWidget(w, 6);
+		w->RaiseWidget(5);
+		w->RaiseWidget(6);
 		w->SetDirty();
 		break;
 	case WE_PLACE_OBJ:
@@ -1478,7 +1478,7 @@
 		break;
 	case WE_ABORT_PLACE_OBJ:
 		w->RaiseButtons();
-		LowerWindowWidget(w, (_scengen_town_size - 1) + 7);
+		w->LowerWidget((_scengen_town_size - 1) + 7);
 		w->SetDirty();
 		break;
 	}
@@ -1689,7 +1689,7 @@
 		w->SetDirty();
 		break;
 	case WE_TIMEOUT:
-		RaiseWindowWidget(w, 3);
+		w->RaiseWidget(3);
 		w->InvalidateWidget(3);
 		break;
 	}
@@ -1864,18 +1864,18 @@
 	} break;
 
 	case WE_ABORT_PLACE_OBJ: {
-		RaiseWindowWidget(w, 25);
+		w->RaiseWidget(25);
 		w->SetDirty();
 	} break;
 
 	case WE_MOUSELOOP:
-		if (IsWindowWidgetLowered(w, 0) != !!_pause) {
-			ToggleWidgetLoweredState(w, 0);
+		if (w->IsWidgetLowered(0) != !!_pause) {
+			w->ToggleWidgetLoweredState(0);
 			w->InvalidateWidget(0);
 		}
 
-		if (IsWindowWidgetLowered(w, 1) != !!_fast_forward) {
-			ToggleWidgetLoweredState(w, 1);
+		if (w->IsWidgetLowered(1) != !!_fast_forward) {
+			w->ToggleWidgetLoweredState(1);
 			w->InvalidateWidget(1);
 		}
 		break;
@@ -1883,8 +1883,8 @@
 	case WE_TIMEOUT: {
 		uint i;
 		for (i = 2; i < w->widget_count; i++) {
-			if (IsWindowWidgetLowered(w, i)) {
-				RaiseWindowWidget(w, i);
+			if (w->IsWidgetLowered(i)) {
+				w->RaiseWidget(i);
 				w->InvalidateWidget(i);
 			}
 		}
@@ -2063,18 +2063,18 @@
 	} break;
 
 	case WE_ABORT_PLACE_OBJ: {
-		RaiseWindowWidget(w, 25);
+		w->RaiseWidget(25);
 		w->SetDirty();
 	} break;
 
 	case WE_MOUSELOOP:
-		if (IsWindowWidgetLowered(w, 0) != !!_pause) {
-			ToggleWidgetLoweredState(w, 0);
+		if (w->IsWidgetLowered(0) != !!_pause) {
+			w->ToggleWidgetLoweredState(0);
 			w->SetDirty();
 		}
 
-		if (IsWindowWidgetLowered(w, 1) != !!_fast_forward) {
-			ToggleWidgetLoweredState(w, 1);
+		if (w->IsWidgetLowered(1) != !!_fast_forward) {
+			w->ToggleWidgetLoweredState(1);
 			w->SetDirty();
 		}
 		break;
--- a/src/misc_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/misc_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -368,7 +368,7 @@
 			break;
 
 		case 16: /* place trees randomly over the landscape*/
-			LowerWindowWidget(w, 16);
+			w->LowerWidget(16);
 			w->autorepeat_timeout = 5;
 			SndPlayFx(SND_15_BEEP);
 			PlaceTreesRandomly();
@@ -394,7 +394,7 @@
 		break;
 
 	case WE_TIMEOUT:
-		RaiseWindowWidget(w, 16);
+		w->RaiseWidget(16);
 		break;
 
 	case WE_ABORT_PLACE_OBJ:
@@ -1175,7 +1175,7 @@
 		WP(w, querystr_d).orig = orig_str_buf;
 	}
 
-	LowerWindowWidget(w, QUERY_STR_WIDGET_TEXT);
+	w->LowerWidget(QUERY_STR_WIDGET_TEXT);
 	WP(w, querystr_d).caption = caption;
 	WP(w, querystr_d).afilter = afilter;
 	InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, realmaxlen, maxwidth);
@@ -1549,7 +1549,7 @@
 		 * in those two saveload mode  */
 		if (!(_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO)) break;
 
-		if (IsWindowWidgetLowered(w, 11)) { /* Delete button clicked */
+		if (w->IsWidgetLowered(11)) { /* Delete button clicked */
 			if (!FiosDelete(WP(w,querystr_d).text.buf)) {
 				ShowErrorMessage(INVALID_STRING_ID, STR_4008_UNABLE_TO_DELETE_FILE, 0, 0);
 			} else {
@@ -1560,7 +1560,7 @@
 
 			UpdateTextBufferSize(&WP(w, querystr_d).text);
 			w->SetDirty();
-		} else if (IsWindowWidgetLowered(w, 12)) { /* Save button clicked */
+		} else if (w->IsWidgetLowered(12)) { /* Save button clicked */
 			_switch_mode = SM_SAVE;
 			FiosMakeSavegameName(_file_to_saveload.name, WP(w,querystr_d).text.buf, sizeof(_file_to_saveload.name));
 
@@ -1645,7 +1645,7 @@
 	w->resize.step_width = 2;
 	w->resize.step_height = 10;
 	w->resize.height = w->height - 14 * 10; // Minimum of 10 items
-	LowerWindowWidget(w, 7);
+	w->LowerWidget(7);
 
 	WP(w, querystr_d).afilter = CS_ALPHANUMERAL;
 	InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, lengthof(_edit_str_buf), 240);
--- a/src/music_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/music_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -201,8 +201,8 @@
 		int y;
 
 		w->SetWidgetDisabledState(11, msf.playlist <= 3);
-		LowerWindowWidget(w, 3);
-		LowerWindowWidget(w, 4);
+		w->LowerWidget(3);
+		w->LowerWidget(4);
 		w->DrawWidgets();
 
 		GfxFillRect(3, 23, 3+177,23+191,0);
@@ -343,8 +343,8 @@
 		uint i;
 		StringID str;
 
-		RaiseWindowWidget(w, 7);
-		RaiseWindowWidget(w, 9);
+		w->RaiseWidget(7);
+		w->RaiseWidget(9);
 		w->DrawWidgets();
 
 		GfxFillRect(187, 16, 200, 33, 0);
--- a/src/network/network_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/network/network_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -1705,7 +1705,7 @@
 
 	w = AllocateWindowDesc(&_chat_window_desc);
 
-	LowerWindowWidget(w, 2);
+	w->LowerWidget(2);
 	WP(w, querystr_d).caption = GB(type, 0, 8) | (dest << 8); // Misuse of caption
 	WP(w, querystr_d).afilter = CS_ALPHANUMERAL;
 	InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, lengthof(_edit_str_buf), 0);
--- a/src/news_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/news_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -745,7 +745,7 @@
 		int click_state = WP(w, def_d).data_1;
 		int i, y;
 
-		if (_news_ticker_sound) LowerWindowWidget(w, 25);
+		if (_news_ticker_sound) w->LowerWidget(25);
 		w->DrawWidgets();
 
 		/* XXX - Draw the fake widgets-buttons. Can't add these to the widget-desc since
@@ -784,7 +784,7 @@
 			break;
 		case 25: /* Change ticker sound on/off */
 			_news_ticker_sound ^= 1;
-			ToggleWidgetLoweredState(w, e->we.click.widget);
+			w->ToggleWidgetLoweredState(e->we.click.widget);
 			w->InvalidateWidget(e->we.click.widget);
 			break;
 		default: { /* Clicked on the [<] .. [>] widgets */
--- a/src/order_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/order_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -357,8 +357,8 @@
 static void OrderClick_Goto(Window *w, const Vehicle *v)
 {
 	w->InvalidateWidget(ORDER_WIDGET_GOTO);
-	ToggleWidgetLoweredState(w, ORDER_WIDGET_GOTO);
-	if (IsWindowWidgetLowered(w, ORDER_WIDGET_GOTO)) {
+	w->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO);
+	if (w->IsWidgetLowered(ORDER_WIDGET_GOTO)) {
 		_place_clicked_vehicle = NULL;
 		SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, 1, w);
 	} else {
@@ -548,7 +548,7 @@
 	} break;
 
 	case WE_ABORT_PLACE_OBJ: {
-		RaiseWindowWidget(w, ORDER_WIDGET_GOTO);
+		w->RaiseWidget(ORDER_WIDGET_GOTO);
 		w->InvalidateWidget( ORDER_WIDGET_GOTO);
 	} break;
 
@@ -563,7 +563,7 @@
 		 * the order is copied to the last open window instead of the
 		 * one where GOTO is enabled
 		 */
-		if (v != NULL && IsWindowWidgetLowered(w, ORDER_WIDGET_GOTO)) {
+		if (v != NULL && w->IsWidgetLowered(ORDER_WIDGET_GOTO)) {
 			_place_clicked_vehicle = NULL;
 			HandleOrderVehClick(GetVehicle(w->window_number), v, w);
 		}
@@ -578,8 +578,8 @@
 		// unclick all buttons except for the 'goto' button (ORDER_WIDGET_GOTO), which is 'persistent'
 		uint i;
 		for (i = 0; i < w->widget_count; i++) {
-			if (IsWindowWidgetLowered(w, i) && i != ORDER_WIDGET_GOTO) {
-				RaiseWindowWidget(w, i);
+			if (w->IsWidgetLowered(i) && i != ORDER_WIDGET_GOTO) {
+				w->RaiseWidget(i);
 				w->InvalidateWidget(i);
 			}
 		}
--- a/src/player_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/player_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -319,7 +319,7 @@
 {
 	switch (e->event) {
 		case WE_CREATE:
-			LowerWindowWidget(w, WP(w, livery_d).livery_class + 2);
+			w->LowerWidget(WP(w, livery_d).livery_class + 2);
 			if (!_have_2cc) {
 				w->HideWidget(11);
 				w->HideWidget(12);
@@ -383,10 +383,10 @@
 				case 6: {
 					LiveryScheme scheme;
 
-					RaiseWindowWidget(w, WP(w, livery_d).livery_class + 2);
+					w->RaiseWidget(WP(w, livery_d).livery_class + 2);
 					WP(w, livery_d).livery_class = (LiveryClass)(e->we.click.widget - 2);
 					WP(w, livery_d).sel = 0;
-					LowerWindowWidget(w, WP(w, livery_d).livery_class + 2);
+					w->LowerWidget(WP(w, livery_d).livery_class + 2);
 
 					/* Select the first item in the list */
 					for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
@@ -510,7 +510,7 @@
 	switch (e->event) {
 	case WE_PAINT: {
 		Player *p;
-		LowerWindowWidget(w, WP(w, facesel_d).gender + 5);
+		w->LowerWidget(WP(w, facesel_d).gender + 5);
 		w->DrawWidgets();
 		p = GetPlayer((PlayerID)w->window_number);
 		DrawPlayerFace(WP(w,facesel_d).face, p->player_color, 2, 16);
@@ -525,9 +525,9 @@
 			break;
 		case 5: /* male click */
 		case 6: /* female click */
-			RaiseWindowWidget(w, WP(w, facesel_d).gender + 5);
+			w->RaiseWidget(WP(w, facesel_d).gender + 5);
 			WP(w, facesel_d).gender = e->we.click.widget - 5;
-			LowerWindowWidget(w, WP(w, facesel_d).gender + 5);
+			w->LowerWidget(WP(w, facesel_d).gender + 5);
 			w->SetDirty();
 			break;
 		case 7:
@@ -757,7 +757,7 @@
 						wf->caption_color = wf->window_number;
 						WP(wf,livery_d).livery_class = LC_OTHER;
 						WP(wf,livery_d).sel = 1;
-						LowerWindowWidget(wf, 2);
+						wf->LowerWidget(2);
 					}
 					break;
 				}
@@ -785,7 +785,7 @@
 							return;
 						SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, 1, w);
 						SetTileSelectSize(2, 2);
-						LowerWindowWidget(w, PCW_WIDGET_BUILD_VIEW_HQ);
+						w->LowerWidget(PCW_WIDGET_BUILD_VIEW_HQ);
 						w->InvalidateWidget(PCW_WIDGET_BUILD_VIEW_HQ);
 					} else {
 						ScrollMainWindowToTile(tile);
@@ -796,7 +796,7 @@
 				case PCW_WIDGET_RELOCATE_HQ:
 					SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, 1, w);
 					SetTileSelectSize(2, 2);
-					LowerWindowWidget(w, PCW_WIDGET_RELOCATE_HQ);
+					w->LowerWidget(PCW_WIDGET_RELOCATE_HQ);
 					w->InvalidateWidget(PCW_WIDGET_RELOCATE_HQ);
 					break;
 
--- a/src/rail_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/rail_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -323,8 +323,8 @@
 	w->SetDirty();
 	SndPlayFx(SND_15_BEEP);
 
-	ToggleWidgetLoweredState(w, RTW_REMOVE);
-	_remove_button_clicked = IsWindowWidgetLowered(w, RTW_REMOVE);
+	w->ToggleWidgetLoweredState(RTW_REMOVE);
+	_remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE);
 	SetSelectionRed(_remove_button_clicked);
 
 	// handle station builder
@@ -443,14 +443,14 @@
 		case RTW_BUILD_SIGNALS:
 			/* Removal button is enabled only if the rail/signal/waypoint/station
 			 * button is still lowered.  Once raised, it has to be disabled */
-			w->SetWidgetDisabledState(RTW_REMOVE, !IsWindowWidgetLowered(w, clicked_widget));
+			w->SetWidgetDisabledState(RTW_REMOVE, !w->IsWidgetLowered(clicked_widget));
 			break;
 
 		default:
 			/* When any other buttons than rail/signal/waypoint/station, raise and
 			 * disable the removal button*/
 			w->DisableWidget(RTW_REMOVE);
-			RaiseWindowWidget(w, RTW_REMOVE);
+			w->RaiseWidget(RTW_REMOVE);
 			break;
 	}
 }
@@ -656,21 +656,21 @@
 	if (statspec == NULL || _railstation.dragdrop) return;
 
 	if (HASBIT(statspec->disallowed_platforms, _railstation.numtracks - 1)) {
-		RaiseWindowWidget(w, _railstation.numtracks + 4);
+		w->RaiseWidget(_railstation.numtracks + 4);
 		_railstation.numtracks = 1;
 		while (HASBIT(statspec->disallowed_platforms, _railstation.numtracks - 1)) {
 			_railstation.numtracks++;
 		}
-		LowerWindowWidget(w, _railstation.numtracks + 4);
+		w->LowerWidget(_railstation.numtracks + 4);
 	}
 
 	if (HASBIT(statspec->disallowed_lengths, _railstation.platlength - 1)) {
-		RaiseWindowWidget(w, _railstation.platlength + 11);
+		w->RaiseWidget(_railstation.platlength + 11);
 		_railstation.platlength = 1;
 		while (HASBIT(statspec->disallowed_lengths, _railstation.platlength - 1)) {
 			_railstation.platlength++;
 		}
-		LowerWindowWidget(w, _railstation.platlength + 11);
+		w->LowerWidget(_railstation.platlength + 11);
 	}
 }
 
@@ -678,15 +678,15 @@
 {
 	switch (e->event) {
 	case WE_CREATE:
-		LowerWindowWidget(w, _railstation.orientation + 3);
+		w->LowerWidget(_railstation.orientation + 3);
 		if (_railstation.dragdrop) {
-			LowerWindowWidget(w, 19);
+			w->LowerWidget(19);
 		} else {
-			LowerWindowWidget(w, _railstation.numtracks + 4);
-			LowerWindowWidget(w, _railstation.platlength + 11);
+			w->LowerWidget(_railstation.numtracks + 4);
+			w->LowerWidget(_railstation.platlength + 11);
 		}
-		SetWindowWidgetLoweredState(w, 20, !_station_show_coverage);
-		SetWindowWidgetLoweredState(w, 21, _station_show_coverage);
+		w->SetWidgetLoweredState(20, !_station_show_coverage);
+		w->SetWidgetLoweredState(21, _station_show_coverage);
 		break;
 
 	case WE_PAINT: {
@@ -783,9 +783,9 @@
 		switch (e->we.click.widget) {
 		case 3:
 		case 4:
-			RaiseWindowWidget(w, _railstation.orientation + 3);
+			w->RaiseWidget(_railstation.orientation + 3);
 			_railstation.orientation = e->we.click.widget - 3;
-			LowerWindowWidget(w, _railstation.orientation + 3);
+			w->LowerWidget(_railstation.orientation + 3);
 			SndPlayFx(SND_15_BEEP);
 			w->SetDirty();
 			break;
@@ -797,12 +797,12 @@
 		case 9:
 		case 10:
 		case 11:
-			RaiseWindowWidget(w, _railstation.numtracks + 4);
-			RaiseWindowWidget(w, 19);
+			w->RaiseWidget(_railstation.numtracks + 4);
+			w->RaiseWidget(19);
 			_railstation.numtracks = (e->we.click.widget - 5) + 1;
 			_railstation.dragdrop = false;
-			LowerWindowWidget(w, _railstation.platlength + 11);
-			LowerWindowWidget(w, _railstation.numtracks + 4);
+			w->LowerWidget(_railstation.platlength + 11);
+			w->LowerWidget(_railstation.numtracks + 4);
 			SndPlayFx(SND_15_BEEP);
 			w->SetDirty();
 			break;
@@ -814,21 +814,21 @@
 		case 16:
 		case 17:
 		case 18:
-			RaiseWindowWidget(w, _railstation.platlength + 11);
-			RaiseWindowWidget(w, 19);
+			w->RaiseWidget(_railstation.platlength + 11);
+			w->RaiseWidget(19);
 			_railstation.platlength = (e->we.click.widget - 12) + 1;
 			_railstation.dragdrop = false;
-			LowerWindowWidget(w, _railstation.platlength + 11);
-			LowerWindowWidget(w, _railstation.numtracks + 4);
+			w->LowerWidget(_railstation.platlength + 11);
+			w->LowerWidget(_railstation.numtracks + 4);
 			SndPlayFx(SND_15_BEEP);
 			w->SetDirty();
 			break;
 
 		case 19:
 			_railstation.dragdrop ^= true;
-			ToggleWidgetLoweredState(w, 19);
-			SetWindowWidgetLoweredState(w, _railstation.numtracks + 4, !_railstation.dragdrop);
-			SetWindowWidgetLoweredState(w, _railstation.platlength + 11, !_railstation.dragdrop);
+			w->ToggleWidgetLoweredState(19);
+			w->SetWidgetLoweredState(_railstation.numtracks + 4, !_railstation.dragdrop);
+			w->SetWidgetLoweredState(_railstation.platlength + 11, !_railstation.dragdrop);
 			SndPlayFx(SND_15_BEEP);
 			w->SetDirty();
 			break;
@@ -836,8 +836,8 @@
 		case 20:
 		case 21:
 			_station_show_coverage = (e->we.click.widget != 20);
-			SetWindowWidgetLoweredState(w, 20, !_station_show_coverage);
-			SetWindowWidgetLoweredState(w, 21, _station_show_coverage);
+			w->SetWidgetLoweredState(20, !_station_show_coverage);
+			w->SetWidgetLoweredState(21, _station_show_coverage);
 			SndPlayFx(SND_15_BEEP);
 			w->SetDirty();
 			break;
@@ -1002,7 +1002,7 @@
 static void BuildTrainDepotWndProc(Window *w, WindowEvent *e)
 {
 	switch (e->event) {
-	case WE_CREATE: LowerWindowWidget(w, _build_depot_direction + 3); break;
+	case WE_CREATE: w->LowerWidget(_build_depot_direction + 3); break;
 
 	case WE_PAINT: {
 		RailType r;
@@ -1023,9 +1023,9 @@
 			case 4:
 			case 5:
 			case 6:
-				RaiseWindowWidget(w, _build_depot_direction + 3);
+				w->RaiseWidget(_build_depot_direction + 3);
 				_build_depot_direction = (DiagDirection)(e->we.click.widget - 3);
-				LowerWindowWidget(w, _build_depot_direction + 3);
+				w->LowerWidget(_build_depot_direction + 3);
 				SndPlayFx(SND_15_BEEP);
 				w->SetDirty();
 				break;
@@ -1074,7 +1074,7 @@
 		uint i;
 
 		for (i = 0; i < w->hscroll.cap; i++) {
-			SetWindowWidgetLoweredState(w, i + 3, (w->hscroll.pos + i) == _cur_waypoint_type);
+			w->SetWidgetLoweredState(i + 3, (w->hscroll.pos + i) == _cur_waypoint_type);
 		}
 
 		w->DrawWidgets();
--- a/src/road_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/road_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -172,8 +172,8 @@
 	if (w->IsWidgetDisabled(RTW_REMOVE)) return;
 	w->SetDirty();
 	SndPlayFx(SND_15_BEEP);
-	ToggleWidgetLoweredState(w, RTW_REMOVE);
-	SetSelectionRed(IsWindowWidgetLowered(w, RTW_REMOVE));
+	w->ToggleWidgetLoweredState(RTW_REMOVE);
+	SetSelectionRed(w->IsWidgetLowered(RTW_REMOVE));
 }
 
 
@@ -195,7 +195,7 @@
 	case WE_CREATE: w->DisableWidget(RTW_REMOVE); break;
 
 	case WE_PAINT:
-		if (IsWindowWidgetLowered(w, RTW_ROAD_X) || IsWindowWidgetLowered(w, RTW_ROAD_Y)) {
+		if (w->IsWidgetLowered(RTW_ROAD_X) || w->IsWidgetLowered(RTW_ROAD_Y)) {
 			w->EnableWidget(RTW_REMOVE);
 		}
 		w->DrawWidgets();
@@ -223,7 +223,7 @@
 		break;
 
 	case WE_PLACE_OBJ:
-		_remove_button_clicked = IsWindowWidgetLowered(w, RTW_REMOVE);
+		_remove_button_clicked = w->IsWidgetLowered(RTW_REMOVE);
 		_place_proc(e->we.place.tile);
 		break;
 
@@ -366,7 +366,7 @@
 static void BuildRoadDepotWndProc(Window *w, WindowEvent *e)
 {
 	switch (e->event) {
-	case WE_CREATE: LowerWindowWidget(w, _road_depot_orientation + 3); break;
+	case WE_CREATE: w->LowerWidget(_road_depot_orientation + 3); break;
 
 	case WE_PAINT:
 		w->DrawWidgets();
@@ -380,9 +380,9 @@
 	case WE_CLICK: {
 		switch (e->we.click.widget) {
 		case 3: case 4: case 5: case 6:
-			RaiseWindowWidget(w, _road_depot_orientation + 3);
+			w->RaiseWidget(_road_depot_orientation + 3);
 			_road_depot_orientation = (DiagDirection)(e->we.click.widget - 3);
-			LowerWindowWidget(w, _road_depot_orientation + 3);
+			w->LowerWidget(_road_depot_orientation + 3);
 			SndPlayFx(SND_15_BEEP);
 			w->SetDirty();
 			break;
@@ -427,8 +427,8 @@
 {
 	switch (e->event) {
 	case WE_CREATE:
-		LowerWindowWidget(w, _road_station_picker_orientation + 3);
-		LowerWindowWidget(w, _station_show_coverage + 7);
+		w->LowerWidget(_road_station_picker_orientation + 3);
+		w->LowerWidget(_station_show_coverage + 7);
 		break;
 
 	case WE_PAINT: {
@@ -461,16 +461,16 @@
 	case WE_CLICK: {
 		switch (e->we.click.widget) {
 		case 3: case 4: case 5: case 6:
-			RaiseWindowWidget(w, _road_station_picker_orientation + 3);
+			w->RaiseWidget(_road_station_picker_orientation + 3);
 			_road_station_picker_orientation = (DiagDirection)(e->we.click.widget - 3);
-			LowerWindowWidget(w, _road_station_picker_orientation + 3);
+			w->LowerWidget(_road_station_picker_orientation + 3);
 			SndPlayFx(SND_15_BEEP);
 			w->SetDirty();
 			break;
 		case 7: case 8:
-			RaiseWindowWidget(w, _station_show_coverage + 7);
+			w->RaiseWidget(_station_show_coverage + 7);
 			_station_show_coverage = (e->we.click.widget != 7);
-			LowerWindowWidget(w, _station_show_coverage + 7);
+			w->LowerWidget(_station_show_coverage + 7);
 			SndPlayFx(SND_15_BEEP);
 			w->SetDirty();
 			break;
--- a/src/settings_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/settings_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -109,7 +109,7 @@
 		i = GetCurRes();
 		SetDParam(7, i == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + i);
 		SetDParam(8, SPECSTR_SCREENSHOT_START + _cur_screenshot_format);
-		SetWindowWidgetLoweredState(w, 28, _fullscreen);
+		w->SetWidgetLoweredState(28, _fullscreen);
 
 		w->DrawWidgets();
 		DrawString(20, 175, STR_OPTIONS_FULLSCREEN, 0); // fullscreen
@@ -153,7 +153,7 @@
 			w->ShowDropDownMenu(BuildDynamicDropdown(SPECSTR_RESOLUTION_START, _num_resolutions), GetCurRes(), 27, 0, 0);
 			return;
 		case 28: /* Click fullscreen on/off */
-			SetWindowWidgetLoweredState(w, 28, !_fullscreen);
+			w->SetWidgetLoweredState(28, !_fullscreen);
 			ToggleFullScreen(!_fullscreen); // toggle full-screen on/off
 			w->SetDirty();
 			return;
@@ -485,9 +485,9 @@
 		}	break;
 		case 3: case 4: case 5: case 6: /* Easy / Medium / Hard / Custom */
 			// temporarily change difficulty level
-			RaiseWindowWidget(w, _opt_mod_temp.diff_level + 3);
+			w->RaiseWidget(_opt_mod_temp.diff_level + 3);
 			SetDifficultyLevel(e->we.click.widget - 3, &_opt_mod_temp);
-			LowerWindowWidget(w, _opt_mod_temp.diff_level + 3);
+			w->LowerWidget(_opt_mod_temp.diff_level + 3);
 			w->SetDirty();
 			break;
 		case 7: /* Highscore Table */
@@ -708,7 +708,7 @@
 			}
 			first_time = false;
 		}
-		LowerWindowWidget(w, 4);
+		w->LowerWidget(4);
 	} break;
 
 	case WE_PAINT: {
@@ -855,9 +855,9 @@
 			break;
 		}
 		case 4: case 5: case 6: case 7: case 8: case 9:
-			RaiseWindowWidget(w, WP(w, def_d).data_1 + 4);
+			w->RaiseWidget(WP(w, def_d).data_1 + 4);
 			WP(w, def_d).data_1 = e->we.click.widget - 4;
-			LowerWindowWidget(w, WP(w, def_d).data_1 + 4);
+			w->LowerWidget(WP(w, def_d).data_1 + 4);
 			DeleteWindowById(WC_QUERY_STRING, 0);
 			w->SetDirty();
 			break;
--- a/src/smallmap_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/smallmap_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -866,9 +866,9 @@
 				case 8:  // Show transport routes
 				case 9:  // Show vegetation
 				case 10: // Show land owners
-					RaiseWindowWidget(w, _smallmap_type + 5);
+					w->RaiseWidget(_smallmap_type + 5);
 					_smallmap_type = e->we.click.widget - 5;
-					LowerWindowWidget(w, _smallmap_type + 5);
+					w->LowerWidget(_smallmap_type + 5);
 
 					w->SetDirty();
 					SndPlayFx(SND_15_BEEP);
@@ -882,8 +882,8 @@
 					break;
 
 				case 12: // Toggle town names
-					ToggleWidgetLoweredState(w, 12);
-					_smallmap_show_towns = IsWindowWidgetLowered(w, 12);
+					w->ToggleWidgetLoweredState(12);
+					_smallmap_show_towns = w->IsWidgetLowered(12);
 
 					w->SetDirty();
 					SndPlayFx(SND_15_BEEP);
@@ -983,8 +983,8 @@
 	w = AllocateWindowDescFront(&_smallmap_desc, 0);
 	if (w == NULL) return;
 
-	LowerWindowWidget(w, _smallmap_type + 5);
-	SetWindowWidgetLoweredState(w, 12, _smallmap_show_towns);
+	w->LowerWidget(_smallmap_type + 5);
+	w->SetWidgetLoweredState(12, _smallmap_show_towns);
 	w->resize.width = 350;
 	w->resize.height = 250;
 
--- a/src/station_gui.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/station_gui.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -272,14 +272,14 @@
 	case WE_CREATE: { /* set up resort timer */
 		int i;
 		for (i = 0; i < 5; i++) {
-			if (HASBIT(facilities, i)) LowerWindowWidget(w, i + STATIONLIST_WIDGET_TRAIN);
+			if (HASBIT(facilities, i)) w->LowerWidget(i + STATIONLIST_WIDGET_TRAIN);
 		}
 		for (i = 0; i < NUM_CARGO; i++) {
-			if (HASBIT(cargo_filter, i)) LowerWindowWidget(w, i + STATIONLIST_WIDGET_CARGOSTART);
+			if (HASBIT(cargo_filter, i)) w->LowerWidget(i + STATIONLIST_WIDGET_CARGOSTART);
 		}
-		SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK));
-		SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_CARGOALL, cargo_filter == CARGO_ALL_SELECTED);
-		SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_NOCARGOWAITING, HASBIT(cargo_filter, STATIONLIST_WIDGET_NOCARGOWAITING - NUM_CARGO));
+		w->SetWidgetLoweredState(STATIONLIST_WIDGET_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK));
+		w->SetWidgetLoweredState(STATIONLIST_WIDGET_CARGOALL, cargo_filter == CARGO_ALL_SELECTED);
+		w->SetWidgetLoweredState(STATIONLIST_WIDGET_NOCARGOWAITING, HASBIT(cargo_filter, STATIONLIST_WIDGET_NOCARGOWAITING - NUM_CARGO));
 
 		sl->sort_list = NULL;
 		sl->flags = SL_REBUILD;
@@ -319,7 +319,7 @@
 			y = 14;
 
 			for (i = 0; i < NUM_CARGO; i++) {
-				cg_ofst = IsWindowWidgetLowered(w, i + STATIONLIST_WIDGET_CARGOSTART) ? 2 : 1;
+				cg_ofst = w->IsWidgetLowered(i + STATIONLIST_WIDGET_CARGOSTART) ? 2 : 1;
 
 				GfxFillRect(x + cg_ofst, y + cg_ofst, x + cg_ofst + 10 , y + cg_ofst + 7, _cargo_colours[i]);
 				DrawStringCentered(x + 6 + cg_ofst, y + cg_ofst, _cargoc.names_short[i], 0x10);
@@ -327,13 +327,13 @@
 			}
 
 			x += 6;
-			cg_ofst = IsWindowWidgetLowered(w, STATIONLIST_WIDGET_NOCARGOWAITING) ? 2 : 1;
+			cg_ofst = w->IsWidgetLowered(STATIONLIST_WIDGET_NOCARGOWAITING) ? 2 : 1;
 			DrawStringCentered(x + cg_ofst, y + cg_ofst, STR_ABBREV_NONE, 16);
 			x += 14;
-			cg_ofst = IsWindowWidgetLowered(w, STATIONLIST_WIDGET_CARGOALL) ? 2 : 1;
+			cg_ofst = w->IsWidgetLowered(STATIONLIST_WIDGET_CARGOALL) ? 2 : 1;
 			DrawStringCentered(x + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, 16);
 
-			cg_ofst = IsWindowWidgetLowered(w, STATIONLIST_WIDGET_FACILALL) ? 2 : 1;
+			cg_ofst = w->IsWidgetLowered(STATIONLIST_WIDGET_FACILALL) ? 2 : 1;
 			DrawString(71 + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, 16);
 
 			if (w->vscroll.count == 0) { // player has no stations
@@ -396,16 +396,16 @@
 		case STATIONLIST_WIDGET_SHIP:
 			if (_ctrl_pressed) {
 				TOGGLEBIT(facilities, e->we.click.widget - STATIONLIST_WIDGET_TRAIN);
-				ToggleWidgetLoweredState(w, e->we.click.widget);
+				w->ToggleWidgetLoweredState(e->we.click.widget);
 			} else {
 				int i;
 				for (i = 0; facilities != 0; i++, facilities >>= 1) {
-					if (HASBIT(facilities, 0)) RaiseWindowWidget(w, i + STATIONLIST_WIDGET_TRAIN);
+					if (HASBIT(facilities, 0)) w->RaiseWidget(i + STATIONLIST_WIDGET_TRAIN);
 				}
 				SETBIT(facilities, e->we.click.widget - STATIONLIST_WIDGET_TRAIN);
-				LowerWindowWidget(w, e->we.click.widget);
+				w->LowerWidget(e->we.click.widget);
 			}
-			SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK));
+			w->SetWidgetLoweredState(STATIONLIST_WIDGET_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK));
 			sl->flags |= SL_REBUILD;
 			w->SetDirty();
 		break;
@@ -413,9 +413,9 @@
 		case STATIONLIST_WIDGET_FACILALL: {
 			int i;
 			for (i = 0; i < 5; i++) {
-				LowerWindowWidget(w, i + STATIONLIST_WIDGET_TRAIN);
+				w->LowerWidget(i + STATIONLIST_WIDGET_TRAIN);
 			}
-			LowerWindowWidget(w, STATIONLIST_WIDGET_FACILALL);
+			w->LowerWidget(STATIONLIST_WIDGET_FACILALL);
 
 			facilities = FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK;
 			sl->flags |= SL_REBUILD;
@@ -425,10 +425,10 @@
 		case STATIONLIST_WIDGET_CARGOALL: {
 			int i;
 			for (i = 0; i < NUM_CARGO; i++) {
-				LowerWindowWidget(w, i + STATIONLIST_WIDGET_CARGOSTART);
+				w->LowerWidget(i + STATIONLIST_WIDGET_CARGOSTART);
 			}
-			LowerWindowWidget(w, STATIONLIST_WIDGET_NOCARGOWAITING);
-			LowerWindowWidget(w, STATIONLIST_WIDGET_CARGOALL);
+			w->LowerWidget(STATIONLIST_WIDGET_NOCARGOWAITING);
+			w->LowerWidget(STATIONLIST_WIDGET_CARGOALL);
 
 			cargo_filter = CARGO_ALL_SELECTED;
 			sl->flags |= SL_REBUILD;
@@ -440,7 +440,7 @@
 			station_sort.order = GB(sl->flags, 0, 1);
 			sl->flags |= SL_RESORT;
 			w->autorepeat_timeout = 5;
-			LowerWindowWidget(w, STATIONLIST_WIDGET_SORTBY);
+			w->LowerWidget(STATIONLIST_WIDGET_SORTBY);
 			w->SetDirty();
 		break;
 
@@ -453,17 +453,17 @@
 			if (e->we.click.widget >= STATIONLIST_WIDGET_CARGOSTART && e->we.click.widget <= STATIONLIST_WIDGET_NOCARGOWAITING) { //change cargo_filter
 				if (_ctrl_pressed) {
 					TOGGLEBIT(cargo_filter, e->we.click.widget - STATIONLIST_WIDGET_CARGOSTART);
-					ToggleWidgetLoweredState(w, e->we.click.widget);
+					w->ToggleWidgetLoweredState(e->we.click.widget);
 				} else {
 					int i;
 					for (i = 0; cargo_filter != 0; i++, cargo_filter >>= 1) {
-						if (HASBIT(cargo_filter, 0)) RaiseWindowWidget(w, i + STATIONLIST_WIDGET_CARGOSTART);
+						if (HASBIT(cargo_filter, 0)) w->RaiseWidget(i + STATIONLIST_WIDGET_CARGOSTART);
 					}
 					SETBIT(cargo_filter, e->we.click.widget - STATIONLIST_WIDGET_CARGOSTART);
-					LowerWindowWidget(w, e->we.click.widget);
+					w->LowerWidget(e->we.click.widget);
 				}
 				sl->flags |= SL_REBUILD;
-				SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_CARGOALL, cargo_filter == CARGO_ALL_SELECTED);
+				w->SetWidgetLoweredState(STATIONLIST_WIDGET_CARGOALL, cargo_filter == CARGO_ALL_SELECTED);
 				w->SetDirty();
 			}
 		}
@@ -489,7 +489,7 @@
 		break;
 
 	case WE_TIMEOUT:
-		RaiseWindowWidget(w, STATIONLIST_WIDGET_SORTBY);
+		w->RaiseWidget(STATIONLIST_WIDGET_SORTBY);
 		w->SetDirty();
 		break;
 
--- a/src/widget.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/widget.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -189,7 +189,7 @@
 
 	for (i = 0; i < widget_count; i++) {
 		const Widget *wi = &widget[i];
-		bool clicked = IsWindowWidgetLowered(this, i);
+		bool clicked = IsWidgetLowered(i);
 
 		if (dpi->left > (r.right=/*w->left + */wi->right) ||
 				dpi->left + dpi->width <= (r.left=wi->left/* + w->left*/) ||
@@ -588,8 +588,8 @@
 		case WE_DESTROY: {
 			Window *w2 = Window::FindById(WP(w,dropdown_d).parent_wnd_class, WP(w,dropdown_d).parent_wnd_num);
 			if (w2 != NULL) {
-				RaiseWindowWidget(w2, WP(w,dropdown_d).parent_button);
-				w2->InvalidateWidget( WP(w,dropdown_d).parent_button);
+				w2->RaiseWidget(WP(w,dropdown_d).parent_button);
+				w2->InvalidateWidget(WP(w,dropdown_d).parent_button);
 			}
 		} break;
 	}
@@ -601,7 +601,7 @@
 	const Widget *wi;
 	Window *w1;
 	const Window *w2;
-	bool is_dropdown_menu_shown = IsWindowWidgetLowered(this, button);
+	bool is_dropdown_menu_shown = IsWidgetLowered(button);
 	int menu_top, menu_height;
 	int screen_top, screen_bottom;
 	bool scroll = false;
@@ -610,7 +610,7 @@
 
 	if (is_dropdown_menu_shown) return;
 
-	LowerWindowWidget(this, button);
+	LowerWidget(button);
 
 	InvalidateWidget(button);
 
--- a/src/window.cpp	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/window.cpp	Tue Feb 13 23:49:01 2007 +0000
@@ -299,7 +299,7 @@
 	va_start(wdg_list, widgets);
 
 	while (widgets != WIDGET_LIST_END) {
-		SetWindowWidgetLoweredState(this, widgets, lowered_stat);
+		SetWidgetLoweredState(widgets, lowered_stat);
 		widgets = va_arg(wdg_list, int);
 	}
 
@@ -311,8 +311,8 @@
 	uint i;
 
 	for (i = 0; i < widget_count; i++) {
-		if (IsWindowWidgetLowered(this, i)) {
-			RaiseWindowWidget(this, i);
+		if (IsWidgetLowered(i)) {
+			RaiseWidget(i);
 			this->InvalidateWidget(i);
 		}
 	}
@@ -320,7 +320,7 @@
 
 void Window::HandleButtonClick(byte widget)
 {
-	LowerWindowWidget(this, widget);
+	LowerWidget(widget);
 	autorepeat_timeout = 5;
 	InvalidateWidget(widget);
 }
--- a/src/window.h	Tue Feb 13 23:07:54 2007 +0000
+++ b/src/window.h	Tue Feb 13 23:49:01 2007 +0000
@@ -446,11 +446,18 @@
 	/*inline*/ void DisableWidget(byte widget_index);
 	/*inline*/ void EnableWidget(byte widget_index);
 	/*inline*/ bool IsWidgetDisabled(byte widget_index) const;
+
 	/*inline*/ void SetWidgetHiddenState(byte widget_index, bool hidden_stat);
 	/*inline*/ void HideWidget(byte widget_index);
 	/*inline*/ void ShowWidget(byte widget_index);
 	/*inline*/ bool IsWidgetHidden(byte widget_index) const;
 
+	/*inline*/ void SetWidgetLoweredState(byte widget_index, bool lowered_stat);
+	/*inline*/ void ToggleWidgetLoweredState(byte widget_index);
+	/*inline*/ void LowerWidget(byte widget_index);
+	/*inline*/ void RaiseWidget(byte widget_index);
+	/*inline*/ bool IsWidgetLowered(byte widget_index) const;
+
 	//int32 AddRef()
 	//{
 	//	const char *name = NULL;
@@ -881,10 +888,10 @@
  * @param widget_index : index of this widget in the window
  * @param hidden_stat : status to use ie: lowered = true, raised = false
  */
-static inline void SetWindowWidgetLoweredState(Window *w, byte widget_index, bool lowered_stat)
+inline void Window::SetWidgetLoweredState(byte widget_index, bool lowered_stat)
 {
-	assert(widget_index < w->widget_count);
-	SB(w->widget[widget_index].display_flags, WIDG_LOWERED, 1, !!lowered_stat);
+	assert(widget_index < widget_count);
+	SB(widget[widget_index].display_flags, WIDG_LOWERED, 1, !!lowered_stat);
 }
 
 /**
@@ -892,10 +899,10 @@
  * @param w : Window on which the widget is located
  * @param widget_index : index of this widget in the window
  */
-static inline void ToggleWidgetLoweredState(Window *w, byte widget_index)
+inline void Window::ToggleWidgetLoweredState(byte widget_index)
 {
-	assert(widget_index < w->widget_count);
-	TOGGLEBIT(w->widget[widget_index].display_flags, WIDG_LOWERED);
+	assert(widget_index < widget_count);
+	TOGGLEBIT(widget[widget_index].display_flags, WIDG_LOWERED);
 }
 
 /**
@@ -903,9 +910,9 @@
  * @param w : Window on which the widget is located
  * @param widget_index : index of this widget in the window
  */
-static inline void LowerWindowWidget(Window *w, byte widget_index)
+inline void Window::LowerWidget(byte widget_index)
 {
-	SetWindowWidgetLoweredState(w, widget_index, true);
+	SetWidgetLoweredState(widget_index, true);
 }
 
 /**
@@ -913,9 +920,9 @@
  * @param w : Window on which the widget is located
  * @param widget_index : index of this widget in the window
  */
-static inline void RaiseWindowWidget(Window *w, byte widget_index)
+inline void Window::RaiseWidget(byte widget_index)
 {
-	SetWindowWidgetLoweredState(w, widget_index, false);
+	SetWidgetLoweredState(widget_index, false);
 }
 
 /**
@@ -924,10 +931,10 @@
  * @param widget_index : index of this widget in the window
  * @return status of the widget ie: lowered = true, raised= false
  */
-static inline bool IsWindowWidgetLowered(const Window *w, byte widget_index)
+inline bool Window::IsWidgetLowered(byte widget_index) const
 {
-	assert(widget_index < w->widget_count);
-	return HASBIT(w->widget[widget_index].display_flags, WIDG_LOWERED);
+	assert(widget_index < widget_count);
+	return HASBIT(widget[widget_index].display_flags, WIDG_LOWERED);
 }
 
 void InitWindowSystem(void);