Mercurial > dwindows
changeset 152:e78027768548
Added MLS_LIMITVSCROLL to the MLE style.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 30 Oct 2002 12:19:26 +0000 |
parents | 656de0c52c56 |
children | a371875d5486 |
files | os2/dw.c |
diffstat | 1 files changed, 2 insertions(+), 230 deletions(-) [+] |
line wrap: on
line diff
--- a/os2/dw.c Sat Oct 26 21:33:31 2002 +0000 +++ b/os2/dw.c Wed Oct 30 12:19:26 2002 +0000 @@ -49,16 +49,6 @@ #define min(a, b) (((a < b) ? a : b)) #endif -#ifdef DWDEBUG -FILE *f; - -void reopen(void) -{ - fclose(f); - f = fopen("dw.log", "a+"); -} -#endif - typedef struct _sighandler { struct _sighandler *next; @@ -895,15 +885,6 @@ tmp->xratio = thisbox->xratio; tmp->yratio = thisbox->yratio; -#ifdef DWDEBUG - if(pass > 1) - { - fprintf(f, "FARK! depth %d\r\nwidth = %d, height = %d, nux = %d, nuy = %d, upx = %d, upy = %d xratio = %f, yratio = %f\r\n\r\n", - *depth, thisbox->items[z].width, thisbox->items[z].height, nux, nuy, tmp->upx, tmp->upy, tmp->xratio, tmp->yratio); - reopen(); - } -#endif - if(thisbox->type == BOXVERT) { if((thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) @@ -931,15 +912,6 @@ (*depth)++; -#ifdef DWDEBUG - if(pass > 1) - { - fprintf(f, "Before Resize Box depth %d\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d xratio = %f, yratio = %f\r\n\r\n", - *depth, x, y, *usedx, *usedy, *usedpadx, *usedpady, tmp->xratio, tmp->yratio); - reopen(); - } -#endif - _resize_box(tmp, depth, x, y, &nux, &nuy, pass, &upx, &upy); (*depth)--; @@ -949,15 +921,6 @@ tmp->minwidth = thisbox->items[z].width = initialx - newx; tmp->minheight = thisbox->items[z].height = initialy - newy; - -#ifdef DWDEBUG - if(pass > 1) - { - fprintf(f, "After Resize Box depth %d\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d width = %d, height = %d\r\n\r\n", - *depth, x, y, *usedx, *usedy, *usedpadx, *usedpady, thisbox->items[z].width, thisbox->items[z].height); - reopen(); - } -#endif } } @@ -1003,12 +966,6 @@ tmp->parentyratio = thisbox->items[z].yratio; } } - -#ifdef DWDEBUG - fprintf(f, "RATIO- xratio = %f, yratio = %f, width = %d, height = %d, pad = %d, box xratio = %f, box yratio = %f, parent xratio = %f, parent yratio = %f, minwidth = %d, minheight = %d, width = %d, height = %d, upx = %d, upy = %d\r\n\r\n", - thisbox->items[z].xratio, thisbox->items[z].yratio, thisbox->items[z].width, thisbox->items[z].height, thisbox->items[z].pad, thisbox->xratio, thisbox->yratio, thisbox->parentxratio, thisbox->parentyratio, thisbox->minwidth, thisbox->minheight, thisbox->width, thisbox->height, thisbox->upx, thisbox->upy); - reopen(); -#endif } else { @@ -1088,12 +1045,6 @@ currentx += thisbox->pad; currenty += thisbox->pad; -#ifdef DWDEBUG - fprintf(f, "Done Calc depth %d\r\nusedx = %d, usedy = %d, usedpadx = %d, usedpady = %d, currentx = %d, currenty = %d, uxmax = %d, uymax = %d\r\n\r\n", - *depth, *usedx, *usedy, *usedpadx, *usedpady, currentx, currenty, uxmax, uymax); - reopen(); -#endif - /* The second pass is for expansion and actual placement. */ if(pass > 1) { @@ -1127,12 +1078,6 @@ (*depth)++; -#ifdef DWDEBUG - fprintf(f, "2- Resize Box depth %d\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d xratio = %f, yratio = %f,\r\nupx = %d, upy = %d, width = %d, height = %d, minwidth = %d, minheight = %d, box xratio = %f, box yratio = %f\r\n\r\n", - *depth, x, y, *usedx, *usedy, *usedpadx, *usedpady, tmp->xratio, tmp->yratio, tmp->upx, tmp->upy, thisbox->items[z].width, thisbox->items[z].height, tmp->minwidth, tmp->minheight, thisbox->xratio, thisbox->yratio); - reopen(); -#endif - _resize_box(tmp, depth, x, y, &nux, &nuy, 3, &nupx, &nupy); (*depth)--; @@ -1205,12 +1150,6 @@ } -#ifdef DWDEBUG - fprintf(f, "Window Pos depth %d\r\ncurrentx = %d, currenty = %d, pad = %d, width = %d, height = %d, vectorx = %d, vectory = %d, Box type = %s\r\n\r\n", - *depth, currentx, currenty, pad, width, height, vectorx, vectory,thisbox->type == BOXHORZ ? "Horizontal" : "Vertical"); - reopen(); -#endif - if(thisbox->type == BOXHORZ) currentx += width + vectorx + (pad * 2); if(thisbox->type == BOXVERT) @@ -1237,20 +1176,9 @@ thisbox->xratio = ((float)(x-usedpadx))/((float)(usedx-usedpadx)); thisbox->yratio = ((float)(y-usedpady))/((float)(usedy-usedpady)); -#ifdef DWDEBUG - fprintf(f, "WM_SIZE Resize Box Pass 1\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d xratio = %f, yratio = %f\r\n\r\n", - x, y, usedx, usedy, usedpadx, usedpady, thisbox->xratio, thisbox->yratio); - reopen(); -#endif - usedx = usedy = usedpadx = usedpady = depth = 0; _resize_box(thisbox, &depth, x, y, &usedx, &usedy, 2, &usedpadx, &usedpady); -#ifdef DWDEBUG - fprintf(f, "WM_SIZE Resize Box Pass 2\r\nx = %d, y = %d, usedx = %d, usedy = %d, usedpadx = %d, usedpady = %d\r\n", - x, y, usedx, usedy, usedpadx, usedpady); - reopen(); -#endif } } } @@ -2788,9 +2716,6 @@ /* Get the OS/2 version. */ DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG)); -#ifdef DWDEBUG - f = fopen("dw.log", "w"); -#endif return rc; } @@ -2806,10 +2731,6 @@ while (WinGetMsg(dwhab, &qmsg, 0, 0, 0)) WinDispatchMsg(dwhab, &qmsg); -#ifdef DWDEBUG - fclose(f); -#endif - WinDestroyMsgQueue(dwhmq); WinTerminate(dwhab); } @@ -3764,7 +3685,8 @@ "", WS_VISIBLE | MLS_BORDER | MLS_IGNORETAB | - MLS_READONLY | MLS_VSCROLL, + MLS_READONLY | MLS_VSCROLL | + MLS_LIMITVSCROLL, 0,0,2000,1000, NULLHANDLE, HWND_TOP, @@ -7309,153 +7231,3 @@ } } -#ifdef TEST -HWND mainwindow, - listbox, - okbutton, - cancelbutton, - lbbox, - stext, - buttonbox, - testwindow, - testbox, - testok, - testcancel, - testbox2, - testok2, - testcancel2, - notebook; -int count = 2; - -int test_callback(HWND window, void *data) -{ - dw_window_destroy((HWND)data); - /* Return -1 to allow the default handlers to return. */ - count--; - if(!count) - exit(0); - return -1; -} - -/* - * Let's demonstrate the functionality of this library. :) - */ -int main(int argc, char *argv[]) -{ - ULONG flStyle = DW_FCF_SYSMENU | DW_FCF_TITLEBAR | - DW_FCF_SHELLPOSITION | DW_FCF_TASKLIST | DW_FCF_DLGBORDER; - int pageid; - - dw_init(TRUE, argc, argv); - - /* Try a little server dialog. :) */ - mainwindow = dw_window_new(HWND_DESKTOP, "Server", flStyle | DW_FCF_SIZEBORDER | DW_FCF_MINMAX); - - lbbox = dw_box_new(BOXVERT, 10); - - dw_box_pack_start(mainwindow, lbbox, 0, 0, TRUE, TRUE, 0); - - stext = dw_text_new("Choose a server:", 0); - - dw_window_set_style(stext, DW_DT_VCENTER, DW_DT_VCENTER); - - dw_box_pack_start(lbbox, stext, 130, 15, FALSE, FALSE, 10); - - listbox = dw_listbox_new(100L, FALSE); - - dw_box_pack_start(lbbox, listbox, 130, 200, TRUE, TRUE, 10); - - buttonbox = dw_box_new(BOXHORZ, 0); - - dw_box_pack_start(lbbox, buttonbox, 0, 0, TRUE, TRUE, 0); - - okbutton = dw_button_new("Ok", 1001L); - - dw_box_pack_start(buttonbox, okbutton, 50, 30, TRUE, TRUE, 5); - - cancelbutton = dw_button_new("Cancel", 1002L); - - dw_box_pack_start(buttonbox, cancelbutton, 50, 30, TRUE, TRUE, 5); - - /* Set some nice fonts and colors */ - dw_window_set_color(lbbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); - dw_window_set_color(buttonbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); - dw_window_set_font(stext, "9.WarpSans"); - dw_window_set_color(stext, DW_CLR_BLACK, DW_CLR_PALEGRAY); - dw_window_set_font(listbox, "9.WarpSans"); - dw_window_set_font(okbutton, "9.WarpSans"); - dw_window_set_font(cancelbutton, "9.WarpSans"); - - dw_window_show(mainwindow); - - dw_window_set_usize(mainwindow, 170, 340); - - /* Another small example */ - flStyle |= FCF_MINMAX | FCF_SIZEBORDER; - - testwindow = dw_window_new(HWND_DESKTOP, "Wow a test dialog! :) yay!", flStyle); - - testbox = dw_box_new(BOXVERT, 0); - - dw_box_pack_start(testwindow, testbox, 0, 0, TRUE, TRUE, 0); - - notebook = dw_notebook_new(1010L, TRUE); - - dw_box_pack_start(testbox, notebook, 100, 100, TRUE, TRUE, 0); - - testbox = dw_box_new(BOXVERT, 10); - - pageid = dw_notebook_page_new(notebook, 0L, FALSE); - - dw_notebook_page_set_text(notebook, pageid, "Test page"); - dw_notebook_page_set_status_text(notebook, pageid, "Test page"); - - dw_notebook_pack(notebook, pageid, testbox); - - testok = dw_button_new("Ok", 1003L); - - dw_box_pack_start(testbox, testok, 60, 40, TRUE, TRUE, 10); - - testcancel = dw_button_new("Cancel", 1004L); - - dw_box_pack_start(testbox, testcancel, 60, 40, TRUE, TRUE, 10); - - testbox2 = dw_box_new(BOXHORZ, 0); - - dw_box_pack_start(testbox, testbox2, 0, 0, TRUE, TRUE, 0); - - testok2 = dw_button_new("Ok", 1003L); - - dw_box_pack_start(testbox2, testok2, 60, 40, TRUE, TRUE, 10); - - dw_box_pack_splitbar_start(testbox2); - - testcancel2 = dw_button_new("Cancel", 1004L); - - dw_box_pack_start(testbox2, testcancel2, 60, 40, TRUE, TRUE, 10); - - /* Set some nice fonts and colors */ - dw_window_set_color(testbox, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); - dw_window_set_color(testbox2, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); - dw_window_set_font(testok, "9.WarpSans"); - dw_window_set_font(testcancel, "9.WarpSans"); - dw_window_set_font(testok2, "9.WarpSans"); - dw_window_set_font(testcancel2, "9.WarpSans"); - - dw_window_show(testwindow); - - /* Setup the function callbacks */ - dw_signal_connect(okbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); - dw_signal_connect(cancelbutton, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); - dw_signal_connect(testok, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); - dw_signal_connect(testcancel, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); - dw_signal_connect(testok2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); - dw_signal_connect(testcancel2, "clicked", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); - dw_signal_connect(mainwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)mainwindow); - dw_signal_connect(testwindow, "delete_event", DW_SIGNAL_FUNC(test_callback), (void *)testwindow); - - dw_main(); - - return 0; -} -#endif \ No newline at end of file