Mercurial > dwindows
comparison win/dw.c @ 283:54aafc134652
BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups,
and fixed SHIFT-TAB through splitbars. Simplified the TAB and SHIFT-TAB
handling code on OS/2.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 17 Mar 2003 15:33:51 +0000 |
parents | 2f038ef90a36 |
children | 3431e445d831 |
comparison
equal
deleted
inserted
replaced
282:916045924784 | 283:54aafc134652 |
---|---|
1 /* | |
1 /* | 2 /* |
2 * Dynamic Windows: | 3 * Dynamic Windows: |
3 * A GTK like implementation of the Win32 GUI | 4 * A GTK like implementation of the Win32 GUI |
4 * | 5 * |
5 * (C) 2000-2002 Brian Smith <dbsoft@technologist.com> | 6 * (C) 2000-2003 Brian Smith <dbsoft@technologist.com> |
6 * | 7 * |
7 */ | 8 */ |
8 #define _WIN32_IE 0x0500 | 9 #define _WIN32_IE 0x0500 |
9 #define WINVER 0x400 | 10 #define WINVER 0x400 |
10 #include <windows.h> | 11 #include <windows.h> |
545 | 546 |
546 GetClassName(box->items[z].hwnd, tmpbuf, 99); | 547 GetClassName(box->items[z].hwnd, tmpbuf, 99); |
547 | 548 |
548 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) | 549 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
549 { | 550 { |
550 /* Then try the bottom or right box */ | 551 /* Try the top or left box */ |
551 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); | 552 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); |
552 | 553 |
553 if(mybox) | 554 if(mybox) |
554 { | 555 { |
555 Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); | 556 Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); |
556 | 557 |
557 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) | 558 if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) |
558 return 1; | 559 return 1; |
559 } | 560 } |
560 | 561 |
561 /* Try the top or left box */ | 562 /* Then try the bottom or right box */ |
562 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); | 563 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); |
563 | 564 |
564 if(mybox) | 565 if(mybox) |
565 { | 566 { |
566 Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); | 567 Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); |
567 | 568 |
670 { | 671 { |
671 char tmpbuf[100] = ""; | 672 char tmpbuf[100] = ""; |
672 | 673 |
673 GetClassName(box->items[z].hwnd, tmpbuf, 99); | 674 GetClassName(box->items[z].hwnd, tmpbuf, 99); |
674 | 675 |
675 if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */ | 676 if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) |
677 { | |
678 /* Then try the bottom or right box */ | |
679 HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); | |
680 | |
681 if(mybox) | |
682 { | |
683 Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); | |
684 | |
685 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) | |
686 return 1; | |
687 } | |
688 | |
689 /* Try the top or left box */ | |
690 mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); | |
691 | |
692 if(mybox) | |
693 { | |
694 Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); | |
695 | |
696 if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) | |
697 return 1; | |
698 } | |
699 } | |
700 else if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */ | |
676 { | 701 { |
677 NotebookPage **array = (NotebookPage **)dw_window_get_data(box->items[z].hwnd, "_dw_array"); | 702 NotebookPage **array = (NotebookPage **)dw_window_get_data(box->items[z].hwnd, "_dw_array"); |
678 int pageid = TabCtrl_GetCurSel(box->items[z].hwnd); | 703 int pageid = TabCtrl_GetCurSel(box->items[z].hwnd); |
679 | 704 |
680 if(pageid > -1 && array && array[pageid]) | 705 if(pageid > -1 && array && array[pageid]) |
840 | 865 |
841 /* Just in case */ | 866 /* Just in case */ |
842 tmp->xratio = thisbox->xratio; | 867 tmp->xratio = thisbox->xratio; |
843 tmp->yratio = thisbox->yratio; | 868 tmp->yratio = thisbox->yratio; |
844 | 869 |
845 if(thisbox->type == BOXVERT) | 870 if(thisbox->type == DW_VERT) |
846 { | 871 { |
847 if((thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) | 872 if((thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) |
848 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))); | 873 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))); |
849 } | 874 } |
850 else | 875 else |
851 { | 876 { |
852 if((thisbox->items[z].width-tmp->upx)!=0) | 877 if((thisbox->items[z].width-tmp->upx)!=0) |
853 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx)); | 878 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx)); |
854 } | 879 } |
855 if(thisbox->type == BOXHORZ) | 880 if(thisbox->type == DW_HORZ) |
856 { | 881 { |
857 if((thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) | 882 if((thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) |
858 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))); | 883 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))); |
859 } | 884 } |
860 else | 885 else |
881 } | 906 } |
882 } | 907 } |
883 | 908 |
884 if(pass > 1 && *depth > 0) | 909 if(pass > 1 && *depth > 0) |
885 { | 910 { |
886 if(thisbox->type == BOXVERT) | 911 if(thisbox->type == DW_VERT) |
887 { | 912 { |
888 if((thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0) | 913 if((thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0) |
889 thisbox->items[z].xratio = 1.0; | 914 thisbox->items[z].xratio = 1.0; |
890 else | 915 else |
891 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))))/((float)(thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2)))); | 916 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))))/((float)(thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2)))); |
896 thisbox->items[z].xratio = 1.0; | 921 thisbox->items[z].xratio = 1.0; |
897 else | 922 else |
898 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-thisbox->upx))/((float)(thisbox->minwidth-thisbox->upx)); | 923 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-thisbox->upx))/((float)(thisbox->minwidth-thisbox->upx)); |
899 } | 924 } |
900 | 925 |
901 if(thisbox->type == BOXHORZ) | 926 if(thisbox->type == DW_HORZ) |
902 { | 927 { |
903 if((thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0) | 928 if((thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0) |
904 thisbox->items[z].yratio = 1.0; | 929 thisbox->items[z].yratio = 1.0; |
905 else | 930 else |
906 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))))/((float)(thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2)))); | 931 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))))/((float)(thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2)))); |
928 { | 953 { |
929 thisbox->items[z].xratio = thisbox->xratio; | 954 thisbox->items[z].xratio = thisbox->xratio; |
930 thisbox->items[z].yratio = thisbox->yratio; | 955 thisbox->items[z].yratio = thisbox->yratio; |
931 } | 956 } |
932 | 957 |
933 if(thisbox->type == BOXVERT) | 958 if(thisbox->type == DW_VERT) |
934 { | 959 { |
935 if((thisbox->items[z].width + (thisbox->items[z].pad*2)) > uxmax) | 960 if((thisbox->items[z].width + (thisbox->items[z].pad*2)) > uxmax) |
936 uxmax = (thisbox->items[z].width + (thisbox->items[z].pad*2)); | 961 uxmax = (thisbox->items[z].width + (thisbox->items[z].pad*2)); |
937 if(thisbox->items[z].hsize != SIZEEXPAND) | 962 if(thisbox->items[z].hsize != SIZEEXPAND) |
938 { | 963 { |
959 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width; | 984 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width; |
960 else | 985 else |
961 (*usedpadx) += thisbox->items[z].pad*2; | 986 (*usedpadx) += thisbox->items[z].pad*2; |
962 } | 987 } |
963 } | 988 } |
964 if(thisbox->type == BOXHORZ) | 989 if(thisbox->type == DW_HORZ) |
965 { | 990 { |
966 if((thisbox->items[z].height + (thisbox->items[z].pad*2)) > uymax) | 991 if((thisbox->items[z].height + (thisbox->items[z].pad*2)) > uymax) |
967 uymax = (thisbox->items[z].height + (thisbox->items[z].pad*2)); | 992 uymax = (thisbox->items[z].height + (thisbox->items[z].pad*2)); |
968 if(thisbox->items[z].vsize != SIZEEXPAND) | 993 if(thisbox->items[z].vsize != SIZEEXPAND) |
969 { | 994 { |
1006 if(pass > 1) | 1031 if(pass > 1) |
1007 { | 1032 { |
1008 /* Any SIZEEXPAND items should be set to uxmax/uymax */ | 1033 /* Any SIZEEXPAND items should be set to uxmax/uymax */ |
1009 for(z=0;z<thisbox->count;z++) | 1034 for(z=0;z<thisbox->count;z++) |
1010 { | 1035 { |
1011 if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == BOXVERT) | 1036 if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == DW_VERT) |
1012 thisbox->items[z].width = uxmax-(thisbox->items[z].pad*2); | 1037 thisbox->items[z].width = uxmax-(thisbox->items[z].pad*2); |
1013 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == BOXHORZ) | 1038 if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == DW_HORZ) |
1014 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2); | 1039 thisbox->items[z].height = uymax-(thisbox->items[z].pad*2); |
1015 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */ | 1040 /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */ |
1016 if(thisbox->items[z].type == TYPEBOX) | 1041 if(thisbox->items[z].type == TYPEBOX) |
1017 { | 1042 { |
1018 Box *tmp = (Box *)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA); | 1043 Box *tmp = (Box *)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA); |
1019 | 1044 |
1020 if(tmp) | 1045 if(tmp) |
1021 { | 1046 { |
1022 if(*depth > 0) | 1047 if(*depth > 0) |
1023 { | 1048 { |
1024 if(thisbox->type == BOXVERT) | 1049 if(thisbox->type == DW_VERT) |
1025 { | 1050 { |
1026 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); | 1051 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); |
1027 tmp->width = thisbox->items[z].width; | 1052 tmp->width = thisbox->items[z].width; |
1028 } | 1053 } |
1029 if(thisbox->type == BOXHORZ) | 1054 if(thisbox->type == DW_HORZ) |
1030 { | 1055 { |
1031 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); | 1056 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); |
1032 tmp->height = thisbox->items[z].height; | 1057 tmp->height = thisbox->items[z].height; |
1033 } | 1058 } |
1034 } | 1059 } |
1164 MoveWindow(array[pageid]->hwnd, rect.left, rect.top, | 1189 MoveWindow(array[pageid]->hwnd, rect.left, rect.top, |
1165 rect.right - rect.left, rect.bottom-rect.top, FALSE); | 1190 rect.right - rect.left, rect.bottom-rect.top, FALSE); |
1166 } | 1191 } |
1167 } | 1192 } |
1168 | 1193 |
1169 if(thisbox->type == BOXHORZ) | 1194 if(thisbox->type == DW_HORZ) |
1170 currentx += width + vectorx + (pad * 2); | 1195 currentx += width + vectorx + (pad * 2); |
1171 if(thisbox->type == BOXVERT) | 1196 if(thisbox->type == DW_VERT) |
1172 currenty += height + vectory + (pad * 2); | 1197 currenty += height + vectory + (pad * 2); |
1173 } | 1198 } |
1174 } | 1199 } |
1175 } | 1200 } |
1176 return 0; | 1201 return 0; |
2403 Box *tmp = (Box*)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA); | 2428 Box *tmp = (Box*)GetWindowLong(thisbox->items[z].hwnd, GWL_USERDATA); |
2404 _changebox(tmp, percent, type); | 2429 _changebox(tmp, percent, type); |
2405 } | 2430 } |
2406 else | 2431 else |
2407 { | 2432 { |
2408 if(type == BOXHORZ) | 2433 if(type == DW_HORZ) |
2409 { | 2434 { |
2410 if(thisbox->items[z].hsize == SIZEEXPAND) | 2435 if(thisbox->items[z].hsize == SIZEEXPAND) |
2411 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0))); | 2436 thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0))); |
2412 } | 2437 } |
2413 else | 2438 else |
2419 } | 2444 } |
2420 } | 2445 } |
2421 | 2446 |
2422 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) | 2447 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) |
2423 { | 2448 { |
2424 if(type == BOXHORZ) | 2449 if(type == DW_HORZ) |
2425 { | 2450 { |
2426 int newx = x; | 2451 int newx = x; |
2427 float ratio = (float)percent/(float)100.0; | 2452 float ratio = (float)percent/(float)100.0; |
2428 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); | 2453 HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); |
2429 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); | 2454 HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); |
2505 HBRUSH oldBrush = SelectObject(hdcPaint, GetSysColorBrush(COLOR_3DFACE)); | 2530 HBRUSH oldBrush = SelectObject(hdcPaint, GetSysColorBrush(COLOR_3DFACE)); |
2506 HPEN oldPen = SelectObject(hdcPaint, CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DFACE))); | 2531 HPEN oldPen = SelectObject(hdcPaint, CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DFACE))); |
2507 | 2532 |
2508 dw_window_get_pos_size(hwnd, NULL, NULL, &cx, &cy); | 2533 dw_window_get_pos_size(hwnd, NULL, NULL, &cx, &cy); |
2509 | 2534 |
2510 if(type == BOXHORZ) | 2535 if(type == DW_HORZ) |
2511 Rectangle(hdcPaint, cx - start - SPLITBAR_WIDTH, 0, cx - start, cy); | 2536 Rectangle(hdcPaint, cx - start - SPLITBAR_WIDTH, 0, cx - start, cy); |
2512 else | 2537 else |
2513 Rectangle(hdcPaint, 0, start, cx, start + SPLITBAR_WIDTH); | 2538 Rectangle(hdcPaint, 0, start, cx, start + SPLITBAR_WIDTH); |
2514 | 2539 |
2515 SelectObject(hdcPaint, oldBrush); | 2540 SelectObject(hdcPaint, oldBrush); |
2530 ReleaseCapture(); | 2555 ReleaseCapture(); |
2531 } | 2556 } |
2532 break; | 2557 break; |
2533 case WM_MOUSEMOVE: | 2558 case WM_MOUSEMOVE: |
2534 { | 2559 { |
2535 if(type == BOXHORZ) | 2560 if(type == DW_HORZ) |
2536 SetCursor(LoadCursor(NULL, IDC_SIZEWE)); | 2561 SetCursor(LoadCursor(NULL, IDC_SIZEWE)); |
2537 else | 2562 else |
2538 SetCursor(LoadCursor(NULL, IDC_SIZENS)); | 2563 SetCursor(LoadCursor(NULL, IDC_SIZENS)); |
2539 | 2564 |
2540 if(GetCapture() == hwnd && percent) | 2565 if(GetCapture() == hwnd && percent) |
2551 if(PtInRect(&rect, point)) | 2576 if(PtInRect(&rect, point)) |
2552 { | 2577 { |
2553 int width = (rect.right - rect.left); | 2578 int width = (rect.right - rect.left); |
2554 int height = (rect.bottom - rect.top); | 2579 int height = (rect.bottom - rect.top); |
2555 | 2580 |
2556 if(type == BOXHORZ) | 2581 if(type == DW_HORZ) |
2557 { | 2582 { |
2558 start = point.x - rect.left; | 2583 start = point.x - rect.left; |
2559 if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH) | 2584 if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH) |
2560 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0; | 2585 *percent = ((float)start / (float)(width - SPLITBAR_WIDTH)) * 100.0; |
2561 } | 2586 } |
3511 HWND hwndframe; | 3536 HWND hwndframe; |
3512 Box *newbox = calloc(sizeof(Box), 1); | 3537 Box *newbox = calloc(sizeof(Box), 1); |
3513 ULONG flStyleEx = 0; | 3538 ULONG flStyleEx = 0; |
3514 | 3539 |
3515 newbox->pad = 0; | 3540 newbox->pad = 0; |
3516 newbox->type = BOXVERT; | 3541 newbox->type = DW_VERT; |
3517 newbox->count = 0; | 3542 newbox->count = 0; |
3518 newbox->cinfo.fore = newbox->cinfo.back = -1; | 3543 newbox->cinfo.fore = newbox->cinfo.back = -1; |
3519 | 3544 |
3520 if(hwndOwner) | 3545 if(hwndOwner) |
3521 flStyleEx |= WS_EX_MDICHILD; | 3546 flStyleEx |= WS_EX_MDICHILD; |
3548 } | 3573 } |
3549 | 3574 |
3550 /* | 3575 /* |
3551 * Create a new Box to be packed. | 3576 * Create a new Box to be packed. |
3552 * Parameters: | 3577 * Parameters: |
3553 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). | 3578 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
3554 * pad: Number of pixels to pad around the box. | 3579 * pad: Number of pixels to pad around the box. |
3555 */ | 3580 */ |
3556 HWND API dw_box_new(int type, int pad) | 3581 HWND API dw_box_new(int type, int pad) |
3557 { | 3582 { |
3558 Box *newbox = calloc(sizeof(Box), 1); | 3583 Box *newbox = calloc(sizeof(Box), 1); |
3581 } | 3606 } |
3582 | 3607 |
3583 /* | 3608 /* |
3584 * Create a new Group Box to be packed. | 3609 * Create a new Group Box to be packed. |
3585 * Parameters: | 3610 * Parameters: |
3586 * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). | 3611 * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). |
3587 * pad: Number of pixels to pad around the box. | 3612 * pad: Number of pixels to pad around the box. |
3588 * title: Text to be displayined in the group outline. | 3613 * title: Text to be displayined in the group outline. |
3589 */ | 3614 */ |
3590 HWND API dw_groupbox_new(int type, int pad, char *title) | 3615 HWND API dw_groupbox_new(int type, int pad, char *title) |
3591 { | 3616 { |
4946 | 4971 |
4947 pageid = _findnotebookid(array, pageidx); | 4972 pageid = _findnotebookid(array, pageidx); |
4948 | 4973 |
4949 if(pageid > -1 && array[pageid]) | 4974 if(pageid > -1 && array[pageid]) |
4950 { | 4975 { |
4951 HWND tmpbox = dw_box_new(BOXVERT, 0); | 4976 HWND tmpbox = dw_box_new(DW_VERT, 0); |
4952 | 4977 |
4953 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); | 4978 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); |
4954 SubclassWindow(tmpbox, _wndproc); | 4979 SubclassWindow(tmpbox, _wndproc); |
4955 if(array[pageid]->hwnd) | 4980 if(array[pageid]->hwnd) |
4956 dw_window_destroy(array[pageid]->hwnd); | 4981 dw_window_destroy(array[pageid]->hwnd); |
7209 } | 7234 } |
7210 | 7235 |
7211 /* | 7236 /* |
7212 * Creates a splitbar window (widget) with given parameters. | 7237 * Creates a splitbar window (widget) with given parameters. |
7213 * Parameters: | 7238 * Parameters: |
7214 * type: Value can be BOXVERT or BOXHORZ. | 7239 * type: Value can be DW_VERT or DW_HORZ. |
7215 * topleft: Handle to the window to be top or left. | 7240 * topleft: Handle to the window to be top or left. |
7216 * bottomright: Handle to the window to be bottom or right. | 7241 * bottomright: Handle to the window to be bottom or right. |
7217 * Returns: | 7242 * Returns: |
7218 * A handle to a splitbar window or NULL on failure. | 7243 * A handle to a splitbar window or NULL on failure. |
7219 */ | 7244 */ |
7228 DWInstance, | 7253 DWInstance, |
7229 NULL); | 7254 NULL); |
7230 | 7255 |
7231 if(tmp) | 7256 if(tmp) |
7232 { | 7257 { |
7233 HWND tmpbox = dw_box_new(BOXVERT, 0); | 7258 HWND tmpbox = dw_box_new(DW_VERT, 0); |
7234 float *percent = (float *)malloc(sizeof(float)); | 7259 float *percent = (float *)malloc(sizeof(float)); |
7235 | 7260 |
7236 dw_box_pack_start(tmpbox, topleft, 1, 1, TRUE, TRUE, 0); | 7261 dw_box_pack_start(tmpbox, topleft, 1, 1, TRUE, TRUE, 0); |
7237 SetParent(tmpbox, tmp); | 7262 SetParent(tmpbox, tmp); |
7238 dw_window_set_data(tmp, "_dw_topleft", (void *)tmpbox); | 7263 dw_window_set_data(tmp, "_dw_topleft", (void *)tmpbox); |
7239 | 7264 |
7240 tmpbox = dw_box_new(BOXVERT, 0); | 7265 tmpbox = dw_box_new(DW_VERT, 0); |
7241 dw_box_pack_start(tmpbox, bottomright, 1, 1, TRUE, TRUE, 0); | 7266 dw_box_pack_start(tmpbox, bottomright, 1, 1, TRUE, TRUE, 0); |
7242 SetParent(tmpbox, tmp); | 7267 SetParent(tmpbox, tmp); |
7243 dw_window_set_data(tmp, "_dw_bottomright", (void *)tmpbox); | 7268 dw_window_set_data(tmp, "_dw_bottomright", (void *)tmpbox); |
7244 *percent = 50.0; | 7269 *percent = 50.0; |
7245 dw_window_set_data(tmp, "_dw_percent", (void *)percent); | 7270 dw_window_set_data(tmp, "_dw_percent", (void *)percent); |