window.c
changeset 5137 a1f26c30fecd
parent 5126 d87bd8d5e159
child 5143 a78072872bff
equal deleted inserted replaced
5136:e6f1857961aa 5137:a1f26c30fecd
   220 	}
   220 	}
   221 }
   221 }
   222 
   222 
   223 static void DrawOverlappedWindow(Window* const *wz, int left, int top, int right, int bottom)
   223 static void DrawOverlappedWindow(Window* const *wz, int left, int top, int right, int bottom)
   224 {
   224 {
   225 	const Window* const *vz = wz;
   225 	Window* const *vz = wz;
   226 	int x;
   226 	int x;
   227 
   227 
   228 	while (++vz != _last_z_window) {
   228 	while (++vz != _last_z_window) {
   229 		const Window *v = *vz;
   229 		const Window *v = *vz;
   230 
   230 
  1056 			y = _cursor.pos.y + _drag_delta.y;
  1056 			y = _cursor.pos.y + _drag_delta.y;
  1057 			nx = x;
  1057 			nx = x;
  1058 			ny = y;
  1058 			ny = y;
  1059 
  1059 
  1060 			if (_patches.window_snap_radius != 0) {
  1060 			if (_patches.window_snap_radius != 0) {
  1061 				const Window* const *vz;
  1061 				Window* const *vz;
  1062 
  1062 
  1063 				int hsnap = _patches.window_snap_radius;
  1063 				int hsnap = _patches.window_snap_radius;
  1064 				int vsnap = _patches.window_snap_radius;
  1064 				int vsnap = _patches.window_snap_radius;
  1065 				int delta;
  1065 				int delta;
  1066 
  1066 
  1368 	return false;
  1368 	return false;
  1369 }
  1369 }
  1370 
  1370 
  1371 static void MaybeBringWindowToFront(const Window *w)
  1371 static void MaybeBringWindowToFront(const Window *w)
  1372 {
  1372 {
  1373 	const Window* const *wz;
  1373 	Window* const *wz;
  1374 	const Window* const *uz;
  1374 	Window* const *uz;
  1375 
  1375 
  1376 	if (w->window_class == WC_MAIN_WINDOW ||
  1376 	if (w->window_class == WC_MAIN_WINDOW ||
  1377 			IsVitalWindow(w) ||
  1377 			IsVitalWindow(w) ||
  1378 			w->window_class == WC_TOOLTIPS ||
  1378 			w->window_class == WC_TOOLTIPS ||
  1379 			w->window_class == WC_DROPDOWN_MENU) {
  1379 			w->window_class == WC_DROPDOWN_MENU) {
  1723 	return -1;
  1723 	return -1;
  1724 }
  1724 }
  1725 
  1725 
  1726 void InvalidateWindow(WindowClass cls, WindowNumber number)
  1726 void InvalidateWindow(WindowClass cls, WindowNumber number)
  1727 {
  1727 {
  1728 	const Window* const *wz;
  1728 	Window* const *wz;
  1729 
  1729 
  1730 	FOR_ALL_WINDOWS(wz) {
  1730 	FOR_ALL_WINDOWS(wz) {
  1731 		const Window *w = *wz;
  1731 		const Window *w = *wz;
  1732 		if (w->window_class == cls && w->window_number == number) SetWindowDirty(w);
  1732 		if (w->window_class == cls && w->window_number == number) SetWindowDirty(w);
  1733 	}
  1733 	}
  1743 	SetDirtyBlocks(w->left + wi->left, w->top + wi->top, w->left + wi->right + 1, w->top + wi->bottom + 1);
  1743 	SetDirtyBlocks(w->left + wi->left, w->top + wi->top, w->left + wi->right + 1, w->top + wi->bottom + 1);
  1744 }
  1744 }
  1745 
  1745 
  1746 void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index)
  1746 void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index)
  1747 {
  1747 {
  1748 	const Window* const *wz;
  1748 	Window* const *wz;
  1749 
  1749 
  1750 	FOR_ALL_WINDOWS(wz) {
  1750 	FOR_ALL_WINDOWS(wz) {
  1751 		const Window *w = *wz;
  1751 		const Window *w = *wz;
  1752 		if (w->window_class == cls && w->window_number == number) {
  1752 		if (w->window_class == cls && w->window_number == number) {
  1753 			InvalidateWidget(w, widget_index);
  1753 			InvalidateWidget(w, widget_index);
  1755 	}
  1755 	}
  1756 }
  1756 }
  1757 
  1757 
  1758 void InvalidateWindowClasses(WindowClass cls)
  1758 void InvalidateWindowClasses(WindowClass cls)
  1759 {
  1759 {
  1760 	const Window* const *wz;
  1760 	Window* const *wz;
  1761 
  1761 
  1762 	FOR_ALL_WINDOWS(wz) {
  1762 	FOR_ALL_WINDOWS(wz) {
  1763 		if ((*wz)->window_class == cls) SetWindowDirty(*wz);
  1763 		if ((*wz)->window_class == cls) SetWindowDirty(*wz);
  1764 	}
  1764 	}
  1765 }
  1765 }
  1915 				top = (newh - 26); // 26 = height of status bar + height of chat bar
  1915 				top = (newh - 26); // 26 = height of status bar + height of chat bar
  1916 				left = (neww - w->width) >> 1;
  1916 				left = (neww - w->width) >> 1;
  1917 				break;
  1917 				break;
  1918 
  1918 
  1919 			case WC_CONSOLE:
  1919 			case WC_CONSOLE:
  1920 				IConsoleResize(w);
  1920 				IConsoleResize();
  1921 				break;
  1921 				continue;
  1922 
  1922 
  1923 			default:
  1923 			default:
  1924 				left = w->left;
  1924 				left = w->left;
  1925 				if (left + (w->width >> 1) >= neww) left = neww - w->width;
  1925 				if (left + (w->width >> 1) >= neww) left = neww - w->width;
  1926 				top = w->top;
  1926 				top = w->top;