Changeset - r1648:720d51a7e71e
[Not reviewed]
master
0 4 0
darkvater - 19 years ago 2005-04-05 21:03:30
darkvater@openttd.org
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
- CodeChange: Introduction of SendWindowMessage() where a window can send another window a message (ala windows style msg, wparam, lparam). Messages can be sent by windowclass and by windowpointer.
- CodeChange: IsVitalWindow() simplifies a lot of checks for window handling that need to know what windows it can close, or be on top of, etc.
4 files changed with 159 insertions and 68 deletions:
0 comments (0 inline, 0 general)
network_gui.c
Show inline comments
 
@@ -1353,31 +1353,34 @@ void ShowJoinStatusWindowAfterJoin(void)
 
	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 
	_network_join_status = NETWORK_JOIN_STATUS_REGISTERING;
 
	AllocateWindowDesc(&_network_join_status_window_desc);
 
}
 

	
 

	
 

	
 
#define MAX_QUERYSTR_LEN 64
 

	
 
static void ChatWindowWndProc(Window *w, WindowEvent *e)
 
{
 
	static bool closed = false;
 
	switch(e->event) {
 
	case WE_PAINT: {
 
	switch (e->event) {
 
	case WE_CREATE:
 
		SendWindowMessage(WC_NEWS_WINDOW, 0, WE_CREATE, w->height, 0);
 
		closed = false;
 
		break;
 

	
 
	case WE_PAINT:
 
		DrawWindowWidgets(w);
 

	
 
		DrawEditBox(w, 1);
 
	} break;
 
		break;
 

	
 
	case WE_CLICK:
 
		switch(e->click.widget) {
 
		case 3: DeleteWindow(w); break; // Cancel
 
		case 2: // Send
 
press_ok:;
 
			if (strcmp(WP(w, querystr_d).text.buf, WP(w, querystr_d).text.buf + MAX_QUERYSTR_LEN) == 0) {
 
				DeleteWindow(w);
 
			} else {
 
				char *buf = WP(w, querystr_d).text.buf;
 
				WindowClass wnd_class = WP(w, querystr_d).wnd_class;
 
				WindowNumber wnd_num = WP(w, querystr_d).wnd_num;
 
@@ -1409,29 +1412,26 @@ press_ok:;
 
	} break;
 

	
 
	case WE_KEYPRESS: {
 
		switch(HandleEditBoxKey(w, 1, e)) {
 
		case 1: // Return
 
			goto press_ok;
 
		case 2: // Escape
 
			DeleteWindow(w);
 
			break;
 
		}
 
	} break;
 

	
 
	case WE_CREATE:
 
		closed = false;
 
		break;
 

	
 
	case WE_DESTROY:
 
		SendWindowMessage(WC_NEWS_WINDOW, 0, WE_DESTROY, 0, 0);
 
		// If the window is not closed yet, it means it still needs to send a CANCEL
 
		if (!closed) {
 
			Window *parent = FindWindowById(WP(w,querystr_d).wnd_class, WP(w,querystr_d).wnd_num);
 
			if (parent != NULL) {
 
				WindowEvent e;
 
				e.event = WE_ON_EDIT_TEXT_CANCEL;
 
				parent->wndproc(parent, &e);
 
			}
 
		}
 
		break;
 
	}
 
}
news_gui.c
Show inline comments
 
@@ -89,24 +89,29 @@ void DrawNewsBorder(const Window *w)
 

	
 
	GfxFillRect(left, top, left, bottom, 0xD7);
 
	GfxFillRect(right, top, right, bottom, 0xD7);
 
	GfxFillRect(left, top, right, top, 0xD7);
 
	GfxFillRect(left, bottom, right, bottom, 0xD7);
 

	
 
	DrawString(left + 2, top + 1, STR_00C6, 0);
 
}
 

	
 
static void NewsWindowProc(Window *w, WindowEvent *e)
 
{
 
	switch (e->event) {
 
	case WE_CREATE: { /* If chatbar is open at creation time, we need to go above it */
 
		const Window *w1 = FindWindowById(WC_SEND_NETWORK_MSG, 0);
 
		w->message.msg = (w1 != NULL) ? w1->height : 0;
 
	} break;
 

	
 
	case WE_PAINT: {
 
		const NewsItem *ni = WP(w, news_d).ni;
 
		ViewPort *vp;
 

	
 
		switch (ni->display_mode) {
 
			case NM_NORMAL:
 
			case NM_THIN: {
 
				DrawNewsBorder(w);
 

	
 
				DrawString(2, 1, STR_00C6, 0);
 

	
 
				SetDParam(0, ni->date);
 
@@ -175,35 +180,44 @@ static void NewsWindowProc(Window *w, Wi
 
		} break;
 
		}
 
	} break;
 

	
 
	case WE_KEYPRESS:
 
		if (e->keypress.keycode == WKC_SPACE) {
 
			// Don't continue.
 
			e->keypress.cont = false;
 
			DeleteWindow(w);
 
		}
 
		break;
 

	
 
	case WE_TICK: {
 
		int y = max(w->top - 4, _screen.height - w->height);
 
		if (y == w->top)
 
			return;
 
	case WE_MESSAGE: /* The chatbar has notified us that is was either created or closed */
 
		switch (e->message.msg) {
 
			case WE_CREATE: w->message.msg = e->message.wparam; break;
 
			case WE_DESTROY: w->message.msg = 0; break;
 
			break;
 
		}
 
		break;
 

	
 
	case WE_TICK: { /* Scroll up newsmessages from the bottom in steps of 4 pixels */
 
		int diff;
 
		int y = max(w->top - 4, _screen.height - w->height - 12 - w->message.msg);
 
		if (y == w->top) return;
 

	
 
		if (w->viewport != NULL)
 
			w->viewport->top += y - w->top;
 

	
 
		diff = abs(w->top - y);
 
		w->top = y;
 

	
 
		SetDirtyBlocks(w->left, w->top, w->left + w->width, w->top + w->height + 4);
 
		SetDirtyBlocks(w->left, w->top - diff, w->left + w->width, w->top + w->height);
 
	} break;
 
	}
 
}
 

	
 
// returns the correct index in the array
 
// (to deal with overflows)
 
static byte increaseIndex(byte i)
 
{
 
	if (i == INVALID_NEWS)
 
		return 0;
 
	i++;
 
	if (i >= MAX_NEWS)
 
@@ -330,25 +344,25 @@ static const SoundFx _news_sounds[] = {
 
static void ShowNewspaper(NewsItem *ni)
 
{
 
	Window *w;
 
	int sound;
 
	int top;
 
	ni->flags &= ~(NF_NOEXPIRE | NF_FORCE_BIG);
 
	ni->duration = 555;
 

	
 
	sound = _news_sounds[ni->type];
 
	if (sound != 0)
 
		SndPlayFx(sound);
 

	
 
	top = _screen.height - 4;
 
	top = _screen.height;
 
	switch (ni->display_mode) {
 
		case NM_NORMAL:
 
		case NM_CALLBACK: {
 
			_news_type13_desc.top = top;
 
			w = AllocateWindowDesc(&_news_type13_desc);
 
			if (ni->flags & NF_VIEWPORT)
 
				AssignWindowViewport(w, 2, 58, 0x1AA, 0x6E,
 
					ni->data_a | (ni->flags & NF_VEHICLE ? 0x80000000 : 0), 0);
 
			break;
 
		}
 

	
 
		case NM_THIN: {
window.c
Show inline comments
 
@@ -280,174 +280,196 @@ Window *BringWindowToFrontById(WindowCla
 
{
 
	Window *w = FindWindowById(cls, number);
 

	
 
	if (w != NULL) {
 
		w->flags4 |= WF_WHITE_BORDER_MASK;
 
		SetWindowDirty(w);
 
		w = BringWindowToFront(w);
 
	}
 

	
 
	return w;
 
}
 

	
 
static inline bool IsVitalWindow(const Window *w)
 
{
 
	WindowClass wc = w->window_class;
 
	return (wc == WC_MAIN_TOOLBAR || wc == WC_STATUS_BAR || wc == WC_NEWS_WINDOW || wc == WC_SEND_NETWORK_MSG);
 
}
 

	
 
/** On clicking on a window, make it the frontmost window of all. However
 
 * there are certain windows that always need to be on-top; these include
 
 * - Toolbar, Statusbar (always on)
 
 * - New window, Chatbar (only if open)
 
 * @param w window that is put into the foreground
 
 */
 
Window *BringWindowToFront(Window *w)
 
{
 
	Window *v;
 
	Window temp;
 

	
 
	v = _last_window;
 
	do {
 
		if (--v < _windows)
 
			return w;
 
	} while (v->window_class == WC_MAIN_TOOLBAR || v->window_class == WC_STATUS_BAR || v->window_class == WC_NEWS_WINDOW);
 
	} while (IsVitalWindow(v));
 

	
 
	if (w == v)
 
		return w;
 

	
 
	assert(w < v);
 

	
 
	temp = *w;
 
	memmove(w, w + 1, (v - w) * sizeof(Window));
 
	*v = temp;
 

	
 
	SetWindowDirty(v);
 

	
 
	return v;
 
}
 

	
 
/* We have run out of windows, so find a suitable candidate for replacement.
 
 * Keep all important windows intact */
 
/** We have run out of windows, so find a suitable candidate for replacement.
 
 * Keep all important windows intact. These are
 
 * - Main window (gamefield), Toolbar, Statusbar (always on)
 
 * - News window, Chatbar (when on)
 
 * - Any sticked windows since we wanted to keep these
 
 * @return w pointer to the window that is going to be deleted
 
 */
 
static Window *FindDeletableWindow(void)
 
{
 
	Window *w;
 
	for (w = _windows; w < endof(_windows); w++) {
 
		if (w->window_class != WC_MAIN_WINDOW && w->window_class != WC_MAIN_TOOLBAR &&
 
			  w->window_class != WC_STATUS_BAR && w->window_class != WC_NEWS_WINDOW &&
 
				!(w->flags4 & WF_STICKY) )
 
		if (w->window_class != WC_MAIN_WINDOW && !IsVitalWindow(w) && !(w->flags4 & WF_STICKY) )
 
				return w;
 
	}
 
	return NULL;
 
}
 

	
 
/* A window must be freed, and all are marked as important windows. Ease the
 
 * restriction a bit by allowing to delete sticky windows */
 
/** A window must be freed, and all are marked as important windows. Ease the
 
 * restriction a bit by allowing to delete sticky windows. Keep important/vital
 
 * windows intact (Main window, Toolbar, Statusbar, News Window, Chatbar)
 
 * @see FindDeletableWindow()
 
 * @return w Pointer to the window that is being deleted
 
 */
 
static Window *ForceFindDeletableWindow(void)
 
{
 
	Window *w;
 
	for (w = _windows;; w++) {
 
		assert(w < _last_window);
 

	
 
		if (w->window_class != WC_MAIN_WINDOW && w->window_class != WC_MAIN_TOOLBAR &&
 
			  w->window_class != WC_STATUS_BAR && w->window_class != WC_NEWS_WINDOW)
 
		if (w->window_class != WC_MAIN_WINDOW && !IsVitalWindow(w))
 
				return w;
 
	}
 
}
 

	
 
bool IsWindowOfPrototype(Window *w, const Widget *widget)
 
{
 
	return (w->original_widget == widget);
 
}
 

	
 
/* Copies 'widget' to 'w->widget' */
 
/* Copies 'widget' to 'w->widget' to allow for resizable windows */
 
void AssignWidgetToWindow(Window *w, const Widget *widget)
 
{
 
	w->original_widget = widget;
 

	
 
	if (widget != NULL) {
 
		const Widget *wi = widget;
 
		uint index = 1;
 
		while (wi->type != WWT_LAST) {
 
			wi++;
 
			index++;
 
		}
 

	
 
		w->widget = realloc(w->widget, sizeof(Widget) * index);
 
		memcpy(w->widget, widget, sizeof(Widget) * index);
 
	} else
 
		w->widget = NULL;
 
}
 

	
 
/** Open a new window. If there is no space for a new window, close an open
 
 * window. Try to avoid stickied windows, but if there is no else, close one of
 
 * those as well. Then make sure all created windows are below some always-on-top
 
 * ones. Finally set all variables and call the WE_CREATE event
 
 * @param x offset in pixels from the left of the screen
 
 * @param y offset in pixels from the top of the screen
 
 * @param width width in pixels of the window
 
 * @param height height in pixels of the window
 
 * @param *proc @see WindowProc function to call when any messages/updates happen to the window
 
 * @param cls @see WindowClass class of the window, used for identification and grouping
 
 * @param *widget @see Widget pointer to the window layout and various elements
 
 * @return @see Window pointer of the newly created window
 
 */
 
Window *AllocateWindow(
 
							int x,
 
							int y,
 
							int width,
 
							int height,
 
							WindowProc *proc,
 
							WindowClass cls,
 
							const Widget *widget)
 
							int x, int y, int width, int height,
 
							WindowProc *proc, WindowClass cls, const Widget *widget)
 
{
 
	Window *w;
 
	Window *w = _last_window; // last window keeps track of the highest open window
 

	
 
	w = _last_window;
 

	
 
	// We have run out of windows, close one and use that as the place for our new one
 
	if (w >= endof(_windows)) {
 
		w = FindDeletableWindow();
 

	
 
		if (w == NULL) // no window found, force it!
 
			w = ForceFindDeletableWindow();
 

	
 
		DeleteWindow(w);
 
		w = _last_window;
 
	}
 

	
 
	if (w != _windows && cls != WC_NEWS_WINDOW) {
 
	/* XXX - This very strange construction makes sure that the chatbar is always
 
	 * on top of other windows. Why? It is created as last_window (so, on top).
 
	 * Any other window will go below toolbar/statusbar/news window, which implicitely
 
	 * also means it is below the chatbar. Very likely needs heavy improvement
 
	 * to de-braindeadize */
 
	if (w != _windows && cls != WC_SEND_NETWORK_MSG) {
 
		Window *v;
 

	
 
		/* XXX - if not this order (toolbar/statusbar and then news), game would
 
		 * crash because it will try to copy a negative size for the news-window.
 
		 * Eg. window was already moved BELOW news (which is below toolbar/statusbar)
 
		 * and now needs to move below those too. That is a negative move. */
 
		v = FindWindowById(WC_MAIN_TOOLBAR, 0);
 
		if (v) {
 
		if (v != NULL) {
 
			memmove(v+1, v, (byte*)w - (byte*)v);
 
			w = v;
 
		}
 

	
 
		v = FindWindowById(WC_STATUS_BAR, 0);
 
		if (v) {
 
		if (v != NULL) {
 
			memmove(v+1, v, (byte*)w - (byte*)v);
 
			w = v;
 
		}
 

	
 
		v = FindWindowById(WC_NEWS_WINDOW, 0);
 
		if (v != NULL) {
 
			memmove(v+1, v, (byte*)w - (byte*)v);
 
			w = v;
 
		}
 
	}
 

	
 
	/* XXX: some more code here */
 
	// Set up window properties
 
	memset(w, 0, sizeof(Window));
 
	w->window_class = cls;
 
	w->flags4 = WF_WHITE_BORDER_MASK;
 
	w->flags4 = WF_WHITE_BORDER_MASK; // just opened windows have a white border
 
	w->caption_color = 0xFF;
 
	w->window_number = 0;
 
	w->left = x;
 
	w->top = y;
 
	w->width = width;
 
	w->height = height;
 
	w->viewport = NULL;
 
	w->desc_flags = 0;
 
//	w->landscape_assoc = 0xFFFF;
 
	w->wndproc = proc;
 
	w->click_state = 0;
 
	w->disabled_state = 0;
 
	w->hidden_state = 0;
 
//	w->unk22 = 0xFFFF;
 
	w->vscroll.pos = 0;
 
	w->vscroll.count = 0;
 
	w->hscroll.pos = 0;
 
	w->hscroll.count = 0;
 
	w->widget = NULL;
 
	AssignWidgetToWindow(w, widget);
 
	w->resize.width = width;
 
	w->resize.height = height;
 
	w->resize.step_width = 1;
 
	w->resize.step_height = 1;
 

	
 
	{
 
		uint i;
 
		for (i=0;i<lengthof(w->custom);i++)
 
			w->custom[i] = 0;
 
	}
 

	
 
	_last_window++;
 

	
 
	SetWindowDirty(w);
 

	
 
	CallWindowEventNP(w, WE_CREATE);
 

	
 
	return w;
 
}
 

	
 
Window *AllocateWindowAutoPlace2(
 
	WindowClass exist_class,
 
	WindowNumber exist_num,
 
@@ -1216,49 +1238,76 @@ stop_capt:;
 

	
 
		_cursor.delta.x = _cursor.delta.y = 0;
 

	
 
		SetWindowDirty(w);
 
		return false;
 
	}
 
}
 

	
 
static Window *MaybeBringWindowToFront(Window *w)
 
{
 
	Window *u;
 

	
 
	if (w->window_class == WC_MAIN_WINDOW ||
 
			w->window_class == WC_MAIN_TOOLBAR ||
 
			w->window_class == WC_STATUS_BAR ||
 
			w->window_class == WC_NEWS_WINDOW ||
 
			w->window_class == WC_TOOLTIPS ||
 
			w->window_class == WC_DROPDOWN_MENU)
 
	if (w->window_class == WC_MAIN_WINDOW || IsVitalWindow(w) ||
 
			w->window_class == WC_TOOLTIPS    || w->window_class == WC_DROPDOWN_MENU)
 
				return w;
 

	
 
	for(u=w; ++u != _last_window;) {
 
		if (u->window_class == WC_MAIN_WINDOW || u->window_class==WC_MAIN_TOOLBAR || u->window_class==WC_STATUS_BAR ||
 
				u->window_class == WC_NEWS_WINDOW || u->window_class == WC_TOOLTIPS || u->window_class == WC_DROPDOWN_MENU)
 
	for (u = w; ++u != _last_window;) {
 
		if (u->window_class == WC_MAIN_WINDOW || IsVitalWindow(u) ||
 
			  u->window_class == WC_TOOLTIPS    || u->window_class == WC_DROPDOWN_MENU)
 
				continue;
 

	
 
		if (w->left + w->width <= u->left ||
 
				u->left + u->width <= w->left ||
 
				w->top  + w->height <= u->top ||
 
				u->top + u->height <= w->top)
 
					continue;
 

	
 
		return BringWindowToFront(w);
 
	}
 

	
 
	return w;
 
}
 

	
 
/** Send a message from one window to another. The receiving window is found by
 
 * @param w @see Window pointer pointing to the other window
 
 * @param msg Specifies the message to be sent
 
 * @param wparam Specifies additional message-specific information
 
 * @param lparam Specifies additional message-specific information
 
 */
 
void SendWindowMessageW(Window *w, uint msg, uint wparam, uint lparam)
 
{
 
	WindowEvent e;
 

	
 
	e.message.event  = WE_MESSAGE;
 
	e.message.msg    = msg;
 
	e.message.wparam = wparam;
 
	e.message.lparam = lparam;
 

	
 
	w->wndproc(w, &e);
 
}
 

	
 
/** Send a message from one window to another. The receiving window is found by
 
 * @param wnd_class @see WindowClass class AND
 
 * @param wnd_num @see WindowNumber number, mostly 0
 
 * @param msg Specifies the message to be sent
 
 * @param wparam Specifies additional message-specific information
 
 * @param lparam Specifies additional message-specific information
 
 */
 
void SendWindowMessage(WindowClass wnd_class, WindowNumber wnd_num, uint msg, uint wparam, uint lparam)
 
{
 
	Window *w = FindWindowById(wnd_class, wnd_num);
 
	if (w != NULL) SendWindowMessageW(w, msg, wparam, lparam);
 
}
 

	
 
static void HandleKeypress(uint32 key)
 
{
 
	Window *w;
 
	WindowEvent we;
 
 /* Stores if a window with a textfield for typing is open
 
  * If this is the case, keypress events are only passed to windows with text fields and
 
	* to thein this main toolbar. */
 
	bool query_open = false;
 

	
 
	// Setup event
 
	we.keypress.event = WE_KEYPRESS;
 
	we.keypress.ascii = key & 0xFF;
window.h
Show inline comments
 
@@ -52,24 +52,28 @@ enum {
 
	RESIZE_RTB    = RESIZE_RIGHT | RESIZE_TOP    | RESIZE_BOTTOM,
 
};
 

	
 
typedef struct Widget {
 
	byte type;
 
	byte resize_flag;
 
	byte color;
 
	uint16 left, right, top, bottom;
 
	uint16 unkA;
 
	uint16 tooltips;
 
} Widget;
 

	
 
/* XXX - outside "byte event" so you can set event directly without going into
 
 * the union elements at first. Because of this every first element of the union
 
 * MUST BE 'byte event'. Whoever did this must get shot! Scheduled for immediate
 
 * rewrite after 0.4.0 */
 
union WindowEvent {
 
	byte event;
 
	struct {
 
		byte event;
 
		Point pt;
 
		int widget;
 
	} click;
 

	
 
	struct {
 
		byte event;
 
		Point pt;
 
		uint tile;
 
@@ -108,24 +112,31 @@ union WindowEvent {
 
	struct {
 
		byte event;
 
		Point pt;
 
		int widget;
 
	} mouseover;
 

	
 
	struct {
 
		byte event;
 
		bool cont;   // continue the search? (default true)
 
		byte ascii;  // 8-bit ASCII-value of the key
 
		uint16 keycode;// untranslated key (including shift-state)
 
	} keypress;
 

	
 
	struct {
 
		byte event;
 
		uint msg;    // message to be sent
 
		uint wparam; // additional message-specific information
 
		uint lparam; // additional message-specific information
 
	} message;
 
};
 

	
 
enum WindowKeyCodes {
 
	WKC_SHIFT = 0x8000,
 
	WKC_CTRL  = 0x4000,
 
	WKC_ALT   = 0x2000,
 
	WKC_META  = 0x1000,
 

	
 
	// Special ones
 
	WKC_NONE = 0,
 
	WKC_ESC=1,
 
	WKC_BACKSPACE = 2,
 
@@ -250,45 +261,52 @@ typedef struct {
 
typedef struct {
 
	uint16 count, cap, pos;
 
} Scrollbar;
 

	
 
typedef struct {
 
	uint width; /* Minimum width and height */
 
	uint height;
 

	
 
	uint step_width; /* In how big steps the width and height go */
 
	uint step_height;
 
} ResizeInfo;
 

	
 
typedef struct {
 
		int msg;
 
		int wparam;
 
		int lparam;
 
} Message;
 

	
 
struct Window {
 
	uint16 flags4;
 
	WindowClass window_class;
 
	WindowNumber window_number;
 

	
 
	int left, top;
 
	int width, height;
 

	
 
	Scrollbar hscroll, vscroll, vscroll2;
 
	ResizeInfo resize;
 

	
 
	byte caption_color;
 

	
 
	uint32 click_state, disabled_state, hidden_state;
 
	WindowProc *wndproc;
 
	ViewPort *viewport;
 
	const Widget *original_widget;
 
 	Widget *widget;
 
	//const WindowDesc *desc;
 
	uint32 desc_flags;
 

	
 
	Message message;
 
	byte custom[WINDOW_CUSTOM_SIZE];
 
};
 

	
 
typedef struct {
 
	byte item_count; /* follow_vehicle */
 
	byte sel_index;		/* scrollpos_x */
 
	byte main_button; /* scrollpos_y */
 
	byte action_id;
 
	StringID string_id; /* unk30 */
 
	uint16 checked_items; /* unk32 */
 
} menu_d;
 
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(menu_d));
 
@@ -416,48 +434,56 @@ typedef enum VehicleListFlags {
 
	VL_REBUILD = 0x04
 
} VehicleListFlags;
 

	
 
typedef struct vehiclelist_d {
 
	SortStruct *sort_list;
 
	uint16 list_length;
 
	byte sort_type;
 
	VehicleListFlags flags;
 
	uint16 resort_timer;
 
} vehiclelist_d;
 
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vehiclelist_d));
 

	
 
typedef struct message_d {
 
	int msg;
 
	int wparam;
 
	int lparam;
 
} message_d;
 
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(message_d));
 

	
 
enum WindowEvents {
 
	WE_CLICK = 0,
 
	WE_PAINT = 1,
 
	WE_MOUSELOOP = 2,
 
	WE_TICK = 3,
 
	WE_4 = 4,
 
	WE_TIMEOUT = 5,
 
	WE_PLACE_OBJ = 6,
 
	WE_ABORT_PLACE_OBJ = 7,
 
	WE_DESTROY = 8,
 
	WE_ON_EDIT_TEXT = 9,
 
	WE_POPUPMENU_SELECT = 10,
 
	WE_POPUPMENU_OVER = 11,
 
	WE_DRAGDROP = 12,
 
	WE_PLACE_DRAG = 13,
 
	WE_PLACE_MOUSEUP = 14,
 
	WE_PLACE_PRESIZE = 15,
 
	WE_DROPDOWN_SELECT = 16,
 
	WE_RCLICK = 17,
 
	WE_KEYPRESS = 18,
 
	WE_CREATE = 19,
 
	WE_MOUSEOVER = 20,
 
	WE_ON_EDIT_TEXT_CANCEL = 21,
 
	WE_RESIZE = 22,
 
	WE_MESSAGE = 23
 
};
 

	
 

	
 
/****************** THESE ARE NOT WIDGET TYPES!!!!! *******************/
 
enum WindowWidgetBehaviours {
 
	WWB_PUSHBUTTON = 1 << 5,
 
	WWB_NODISBUTTON = 2 << 5,
 
};
 

	
 

	
 
enum WindowWidgetTypes {
 
	WWT_EMPTY = 0,
 
@@ -510,24 +536,26 @@ enum WindowFlags {
 
};
 

	
 

	
 
void DispatchLeftClickEvent(Window *w, int x, int y);
 
void DispatchRightClickEvent(Window *w, int x, int y);
 
void DispatchMouseWheelEvent(Window *w, uint widget, int wheel);
 

	
 
/* window.c */
 
void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom);
 
void CallWindowEventNP(Window *w, int event);
 
void CallWindowTickEvent(void);
 
void SetWindowDirty(Window *w);
 
void SendWindowMessageW(Window *w, uint msg, uint wparam, uint lparam);
 
void SendWindowMessage(WindowClass wnd_class, WindowNumber wnd_num, uint msg, uint wparam, uint lparam);
 

	
 
Window *FindWindowById(WindowClass cls, WindowNumber number);
 
void DeleteWindow(Window *w);
 
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number);
 
Window *BringWindowToFront(Window *w);
 
Window *StartWindowDrag(Window *w);
 
Window *StartWindowSizing(Window *w);
 
Window *FindWindowFromPt(int x, int y);
 

	
 
bool IsWindowOfPrototype(Window *w, const Widget *widget);
 
void AssignWidgetToWindow(Window *w, const Widget *widget);
 
/* Use this function to save the current widget to be the global default */
0 comments (0 inline, 0 general)