tron@2186: /* $Id$ */ tron@2186: truelight@0: #ifndef WINDOW_H truelight@0: #define WINDOW_H truelight@0: truelight@0: typedef union WindowEvent WindowEvent; truelight@0: truelight@0: typedef void WindowProc(Window *w, WindowEvent *e); truelight@0: truelight@867: /* How the resize system works: truelight@867: First, you need to add a WWT_RESIZEBOX to the widgets, and you need truelight@867: to add the flag WDF_RESIZABLE to the window. Now the window is ready truelight@867: to resize itself. truelight@867: As you may have noticed, all widgets have a RESIZE_XXX in their line. truelight@867: This lines controls how the widgets behave on resize. RESIZE_NONE means truelight@867: it doesn't do anything. Any other option let's one of the borders truelight@867: move with the changed width/height. So if a widget has truelight@867: RESIZE_RIGHT, and the window is made 5 pixels wider by the user, truelight@867: the right of the window will also be made 5 pixels wider. truelight@867: Now, what if you want to clamp a widget to the bottom? Give it the flag truelight@867: RESIZE_TB. This is RESIZE_TOP + RESIZE_BOTTOM. Now if the window gets truelight@867: 5 pixels bigger, both the top and bottom gets 5 bigger, so the whole truelight@867: widgets moves downwards without resizing, and appears to be clamped truelight@867: to the bottom. Nice aint it? truelight@867: You should know one more thing about this system. Most windows can't truelight@867: handle an increase of 1 pixel. So there is a step function, which truelight@867: let the windowsize only be changed by X pixels. You configure this truelight@867: after making the window, like this: truelight@867: w->resize.step_height = 10; truelight@867: Now the window will only change in height in steps of 10. truelight@867: You can also give a minimum width and height. The default value is truelight@867: the default height/width of the window itself. You can change this truelight@867: AFTER window-creation, with: truelight@867: w->resize.width or w->resize.height. truelight@867: That was all.. good luck, and enjoy :) -- TrueLight */ truelight@867: truelight@867: enum { truelight@867: RESIZE_NONE = 0, truelight@867: truelight@867: RESIZE_LEFT = 1, truelight@867: RESIZE_RIGHT = 2, truelight@867: RESIZE_TOP = 4, truelight@867: RESIZE_BOTTOM = 8, truelight@867: truelight@867: RESIZE_LR = RESIZE_LEFT | RESIZE_RIGHT, truelight@867: RESIZE_RB = RESIZE_RIGHT | RESIZE_BOTTOM, truelight@867: RESIZE_TB = RESIZE_TOP | RESIZE_BOTTOM, truelight@867: RESIZE_LRB = RESIZE_LEFT | RESIZE_RIGHT | RESIZE_BOTTOM, truelight@867: RESIZE_LRTB = RESIZE_LEFT | RESIZE_RIGHT | RESIZE_TOP | RESIZE_BOTTOM, truelight@867: RESIZE_RTB = RESIZE_RIGHT | RESIZE_TOP | RESIZE_BOTTOM, truelight@867: }; truelight@867: truelight@0: typedef struct Widget { truelight@0: byte type; truelight@867: byte resize_flag; truelight@0: byte color; truelight@0: uint16 left, right, top, bottom; truelight@0: uint16 unkA; truelight@0: uint16 tooltips; truelight@0: } Widget; truelight@0: hackykid@1938: enum FrameFlags { hackykid@1938: FR_TRANSPARENT = 0x01, ///< Makes the background transparent if set hackykid@1938: FR_NOBORDER = 0x08, ///< Hide border (draws just a solid box) hackykid@1938: FR_BORDERONLY = 0x10, ///< Draw border only, no background hackykid@1938: FR_LOWERED = 0x20, ///< If set the frame is lowered and the background color brighter (ie. buttons when pressed) hackykid@1938: FR_DARKENED = 0x40, ///< If set the background is darker, allows for lowered frames with normal background color when used with FR_LOWERED (ie. dropdown boxes) hackykid@1938: }; hackykid@1938: darkvater@1648: /* XXX - outside "byte event" so you can set event directly without going into darkvater@1648: * the union elements at first. Because of this every first element of the union darkvater@1648: * MUST BE 'byte event'. Whoever did this must get shot! Scheduled for immediate darkvater@1648: * rewrite after 0.4.0 */ truelight@0: union WindowEvent { truelight@0: byte event; truelight@0: struct { truelight@0: byte event; truelight@0: Point pt; truelight@0: int widget; truelight@0: } click; truelight@0: truelight@0: struct { truelight@0: byte event; truelight@0: Point pt; tron@1977: TileIndex tile; tron@1977: TileIndex starttile; truelight@0: int userdata; truelight@0: } place; truelight@0: truelight@0: struct { truelight@0: byte event; truelight@0: Point pt; truelight@0: int widget; truelight@0: } dragdrop; truelight@0: truelight@0: struct { truelight@0: byte event; truelight@867: Point size; truelight@867: Point diff; truelight@867: } sizing; truelight@867: truelight@867: struct { truelight@867: byte event; tron@1323: char *str; truelight@0: } edittext; truelight@0: truelight@0: struct { truelight@0: byte event; truelight@0: Point pt; truelight@0: } popupmenu; truelight@0: truelight@0: struct { truelight@0: byte event; truelight@0: int button; truelight@0: int index; truelight@0: } dropdown; truelight@0: truelight@0: struct { truelight@0: byte event; truelight@543: Point pt; truelight@543: int widget; truelight@543: } mouseover; truelight@543: truelight@543: struct { truelight@543: byte event; truelight@0: bool cont; // continue the search? (default true) truelight@0: byte ascii; // 8-bit ASCII-value of the key truelight@0: uint16 keycode;// untranslated key (including shift-state) truelight@0: } keypress; darkvater@1648: darkvater@1648: struct { darkvater@1648: byte event; darkvater@1648: uint msg; // message to be sent darkvater@1648: uint wparam; // additional message-specific information darkvater@1648: uint lparam; // additional message-specific information darkvater@1648: } message; truelight@0: }; truelight@0: truelight@0: enum WindowKeyCodes { truelight@0: WKC_SHIFT = 0x8000, truelight@0: WKC_CTRL = 0x4000, truelight@0: WKC_ALT = 0x2000, truelight@0: WKC_META = 0x1000, truelight@158: truelight@0: // Special ones truelight@0: WKC_NONE = 0, truelight@0: WKC_ESC=1, truelight@0: WKC_BACKSPACE = 2, truelight@0: WKC_INSERT = 3, truelight@0: WKC_DELETE = 4, truelight@0: truelight@0: WKC_PAGEUP = 5, truelight@0: WKC_PAGEDOWN = 6, truelight@0: WKC_END = 7, truelight@0: WKC_HOME = 8, truelight@0: truelight@0: // Arrow keys truelight@0: WKC_LEFT = 9, truelight@0: WKC_UP = 10, truelight@0: WKC_RIGHT = 11, truelight@0: WKC_DOWN = 12, truelight@0: truelight@0: // Return & tab truelight@0: WKC_RETURN = 13, truelight@0: WKC_TAB = 14, truelight@158: truelight@0: // Numerical keyboard truelight@0: WKC_NUM_0 = 16, truelight@0: WKC_NUM_1 = 17, truelight@0: WKC_NUM_2 = 18, truelight@0: WKC_NUM_3 = 19, truelight@0: WKC_NUM_4 = 20, truelight@0: WKC_NUM_5 = 21, truelight@0: WKC_NUM_6 = 22, truelight@0: WKC_NUM_7 = 23, truelight@0: WKC_NUM_8 = 24, truelight@0: WKC_NUM_9 = 25, truelight@0: WKC_NUM_DIV = 26, truelight@0: WKC_NUM_MUL = 27, truelight@0: WKC_NUM_MINUS = 28, truelight@0: WKC_NUM_PLUS = 29, truelight@0: WKC_NUM_ENTER = 30, truelight@0: WKC_NUM_DECIMAL = 31, truelight@0: truelight@0: // Space truelight@0: WKC_SPACE = 32, truelight@0: truelight@0: // Function keys truelight@0: WKC_F1 = 33, truelight@0: WKC_F2 = 34, truelight@0: WKC_F3 = 35, truelight@0: WKC_F4 = 36, truelight@0: WKC_F5 = 37, truelight@0: WKC_F6 = 38, truelight@0: WKC_F7 = 39, truelight@0: WKC_F8 = 40, truelight@0: WKC_F9 = 41, truelight@0: WKC_F10 = 42, truelight@0: WKC_F11 = 43, truelight@0: WKC_F12 = 44, truelight@0: dominik@129: // backquote is the key left of "1" dominik@129: // we only store this key here, no matter what character is really mapped to it dominik@129: // on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °) dominik@129: WKC_BACKQUOTE = 45, tron@424: WKC_PAUSE = 46, truelight@158: truelight@0: // 0-9 are mapped to 48-57 truelight@0: // A-Z are mapped to 65-90 truelight@0: // a-z are mapped to 97-122 truelight@0: }; truelight@0: truelight@0: typedef struct WindowDesc { truelight@0: int16 left, top, width, height; truelight@0: byte cls; truelight@0: byte parent_cls; truelight@0: uint32 flags; truelight@0: const Widget *widgets; truelight@0: WindowProc *proc; truelight@0: } WindowDesc; truelight@0: truelight@0: enum { darkvater@682: WDF_STD_TOOLTIPS = 1, /* use standard routine when displaying tooltips */ darkvater@682: WDF_DEF_WIDGET = 2, /* default widget control for some widgets in the on click event */ darkvater@682: WDF_STD_BTN = 4, /* default handling for close and drag widgets (widget no 0 and 1) */ ludde@2064: truelight@0: WDF_UNCLICK_BUTTONS=16, /* Unclick buttons when the window event times out */ darkvater@682: WDF_STICKY_BUTTON =32, /* Set window to sticky mode; they are not closed unless closed with 'X' (widget 2) */ truelight@867: WDF_RESIZABLE =64, /* A window can be resized */ truelight@0: }; truelight@0: truelight@0: /* can be used as x or y coordinates to cause a specific placement */ truelight@0: enum { truelight@0: WDP_AUTO = -1, truelight@0: WDP_CENTER = -2, truelight@0: }; truelight@0: Darkvater@1390: typedef struct Textbuf { Darkvater@1390: char *buf; /* buffer in which text is saved */ Darkvater@1390: uint16 maxlength, maxwidth; /* the maximum size of the buffer. Maxwidth specifies screensize in pixels */ Darkvater@1390: uint16 length, width; /* the current size of the buffer. Width specifies screensize in pixels */ Darkvater@1390: bool caret; /* is the caret ("_") visible or not */ Darkvater@1390: uint16 caretpos; /* the current position of the caret in the buffer */ Darkvater@1390: uint16 caretxoffs; /* the current position of the caret in pixels */ Darkvater@1390: } Textbuf; Darkvater@1390: tron@2596: typedef struct querystr_d { truelight@158: StringID caption; truelight@158: WindowClass wnd_class; truelight@158: WindowNumber wnd_num; Darkvater@1390: Textbuf text; tron@1386: const char* orig; truelight@158: } querystr_d; truelight@158: truelight@0: #define WP(ptr,str) (*(str*)(ptr)->custom) tron@2596: // querystr_d is the largest struct that comes in w->custom truelight@158: // because 64-bit systems use 64-bit pointers, it is bigger on a 64-bit system miham@826: // than on a 32-bit system. Therefore, the size is calculated from querystr_d truelight@158: // instead of a hardcoded number. truelight@158: // if any struct becomes bigger the querystr_d, it should be replaced. truelight@158: #define WINDOW_CUSTOM_SIZE sizeof(querystr_d) truelight@0: tron@2596: typedef struct Scrollbar { dominik@62: uint16 count, cap, pos; truelight@0: } Scrollbar; truelight@0: tron@2596: typedef struct ResizeInfo { truelight@867: uint width; /* Minimum width and height */ truelight@867: uint height; truelight@867: truelight@867: uint step_width; /* In how big steps the width and height go */ truelight@867: uint step_height; truelight@867: } ResizeInfo; truelight@867: tron@2596: typedef struct Message { darkvater@1648: int msg; darkvater@1648: int wparam; darkvater@1648: int lparam; darkvater@1648: } Message; darkvater@1648: truelight@0: struct Window { truelight@0: uint16 flags4; truelight@0: WindowClass window_class; truelight@0: WindowNumber window_number; truelight@0: truelight@867: int left, top; truelight@867: int width, height; truelight@0: bjarni@842: Scrollbar hscroll, vscroll, vscroll2; truelight@867: ResizeInfo resize; truelight@0: truelight@0: byte caption_color; truelight@0: truelight@0: uint32 click_state, disabled_state, hidden_state; truelight@0: WindowProc *wndproc; truelight@0: ViewPort *viewport; truelight@867: const Widget *original_widget; truelight@867: Widget *widget; truelight@0: uint32 desc_flags; truelight@0: darkvater@1648: Message message; truelight@158: byte custom[WINDOW_CUSTOM_SIZE]; truelight@0: }; truelight@0: truelight@0: typedef struct { truelight@0: byte item_count; /* follow_vehicle */ truelight@0: byte sel_index; /* scrollpos_x */ truelight@0: byte main_button; /* scrollpos_y */ truelight@0: byte action_id; truelight@0: StringID string_id; /* unk30 */ truelight@0: uint16 checked_items; /* unk32 */ celestar@2216: byte disabled_items; truelight@0: } menu_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(menu_d)); truelight@0: truelight@0: typedef struct { truelight@0: int16 data_1, data_2, data_3; truelight@0: int16 data_4, data_5; tron@2596: bool close; truelight@0: byte byte_1; truelight@0: } def_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(def_d)); truelight@0: truelight@0: typedef struct { truelight@0: void *data; truelight@0: } void_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(void_d)); truelight@0: truelight@0: typedef struct { tron@2596: uint16 base; tron@2596: uint16 count; truelight@0: } tree_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tree_d)); truelight@0: truelight@0: typedef struct { tron@2596: byte refresh_counter; truelight@0: } plstations_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(plstations_d)); truelight@0: truelight@0: typedef struct { truelight@0: StringID string_id; truelight@0: } tooltips_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tooltips_d)); truelight@0: truelight@0: typedef struct { truelight@0: byte railtype; truelight@0: byte sel_index; tron@2498: EngineID sel_engine; tron@2498: EngineID rename_engine; truelight@0: } buildtrain_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(buildtrain_d)); truelight@0: truelight@0: typedef struct { bjarni@842: byte vehicletype; bjarni@842: byte sel_index[2]; bjarni@842: int16 sel_engine[2]; bjarni@842: uint16 count[2]; bjarni@842: } replaceveh_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(replaceveh_d)); bjarni@842: bjarni@842: typedef struct { truelight@0: VehicleID sel; truelight@0: } traindepot_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindepot_d)); truelight@0: truelight@0: typedef struct { truelight@0: int sel; truelight@0: } order_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(order_d)); truelight@0: truelight@0: typedef struct { truelight@0: byte tab; truelight@0: } traindetails_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindetails_d)); truelight@0: truelight@0: typedef struct { tron@849: int32 scroll_x; tron@849: int32 scroll_y; tron@849: int32 subscroll; truelight@0: } smallmap_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindetails_d)); truelight@0: truelight@0: typedef struct { truelight@0: uint32 face; truelight@0: byte gender; truelight@0: } facesel_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(facesel_d)); truelight@0: truelight@0: typedef struct { truelight@0: int sel; truelight@0: byte cargo; truelight@0: } refit_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(refit_d)); truelight@0: truelight@0: typedef struct { tron@2116: VehicleID follow_vehicle; tron@849: int32 scrollpos_x; tron@849: int32 scrollpos_y; truelight@0: } vp_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp_d) + 3 * sizeof(byte)); // + 3 * byte is a hack from Miham miham@1004: miham@1004: // vp2_d is the same as vp_d, except for the data_# values.. miham@1004: typedef struct { miham@1004: uint16 follow_vehicle; miham@1004: int32 scrollpos_x; miham@1004: int32 scrollpos_y; miham@1004: byte data_1; miham@1004: byte data_2; miham@1004: byte data_3; miham@1004: } vp2_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp2_d)); truelight@0: truelight@0: typedef struct { truelight@0: uint16 follow_vehicle; tron@849: int32 scrollpos_x; tron@849: int32 scrollpos_y; truelight@0: NewsItem *ni; truelight@0: } news_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(news_d)); truelight@0: darkvater@859: typedef struct { darkvater@998: uint32 background_img; darkvater@998: int8 rank; darkvater@998: } highscore_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(highscore_d)); darkvater@998: darkvater@998: typedef struct { darkvater@998: int height; darkvater@998: uint16 counter; darkvater@998: } scroller_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(scroller_d)); darkvater@859: tron@588: typedef enum VehicleListFlags { tron@588: VL_DESC = 0x01, tron@588: VL_RESORT = 0x02, tron@588: VL_REBUILD = 0x04 tron@588: } VehicleListFlags; tron@588: tron@588: typedef struct vehiclelist_d { tron@588: SortStruct *sort_list; tron@588: uint16 list_length; tron@588: byte sort_type; tron@588: VehicleListFlags flags; tron@588: uint16 resort_timer; tron@588: } vehiclelist_d; miham@1004: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vehiclelist_d)); tron@588: darkvater@1648: typedef struct message_d { darkvater@1648: int msg; darkvater@1648: int wparam; darkvater@1648: int lparam; darkvater@1648: } message_d; darkvater@1648: assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(message_d)); darkvater@1648: truelight@0: enum WindowEvents { truelight@0: WE_CLICK = 0, truelight@0: WE_PAINT = 1, truelight@0: WE_MOUSELOOP = 2, truelight@0: WE_TICK = 3, truelight@0: WE_4 = 4, truelight@0: WE_TIMEOUT = 5, truelight@0: WE_PLACE_OBJ = 6, truelight@0: WE_ABORT_PLACE_OBJ = 7, truelight@0: WE_DESTROY = 8, truelight@0: WE_ON_EDIT_TEXT = 9, truelight@0: WE_POPUPMENU_SELECT = 10, truelight@0: WE_POPUPMENU_OVER = 11, truelight@0: WE_DRAGDROP = 12, truelight@0: WE_PLACE_DRAG = 13, truelight@0: WE_PLACE_MOUSEUP = 14, truelight@0: WE_PLACE_PRESIZE = 15, truelight@0: WE_DROPDOWN_SELECT = 16, truelight@0: WE_RCLICK = 17, truelight@0: WE_KEYPRESS = 18, dominik@116: WE_CREATE = 19, truelight@543: WE_MOUSEOVER = 20, truelight@543: WE_ON_EDIT_TEXT_CANCEL = 21, truelight@867: WE_RESIZE = 22, darkvater@1648: WE_MESSAGE = 23 truelight@0: }; truelight@0: truelight@0: truelight@0: /****************** THESE ARE NOT WIDGET TYPES!!!!! *******************/ truelight@0: enum WindowWidgetBehaviours { truelight@0: WWB_PUSHBUTTON = 1 << 5, truelight@0: WWB_NODISBUTTON = 2 << 5, truelight@0: }; truelight@0: truelight@0: truelight@0: enum WindowWidgetTypes { truelight@0: WWT_EMPTY = 0, truelight@158: darkvater@176: WWT_IMGBTN = 1, /* button with image */ truelight@0: WWT_PANEL = WWT_IMGBTN, darkvater@176: WWT_PANEL_2 = 2, /* button with diff image when clicked */ truelight@0: darkvater@176: WWT_TEXTBTN = 3, /* button with text */ truelight@0: WWT_CLOSEBOX = WWT_TEXTBTN, darkvater@176: WWT_4 = 4, /* button with diff text when clicked */ darkvater@176: WWT_5 = 5, /* label */ darkvater@176: WWT_6 = 6, /* combo box text area */ truelight@0: WWT_MATRIX = 7, truelight@0: WWT_SCROLLBAR = 8, darkvater@176: WWT_FRAME = 9, /* frame */ truelight@0: WWT_CAPTION = 10, truelight@158: truelight@0: WWT_HSCROLLBAR = 11, darkvater@682: WWT_STICKYBOX = 12, bjarni@842: WWT_SCROLL2BAR = 13, /* 2nd vertical scrollbar*/ truelight@867: WWT_RESIZEBOX = 14, truelight@867: WWT_LAST = 15, /* Last Item. use WIDGETS_END to fill up padding!! */ truelight@0: truelight@0: WWT_MASK = 31, truelight@0: darkvater@176: WWT_PUSHTXTBTN = WWT_TEXTBTN | WWB_PUSHBUTTON, darkvater@176: WWT_PUSHIMGBTN = WWT_IMGBTN | WWB_PUSHBUTTON, darkvater@176: WWT_NODISTXTBTN = WWT_TEXTBTN | WWB_NODISBUTTON, truelight@0: }; truelight@0: truelight@867: #define WIDGETS_END WWT_LAST, RESIZE_NONE, 0, 0, 0, 0, 0, 0, STR_NULL darkvater@176: truelight@0: enum WindowFlags { truelight@0: WF_TIMEOUT_SHL = 0, truelight@0: WF_TIMEOUT_MASK = 7, truelight@0: WF_DRAGGING = 1 << 3, truelight@0: WF_SCROLL_UP = 1 << 4, truelight@0: WF_SCROLL_DOWN = 1 << 5, truelight@0: WF_SCROLL_MIDDLE = 1 << 6, truelight@0: WF_HSCROLL = 1 << 7, truelight@0: WF_SIZING = 1 << 8, darkvater@682: WF_STICKY = 1 << 9, truelight@867: truelight@0: WF_DISABLE_VP_SCROLL = 1 << 10, truelight@0: truelight@0: WF_WHITE_BORDER_ONE = 1 << 11, truelight@0: WF_WHITE_BORDER_MASK = 3 << 11, bjarni@842: WF_SCROLL2 = 1 << 13, truelight@0: }; truelight@0: truelight@0: /* window.c */ truelight@0: void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom); truelight@0: void CallWindowEventNP(Window *w, int event); tron@1093: void CallWindowTickEvent(void); tron@2549: void SetWindowDirty(const Window* w); darkvater@1648: void SendWindowMessage(WindowClass wnd_class, WindowNumber wnd_num, uint msg, uint wparam, uint lparam); truelight@0: truelight@0: Window *FindWindowById(WindowClass cls, WindowNumber number); truelight@0: void DeleteWindow(Window *w); truelight@0: Window *BringWindowToFrontById(WindowClass cls, WindowNumber number); truelight@0: Window *BringWindowToFront(Window *w); truelight@0: Window *StartWindowDrag(Window *w); truelight@0: Window *StartWindowSizing(Window *w); truelight@0: Window *FindWindowFromPt(int x, int y); truelight@0: tron@2596: bool IsWindowOfPrototype(const Window* w, const Widget* widget); truelight@867: void AssignWidgetToWindow(Window *w, const Widget *widget); truelight@0: Window *AllocateWindow( truelight@0: int x, truelight@0: int y, truelight@0: int width, truelight@0: int height, truelight@158: WindowProc *proc, truelight@0: WindowClass cls, truelight@0: const Widget *widget); truelight@0: truelight@0: Window *AllocateWindowDesc(const WindowDesc *desc); truelight@0: Window *AllocateWindowDescFront(const WindowDesc *desc, int value); truelight@0: truelight@0: Window *AllocateWindowAutoPlace( truelight@0: int width, truelight@0: int height, truelight@158: WindowProc *proc, truelight@0: WindowClass cls, truelight@0: const Widget *widget); truelight@0: truelight@0: Window *AllocateWindowAutoPlace2( truelight@0: WindowClass exist_class, truelight@0: WindowNumber exist_num, truelight@0: int width, truelight@0: int height, truelight@158: WindowProc *proc, truelight@0: WindowClass cls, truelight@0: const Widget *widget); truelight@0: truelight@0: void DrawWindowViewport(Window *w); truelight@0: tron@1093: void InitWindowSystem(void); Darkvater@1474: void UnInitWindowSystem(void); Darkvater@1474: void ResetWindowSystem(void); Darkvater@2436: int GetMenuItemIndex(const Window *w, int x, int y); pasky@1570: void InputLoop(void); tron@1093: void UpdateWindows(void); tron@2596: void InvalidateWidget(const Window* w, byte widget_index); truelight@0: celestar@2187: void GuiShowTooltips(StringID string_id); truelight@0: truelight@0: void UnclickWindowButtons(Window *w); truelight@0: void UnclickSomeWindowButtons(Window *w, uint32 mask); truelight@0: void RelocateAllWindows(int neww, int newh); tron@380: int PositionMainToolbar(Window *w); truelight@0: truelight@0: /* widget.c */ Darkvater@2436: int GetWidgetFromPos(const Window *w, int x, int y); Darkvater@2436: void DrawWindowWidgets(const Window *w); peter1138@2448: void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int button, uint32 disabled_mask, uint32 hidden_mask); truelight@0: truelight@0: void HandleButtonClick(Window *w, byte widget); truelight@0: tron@1093: Window *GetCallbackWnd(void); tron@1093: void DeleteNonVitalWindows(void); darkvater@763: void DeleteAllNonVitalWindows(void); darkvater@983: void HideVitalWindows(void); darkvater@983: void ShowVitalWindows(void); truelight@0: truelight@0: /* window.c */ darkvater@682: VARDEF Window _windows[25]; truelight@0: VARDEF Window *_last_window; truelight@0: truelight@0: VARDEF Point _cursorpos_drag_start; truelight@0: truelight@0: VARDEF bool _left_button_down; truelight@0: VARDEF bool _left_button_clicked; truelight@0: truelight@0: VARDEF bool _right_button_down; truelight@0: VARDEF bool _right_button_clicked; truelight@0: truelight@0: VARDEF int _alloc_wnd_parent_num; truelight@0: truelight@0: VARDEF int _scrollbar_start_pos; truelight@0: VARDEF int _scrollbar_size; truelight@0: VARDEF byte _scroller_click_timeout; truelight@0: truelight@0: VARDEF bool _scrolling_scrollbar; truelight@0: VARDEF bool _scrolling_viewport; truelight@0: VARDEF bool _popup_menu_active; truelight@0: truelight@0: VARDEF byte _special_mouse_mode; truelight@0: enum SpecialMouseMode { truelight@0: WSM_NONE = 0, truelight@0: WSM_DRAGDROP = 1, truelight@0: WSM_SIZING = 2, truelight@0: WSM_PRESIZE = 3, truelight@0: }; truelight@0: truelight@0: void ScrollbarClickHandler(Window *w, const Widget *wi, int x, int y); truelight@0: truelight@0: #endif /* WINDOW_H */