src/window_gui.h
branchnoai
changeset 9724 b39bc69bb2f2
parent 9723 eee46cb39750
child 9732 f8eb3e208514
--- a/src/window_gui.h	Wed Jan 09 18:11:12 2008 +0000
+++ b/src/window_gui.h	Sun Feb 03 20:17:54 2008 +0000
@@ -8,6 +8,8 @@
 #include "core/bitmath_func.hpp"
 #include "vehicle_type.h"
 #include "viewport_type.h"
+#include "player_type.h"
+#include "strings_type.h"
 
 /**
  * The maximum number of windows that can be opened.
@@ -367,13 +369,6 @@
 };
 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(smallmap_d));
 
-/* player face selection window */
-struct facesel_d {
-	PlayerFace face; // player face bits
-	bool advanced;   // advance player face selection window
-};
-assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(facesel_d));
-
 struct refit_d {
 	int sel;
 	struct RefitOption *cargo;
@@ -444,20 +439,6 @@
 };
 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(message_d));
 
-struct dropdown_d {
-	uint32 disabled_state;
-	uint32 hidden_state;
-	WindowClass parent_wnd_class;
-	WindowNumber parent_wnd_num;
-	byte parent_button;
-	byte num_items;
-	byte selected_index;
-	const StringID *items;
-	byte click_delay;
-	bool drag_mode;
-};
-assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(dropdown_d));
-
 struct vehiclelist_d {
 	const Vehicle** sort_list;  // List of vehicles (sorted)
 	Listing *_sorting;          // pointer to the appropiate subcategory of _sorting
@@ -511,6 +492,8 @@
 	WWT_SCROLL2BAR, ///< 2nd vertical scrollbar
 	WWT_RESIZEBOX,
 	WWT_CLOSEBOX,
+	WWT_DROPDOWN,   ///< Raised drop down list (regular)
+	WWT_DROPDOWNIN, ///< Inset drop down list (used on game options only)
 	WWT_LAST,       ///< Last Item. use WIDGETS_END to fill up padding!!
 
 	WWT_MASK = 0x1F,
@@ -597,7 +580,14 @@
 /* widget.cpp */
 int GetWidgetFromPos(const Window *w, int x, int y);
 void DrawWindowWidgets(const Window *w);
-void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int button, uint32 disabled_mask, uint32 hidden_mask);
+
+enum SortButtonState {
+	SBS_OFF,
+	SBS_DOWN,
+	SBS_UP,
+};
+
+void DrawSortButtonState(const Window *w, int widget, SortButtonState state);
 
 
 Window *GetCallbackWnd();
@@ -612,17 +602,17 @@
 extern Window **_last_z_window;
 #define FOR_ALL_WINDOWS(wz) for (wz = _z_windows; wz != _last_z_window; wz++)
 
-VARDEF Point _cursorpos_drag_start;
+extern Point _cursorpos_drag_start;
 
-VARDEF int _scrollbar_start_pos;
-VARDEF int _scrollbar_size;
-VARDEF byte _scroller_click_timeout;
+extern int _scrollbar_start_pos;
+extern int _scrollbar_size;
+extern byte _scroller_click_timeout;
 
-VARDEF bool _scrolling_scrollbar;
-VARDEF bool _scrolling_viewport;
-VARDEF bool _popup_menu_active;
+extern bool _scrolling_scrollbar;
+extern bool _scrolling_viewport;
+extern bool _popup_menu_active;
 
-VARDEF byte _special_mouse_mode;
+extern byte _special_mouse_mode;
 enum SpecialMouseMode {
 	WSM_NONE     = 0,
 	WSM_DRAGDROP = 1,
@@ -640,6 +630,10 @@
  */
 void ResizeButtons(Window *w, byte left, byte right);
 
+/** Resize a widget an shuffle other widgets around to fit.
+ */
+void ResizeWindowForWidget(Window *w, int widget, int delta_x, int delta_y);
+
 
 /**
  * Sets the enabled/disabled status of a widget.