comparison win/dw.c @ 126:72cb88af4490

Finalized splitbar support on Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 20 Oct 2002 05:39:02 +0000
parents edf615d8266e
children c5c3ccb84ac7
comparison
equal deleted inserted replaced
125:0d2cbd9d4028 126:72cb88af4490
72 BYTE _blue[] = { 0x00, 0x00, 0x00, 0x00, 0xcc, 0xbb, 0xbb, 0xaa, 0x77, 72 BYTE _blue[] = { 0x00, 0x00, 0x00, 0x00, 0xcc, 0xbb, 0xbb, 0xaa, 0x77,
73 0x00, 0x00, 0x00, 0xff, 0xff, 0xee, 0xff, 0xaa, 0x00}; 73 0x00, 0x00, 0x00, 0xff, 0xff, 0xee, 0xff, 0xaa, 0x00};
74 74
75 HBRUSH _colors[18]; 75 HBRUSH _colors[18];
76 76
77 static LONG lColor[SPLITBAR_WIDTH] =
78 {
79 DW_CLR_BLACK,
80 DW_CLR_PALEGRAY,
81 DW_CLR_WHITE
82 };
83 77
84 void _resize_notebook_page(HWND handle, int pageid); 78 void _resize_notebook_page(HWND handle, int pageid);
85 int _lookup_icon(HWND handle, HICON hicon, int type); 79 int _lookup_icon(HWND handle, HICON hicon, int type);
86 80
87 #ifdef NO_SIGNALS
88 #define USE_FILTER
89 #else
90 typedef struct _sighandler 81 typedef struct _sighandler
91 { 82 {
92 struct _sighandler *next; 83 struct _sighandler *next;
93 ULONG message; 84 ULONG message;
94 HWND window; 85 HWND window;
293 */ 284 */
294 void _new_signal(ULONG message, HWND window, void *signalfunction, void *data) 285 void _new_signal(ULONG message, HWND window, void *signalfunction, void *data)
295 { 286 {
296 SignalHandler *new = malloc(sizeof(SignalHandler)); 287 SignalHandler *new = malloc(sizeof(SignalHandler));
297 288
298 #ifndef NO_SIGNALS
299 if(message == WM_COMMAND) 289 if(message == WM_COMMAND)
300 dw_signal_disconnect_by_window(window); 290 dw_signal_disconnect_by_window(window);
301 #endif
302 291
303 new->message = message; 292 new->message = message;
304 new->window = window; 293 new->window = window;
305 new->signalfunction = signalfunction; 294 new->signalfunction = signalfunction;
306 new->data = data; 295 new->data = data;
341 if(stricmp(signame, SignalTranslate[z].name) == 0) 330 if(stricmp(signame, SignalTranslate[z].name) == 0)
342 return SignalTranslate[z].message; 331 return SignalTranslate[z].message;
343 } 332 }
344 return 0L; 333 return 0L;
345 } 334 }
346 #endif
347 335
348 /* This function removes and handlers on windows and frees 336 /* This function removes and handlers on windows and frees
349 * the user memory allocated to it. 337 * the user memory allocated to it.
350 */ 338 */
351 BOOL CALLBACK _free_window_memory(HWND handle, LPARAM lParam) 339 BOOL CALLBACK _free_window_memory(HWND handle, LPARAM lParam)
352 { 340 {
353 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA); 341 ColorInfo *thiscinfo = (ColorInfo *)GetWindowLong(handle, GWL_USERDATA);
354 342
355 #ifndef NO_SIGNALS
356 dw_signal_disconnect_by_window(handle); 343 dw_signal_disconnect_by_window(handle);
357 #endif
358 344
359 if(thiscinfo) 345 if(thiscinfo)
360 { 346 {
361 /* Delete the brush so as not to leak GDI objects */ 347 /* Delete the brush so as not to leak GDI objects */
362 if(thiscinfo->hbrush) 348 if(thiscinfo->hbrush)
715 GetWindowRect(hwndFrame, &rcl); 701 GetWindowRect(hwndFrame, &rcl);
716 SetWindowPos(hwndFrame, HWND_TOP, 0, 0, rcl.right - rcl.left, 702 SetWindowPos(hwndFrame, HWND_TOP, 0, 0, rcl.right - rcl.left,
717 rcl.bottom - rcl.top - 1, SWP_NOMOVE | SWP_NOZORDER); 703 rcl.bottom - rcl.top - 1, SWP_NOMOVE | SWP_NOZORDER);
718 SetWindowPos(hwndFrame, HWND_TOP, 0, 0, rcl.right - rcl.left, 704 SetWindowPos(hwndFrame, HWND_TOP, 0, 0, rcl.right - rcl.left,
719 rcl.bottom - rcl.top, SWP_NOMOVE | SWP_NOZORDER); 705 rcl.bottom - rcl.top, SWP_NOMOVE | SWP_NOZORDER);
720 }
721
722 /* Function: TrackRectangle
723 * Abstract: Tracks given rectangle.
724 *
725 * If rclBounds is NULL, then track rectangle on entire desktop.
726 * rclTrack is in window coorditates and will be mapped to
727 * desktop.
728 */
729
730 BOOL _TrackRectangle(HWND hwndBase, RECTL* rclTrack, RECTL* rclBounds)
731 {
732 ULONG rc = 0;
733 #if 0
734 TRACKINFO track;
735
736 track.cxBorder = 1;
737 track.cyBorder = 1;
738 track.cxGrid = 1;
739 track.cyGrid = 1;
740 track.cxKeyboard = 8;
741 track.cyKeyboard = 8;
742
743 if(!rclTrack)
744 return FALSE;
745
746 if(rclBounds)
747 {
748 track.rclBoundary = *rclBounds;
749 }
750 else
751 {
752 track.rclBoundary.yTop =
753 track.rclBoundary.xRight = 3000;
754 track.rclBoundary.yBottom =
755 track.rclBoundary.xLeft = -3000;
756 }
757
758 track.rclTrack = *rclTrack;
759
760 MapWindowPoints(hwndBase,
761 HWND_DESKTOP,
762 (PPOINT)&track.rclTrack,
763 2);
764
765 track.ptlMinTrackSize.x = track.rclTrack.xRight
766 - track.rclTrack.xLeft;
767 track.ptlMinTrackSize.y = track.rclTrack.yTop
768 - track.rclTrack.yBottom;
769 track.ptlMaxTrackSize.x = track.rclTrack.xRight
770 - track.rclTrack.xLeft;
771 track.ptlMaxTrackSize.y = track.rclTrack.yTop
772 - track.rclTrack.yBottom;
773
774 track.fs = TF_MOVE | TF_ALLINBOUNDARY;
775
776 rc = WinTrackRect(HWND_DESKTOP, 0, &track);
777
778 if(rc)
779 *rclTrack = track.rclTrack;
780
781 #endif
782 return rc;
783 } 706 }
784 707
785 /* This function calculates how much space the widgets and boxes require 708 /* This function calculates how much space the widgets and boxes require
786 * and does expansion as necessary. 709 * and does expansion as necessary.
787 */ 710 */
1249 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */ 1172 /* The main window procedure for Dynamic Windows, all the resizing code is done here. */
1250 BOOL CALLBACK _wndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) 1173 BOOL CALLBACK _wndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2)
1251 { 1174 {
1252 int result = -1; 1175 int result = -1;
1253 static int command_active = 0; 1176 static int command_active = 0;
1254 #ifndef NO_SIGNALS
1255 SignalHandler *tmp = Root; 1177 SignalHandler *tmp = Root;
1256 #endif
1257 void (* windowfunc)(PVOID); 1178 void (* windowfunc)(PVOID);
1258 ULONG origmsg = msg; 1179 ULONG origmsg = msg;
1259 1180
1260 if(msg == WM_RBUTTONDOWN || msg == WM_MBUTTONDOWN) 1181 if(msg == WM_RBUTTONDOWN || msg == WM_MBUTTONDOWN)
1261 msg = WM_LBUTTONDOWN; 1182 msg = WM_LBUTTONDOWN;
1265 msg = WM_VSCROLL; 1186 msg = WM_VSCROLL;
1266 1187
1267 if(filterfunc) 1188 if(filterfunc)
1268 result = filterfunc(hWnd, msg, mp1, mp2); 1189 result = filterfunc(hWnd, msg, mp1, mp2);
1269 1190
1270 #ifndef NO_SIGNALS
1271 if(result == -1) 1191 if(result == -1)
1272 { 1192 {
1273 /* Avoid infinite recursion */ 1193 /* Avoid infinite recursion */
1274 command_active = 1; 1194 command_active = 1;
1275 1195
1543 if(tmp) 1463 if(tmp)
1544 tmp = tmp->next; 1464 tmp = tmp->next;
1545 } 1465 }
1546 command_active = 0; 1466 command_active = 0;
1547 } 1467 }
1548 #endif
1549 1468
1550 /* Now that any handlers are done... do normal processing */ 1469 /* Now that any handlers are done... do normal processing */
1551 switch( msg ) 1470 switch( msg )
1552 { 1471 {
1553 case WM_PAINT: 1472 case WM_PAINT:
2128 { 2047 {
2129 case WM_COMMAND: 2048 case WM_COMMAND:
2130 case WM_NOTIFY: 2049 case WM_NOTIFY:
2131 _wndproc(hWnd, msg, mp1, mp2); 2050 _wndproc(hWnd, msg, mp1, mp2);
2132 break; 2051 break;
2133 #ifndef NO_SIGNALS
2134 case WM_LBUTTONDBLCLK: 2052 case WM_LBUTTONDBLCLK:
2135 case WM_CHAR: 2053 case WM_CHAR:
2136 { 2054 {
2137 LV_ITEM lvi; 2055 LV_ITEM lvi;
2138 int iItem; 2056 int iItem;
2227 if(tmp) 2145 if(tmp)
2228 tmp = tmp->next; 2146 tmp = tmp->next;
2229 } 2147 }
2230 } 2148 }
2231 break; 2149 break;
2232 #else 2150 }
2151
2152 if(!cinfo || !cinfo->pOldProc)
2153 return DefWindowProc(hWnd, msg, mp1, mp2);
2154 return CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2);
2155 }
2156
2157 BOOL CALLBACK _treewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2)
2158 {
2159 ContainerInfo *cinfo;
2160
2161 cinfo = (ContainerInfo *)GetWindowLong(hWnd, GWL_USERDATA);
2162
2163 switch( msg )
2164 {
2233 case WM_CHAR: 2165 case WM_CHAR:
2234 if(LOWORD(mp1) == '\t') 2166 if(LOWORD(mp1) == '\t')
2235 { 2167 {
2236 if(GetAsyncKeyState(VK_SHIFT) & 0x8000) 2168 if(GetAsyncKeyState(VK_SHIFT) & 0x8000)
2237 _shift_focus_back(hWnd); 2169 _shift_focus_back(hWnd);
2238 else 2170 else
2239 _shift_focus(hWnd); 2171 _shift_focus(hWnd);
2240 return FALSE; 2172 return FALSE;
2241 } 2173 }
2242 break; 2174 break;
2243 #endif
2244 } 2175 }
2245 2176
2246 if(!cinfo || !cinfo->pOldProc) 2177 if(!cinfo || !cinfo->pOldProc)
2247 return DefWindowProc(hWnd, msg, mp1, mp2); 2178 return DefWindowProc(hWnd, msg, mp1, mp2);
2248 return CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2); 2179 return CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2);
2249 } 2180 }
2250 2181
2251 BOOL CALLBACK _treewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2)
2252 {
2253 ContainerInfo *cinfo;
2254
2255 cinfo = (ContainerInfo *)GetWindowLong(hWnd, GWL_USERDATA);
2256
2257 switch( msg )
2258 {
2259 case WM_CHAR:
2260 if(LOWORD(mp1) == '\t')
2261 {
2262 if(GetAsyncKeyState(VK_SHIFT) & 0x8000)
2263 _shift_focus_back(hWnd);
2264 else
2265 _shift_focus(hWnd);
2266 return FALSE;
2267 }
2268 break;
2269 }
2270
2271 if(!cinfo || !cinfo->pOldProc)
2272 return DefWindowProc(hWnd, msg, mp1, mp2);
2273 return CallWindowProc(cinfo->pOldProc, hWnd, msg, mp1, mp2);
2274 }
2275
2276 void _changebox(Box *thisbox, int percent, int type) 2182 void _changebox(Box *thisbox, int percent, int type)
2277 { 2183 {
2278 int z; 2184 int z;
2279 2185
2280 for(z=0;z<thisbox->count;z++) 2186 for(z=0;z<thisbox->count;z++)
2298 } 2204 }
2299 } 2205 }
2300 } 2206 }
2301 } 2207 }
2302 2208
2209 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y)
2210 {
2211 if(type == BOXHORZ)
2212 {
2213 int newx = x - SPLITBAR_WIDTH, newy = y;
2214 float ratio = (float)percent/(float)100.0;
2215 HWND handle = (HWND)dw_window_get_data(hwnd, "_dw_topleft");
2216 Box *tmp = (Box *)GetWindowLong(handle, GWL_USERDATA);
2217
2218 newx = (int)((float)newx * ratio);
2219
2220 SetWindowPos(handle, (HWND)NULL, 0, 0, newx, y, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE);
2221 _do_resize(tmp, newx, y);
2222
2223 handle = (HWND)dw_window_get_data(hwnd, "_dw_bottomright");
2224 tmp = (Box *)GetWindowLong(handle, GWL_USERDATA);
2225
2226 newx = x - newx - SPLITBAR_WIDTH;
2227
2228 SetWindowPos(handle, (HWND)NULL, x - newx, 0, newx, y, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE);
2229 _do_resize(tmp, newx, y);
2230
2231 dw_window_set_data(hwnd, "_dw_start", (void *)newx);
2232 }
2233 else
2234 {
2235 int newx = x, newy = y - SPLITBAR_WIDTH;
2236 float ratio = (float)(100.0-percent)/(float)100.0;
2237 HWND handle = (HWND)dw_window_get_data(hwnd, "_dw_bottomright");
2238 Box *tmp = (Box *)GetWindowLong(handle, GWL_USERDATA);
2239
2240 newy = (int)((float)newy * ratio);
2241
2242 SetWindowPos(handle, (HWND)NULL, 0, y - newy, x, newy, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE);
2243 _do_resize(tmp, x, newy);
2244
2245 handle = (HWND)dw_window_get_data(hwnd, "_dw_topleft");
2246 tmp = (Box *)GetWindowLong(handle, GWL_USERDATA);
2247
2248 newy = y - newy - SPLITBAR_WIDTH;
2249
2250 SetWindowPos(handle, (HWND)NULL, 0, 0, x, newy, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE);
2251 _do_resize(tmp, x, newy);
2252
2253 dw_window_set_data(hwnd, "_dw_start", (void *)newy);
2254 }
2255 }
2256
2303 /* This handles any activity on the splitbars (sizers) */ 2257 /* This handles any activity on the splitbars (sizers) */
2304 BOOL CALLBACK _splitwndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2) 2258 BOOL CALLBACK _splitwndproc(HWND hwnd, UINT msg, WPARAM mp1, LPARAM mp2)
2305 { 2259 {
2306 float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent"); 2260 float *percent = (float *)dw_window_get_data(hwnd, "_dw_percent");
2307 int type = (int)dw_window_get_data(hwnd, "_dw_type"); 2261 int type = (int)dw_window_get_data(hwnd, "_dw_type");
2262 int start = (int)dw_window_get_data(hwnd, "_dw_start");
2308 2263
2309 switch (msg) 2264 switch (msg)
2310 { 2265 {
2311 case WM_ACTIVATE: 2266 case WM_ACTIVATE:
2312 case WM_SETFOCUS: 2267 case WM_SETFOCUS:
2315 case WM_SIZE: 2270 case WM_SIZE:
2316 { 2271 {
2317 int x = LOWORD(mp2), y = HIWORD(mp2); 2272 int x = LOWORD(mp2), y = HIWORD(mp2);
2318 2273
2319 if(x > 0 && y > 0 && percent) 2274 if(x > 0 && y > 0 && percent)
2320 { 2275 _handle_splitbar_resize(hwnd, *percent, type, x, y);
2321 if(type == BOXHORZ) 2276 }
2322 {
2323 int newx = x - SPLITBAR_WIDTH, newy = y;
2324 float ratio = (float)*percent/(float)100.0;
2325 HWND handle = (HWND)dw_window_get_data(hwnd, "_dw_topleft");
2326 Box *tmp = (Box *)GetWindowLong(handle, GWL_USERDATA);
2327
2328 newx = (int)((float)newx * ratio);
2329
2330 SetWindowPos(handle, (HWND)NULL, 0, 0, newx, y, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE);
2331 _do_resize(tmp, newx, y);
2332
2333 handle = (HWND)dw_window_get_data(hwnd, "_dw_bottomright");
2334 tmp = (Box *)GetWindowLong(handle, GWL_USERDATA);
2335
2336 newx = x - newx - SPLITBAR_WIDTH;
2337
2338 SetWindowPos(handle, (HWND)NULL, x - newx, 0, newx, y, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE);
2339 _do_resize(tmp, newx, y);
2340
2341 dw_window_set_data(hwnd, "_dw_start", (void *)newx);
2342 }
2343 else
2344 {
2345 int newx = x, newy = y - SPLITBAR_WIDTH;
2346 float ratio = (float)(100.0-*percent)/(float)100.0;
2347 HWND handle = (HWND)dw_window_get_data(hwnd, "_dw_bottomright");
2348 Box *tmp = (Box *)GetWindowLong(handle, GWL_USERDATA);
2349
2350 newy = (int)((float)newy * ratio);
2351
2352 SetWindowPos(handle, (HWND)NULL, 0, y - newy, x, newy, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE);
2353 _do_resize(tmp, x, newy);
2354
2355 handle = (HWND)dw_window_get_data(hwnd, "_dw_topleft");
2356 tmp = (Box *)GetWindowLong(handle, GWL_USERDATA);
2357
2358 newy = y - newy - SPLITBAR_WIDTH;
2359
2360 SetWindowPos(handle, (HWND)NULL, 0, 0, x, newy, SWP_NOZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE);
2361 _do_resize(tmp, x, newy);
2362
2363 dw_window_set_data(hwnd, "_dw_start", (void *)newy);
2364 }
2365 }
2366 }
2367 break; 2277 break;
2368 case WM_PAINT: 2278 case WM_LBUTTONDOWN:
2369 { 2279 {
2370 HDC hdcPaint; 2280 SetCapture(hwnd);
2371 PAINTSTRUCT ps; 2281 break;
2372 POINT ptlStart[SPLITBAR_WIDTH]; 2282 }
2373 POINT ptlEnd[SPLITBAR_WIDTH]; 2283 case WM_LBUTTONUP:
2374 RECT rcPaint; 2284 {
2375 USHORT i; 2285 if(GetCapture() == hwnd)
2376 int start = (int)dw_window_get_data(hwnd, "_dw_start"); 2286 ReleaseCapture();
2377 2287 }
2378 hdcPaint = BeginPaint(hwnd, &ps); 2288 break;
2379 GetWindowRect(hwnd, &rcPaint);
2380
2381 if(type == BOXHORZ)
2382 {
2383 for(i = 0; i < SPLITBAR_WIDTH; i++)
2384 {
2385 ptlStart[i].x = i + start - 1;
2386 ptlStart[i].y = 0;
2387
2388 ptlEnd[i].x = i + start - 1;
2389 ptlEnd[i].y = rcPaint.bottom - rcPaint.top;
2390 }
2391 }
2392 else
2393 {
2394 for(i = 0; i < SPLITBAR_WIDTH; i++)
2395 {
2396 ptlStart[i].x = 0;
2397 ptlStart[i].y = i + start;
2398
2399 ptlEnd[i].x = rcPaint.right - rcPaint.left;
2400 ptlEnd[i].y = i + start;
2401 }
2402 }
2403
2404 for(i = 0; i < SPLITBAR_WIDTH; i++)
2405 {
2406 HPEN hPen;
2407 HPEN hOldPen;
2408
2409 hPen = CreatePen(PS_SOLID, 1, RGB (_red[lColor[i]], _green[lColor[i]], _blue[lColor[i]]));
2410 hOldPen = (HPEN)SelectObject(hdcPaint, hPen);
2411 MoveToEx(hdcPaint, ptlStart[i].x, ptlStart[i].y, NULL);
2412 LineTo(hdcPaint, ptlEnd[i].x, ptlEnd[i].y);
2413 SelectObject(hdcPaint, hOldPen);
2414 DeleteObject(hPen);
2415 }
2416 EndPaint(hwnd, &ps);
2417 }
2418 return FALSE;
2419 case WM_MOUSEMOVE: 2289 case WM_MOUSEMOVE:
2420 { 2290 {
2421 if(type == BOXHORZ) 2291 if(type == BOXHORZ)
2422 SetCursor(LoadCursor(NULL, IDC_SIZEWE)); 2292 SetCursor(LoadCursor(NULL, IDC_SIZEWE));
2423 else 2293 else
2424 SetCursor(LoadCursor(NULL, IDC_SIZENS)); 2294 SetCursor(LoadCursor(NULL, IDC_SIZENS));
2425 } 2295
2426 return FALSE; 2296 if(GetCapture() == hwnd)
2427 #if 0 2297 {
2428 case WM_BUTTON1DOWN: 2298 POINT point;
2429 { 2299 RECT rect;
2430 ULONG rc; 2300
2431 RECTL rclFrame; 2301 GetCursorPos(&point);
2432 RECTL rclBounds; 2302 GetWindowRect(hwnd, &rect);
2433 RECTL rclStart; 2303
2434 USHORT startSize, orig, actual; 2304 if(PtInRect(&rect, point))
2435
2436 GetWindowRect(hwnd, &rclFrame);
2437 GetWindowRect(hwnd, &rclStart);
2438
2439 GetWindowRect(hwndFrame, &rclBounds);
2440
2441 WinMapWindowPoints(hwndFrame, HWND_DESKTOP,
2442 (PPOINTL)&rclBounds, 2);
2443 WinMapWindowPoints(hwnd, HWND_DESKTOP,
2444 (PPOINTL)&rclStart, 2);
2445
2446 if(thisbox->type == BOXHORZ)
2447 {
2448 orig = thisbox->items[0].origwidth;
2449 actual = thisbox->items[0].width;
2450
2451 startSize = (rclStart.xLeft - rclBounds.xLeft)
2452 * (((float)orig)/((float)actual));
2453 }
2454 else
2455 {
2456 orig = thisbox->items[0].origheight;
2457 actual = thisbox->items[0].height;
2458
2459 startSize = (rclStart.yBottom - rclBounds.yBottom)
2460 * (((float)actual)/((float)orig));
2461 }
2462
2463 rc = _TrackRectangle(hwnd, &rclFrame, &rclBounds);
2464
2465 if(rc == TRUE)
2466 {
2467 USHORT usNewRB;
2468 USHORT usSize;
2469 USHORT percent;
2470 int z;
2471
2472 if(thisbox->type == BOXHORZ)
2473 { 2305 {
2474 usNewRB = rclFrame.xLeft 2306 int width = (rect.right - rect.left);
2475 - rclBounds.xLeft; 2307 int height = (rect.bottom - rect.top);
2476 usSize = rclBounds.xRight 2308
2477 - rclBounds.xLeft; 2309 if(type == BOXHORZ)
2478 }
2479 else
2480 {
2481 usNewRB = rclFrame.yBottom
2482 - rclBounds.yBottom;
2483 usSize = rclBounds.yTop
2484 - rclBounds.yBottom;
2485 }
2486
2487 percent = (usNewRB*100)/startSize;
2488
2489 for(z=0;z<thisbox->count;z++)
2490 {
2491 if(thisbox->items[z].type == TYPEBOX)
2492 { 2310 {
2493 Box *tmp = (Box *)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA); 2311 start = point.x - rect.left;
2494 _changebox(tmp, percent, thisbox->type); 2312 *percent = ((float)start / (float)(rect.right - rect.left - SPLITBAR_WIDTH)) * 100.0;
2495 } 2313 }
2496 else 2314 else
2497 { 2315 {
2498 if(thisbox->items[z].hwnd == hwnd) 2316 start = point.y - rect.top;
2499 percent = (startSize*100)/usNewRB; 2317 *percent = ((float)start / (float)(rect.bottom - rect.top - SPLITBAR_WIDTH)) * 100.0;
2500
2501 if(thisbox->type == BOXHORZ)
2502 {
2503 if(thisbox->items[z].hsize == SIZEEXPAND)
2504 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0)));
2505 }
2506 else
2507 {
2508 if(thisbox->items[z].vsize == SIZEEXPAND)
2509 thisbox->items[z].height = (int)(((float)thisbox->items[z].origheight) * (((float)percent)/((float)100.0)));
2510 }
2511 } 2318 }
2319 _handle_splitbar_resize(hwnd, *percent, type, width, height);
2512 } 2320 }
2513 2321 }
2514 _ResetWindow(GetWindow(hwnd, GW_OWNER)); 2322 break;
2515 } 2323 }
2516 }
2517 return MRFROMSHORT(FALSE);
2518 #endif
2519 } 2324 }
2520 return DefWindowProc(hwnd, msg, mp1, mp2); 2325 return DefWindowProc(hwnd, msg, mp1, mp2);
2521 } 2326 }
2522 2327
2523 /* This handles drawing the status text areas */ 2328 /* This handles drawing the status text areas */
2627 */ 2432 */
2628 pOldProc = bubble->pOldProc; 2433 pOldProc = bubble->pOldProc;
2629 2434
2630 switch(msg) 2435 switch(msg)
2631 { 2436 {
2632 #ifndef NO_SIGNALS
2633 case WM_SETFOCUS: 2437 case WM_SETFOCUS:
2634 _wndproc(hwnd, msg, mp1, mp2); 2438 _wndproc(hwnd, msg, mp1, mp2);
2635 break; 2439 break;
2636 case WM_LBUTTONUP: 2440 case WM_LBUTTONUP:
2637 { 2441 {
2660 if(tmp) 2464 if(tmp)
2661 tmp= tmp->next; 2465 tmp= tmp->next;
2662 } 2466 }
2663 } 2467 }
2664 break; 2468 break;
2665 #endif
2666 case WM_CHAR: 2469 case WM_CHAR:
2667 { 2470 {
2668 #ifndef NO_SIGNALS
2669 /* A button press should also occur for an ENTER or SPACE press 2471 /* A button press should also occur for an ENTER or SPACE press
2670 * while the button has the active input focus. 2472 * while the button has the active input focus.
2671 */ 2473 */
2672 if(LOWORD(mp1) == '\r' || LOWORD(mp1) == ' ') 2474 if(LOWORD(mp1) == '\r' || LOWORD(mp1) == ' ')
2673 { 2475 {
2689 } 2491 }
2690 if(tmp) 2492 if(tmp)
2691 tmp= tmp->next; 2493 tmp= tmp->next;
2692 } 2494 }
2693 } 2495 }
2694 #endif
2695 if(LOWORD(mp1) == '\t') 2496 if(LOWORD(mp1) == '\t')
2696 { 2497 {
2697 if(GetAsyncKeyState(VK_SHIFT) & 0x8000) 2498 if(GetAsyncKeyState(VK_SHIFT) & 0x8000)
2698 _shift_focus_back(hwnd); 2499 _shift_focus_back(hwnd);
2699 else 2500 else
2902 memset(&wc, 0, sizeof(WNDCLASS)); 2703 memset(&wc, 0, sizeof(WNDCLASS));
2903 wc.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; 2704 wc.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
2904 wc.lpfnWndProc = (WNDPROC)_splitwndproc; 2705 wc.lpfnWndProc = (WNDPROC)_splitwndproc;
2905 wc.cbClsExtra = 0; 2706 wc.cbClsExtra = 0;
2906 wc.cbWndExtra = 0; 2707 wc.cbWndExtra = 0;
2907 wc.hbrBackground = NULL; 2708 wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE);
2908 wc.lpszMenuName = NULL; 2709 wc.lpszMenuName = NULL;
2909 wc.lpszClassName = SplitbarClassName; 2710 wc.lpszClassName = SplitbarClassName;
2910 2711
2911 RegisterClass(&wc); 2712 RegisterClass(&wc);
2912 2713
7261 return ud->data; 7062 return ud->data;
7262 } 7063 }
7263 return NULL; 7064 return NULL;
7264 } 7065 }
7265 7066
7266 #ifndef NO_SIGNALS
7267 /* 7067 /*
7268 * Add a callback to a window event. 7068 * Add a callback to a window event.
7269 * Parameters: 7069 * Parameters:
7270 * window: Window handle of signal to be called back. 7070 * window: Window handle of signal to be called back.
7271 * signame: A string pointer identifying which signal to be hooked. 7071 * signame: A string pointer identifying which signal to be hooked.
7390 prev = tmp; 7190 prev = tmp;
7391 tmp = tmp->next; 7191 tmp = tmp->next;
7392 } 7192 }
7393 } 7193 }
7394 } 7194 }
7395 #endif
7396 7195
7397 #ifdef TEST 7196 #ifdef TEST
7398 HWND mainwindow, 7197 HWND mainwindow,
7399 listbox, 7198 listbox,
7400 okbutton, 7199 okbutton,