From: <kr_...@us...> - 2004-05-29 23:00:30
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26069/port/src/cbits/Win32 Modified Files: Splitter.c Log Message: Complete support for splitters under Linux. The windows versions still isn't ready Index: Splitter.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Splitter.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Splitter.c 17 May 2004 06:19:52 -0000 1.1 --- Splitter.c 29 May 2004 23:00:20 -0000 1.2 *************** *** 1,3 **** ! #include "Splitter.h" #include "Internals.h" #include "Handlers_stub.h" --- 1,3 ---- ! #include "Splitter.h" #include "Internals.h" #include "Handlers_stub.h" *************** *** 18,34 **** rects[2] = rects[0]; ! if (GetWindowLong(hWnd, GWL_STYLE) & CCS_VERT) ! { ! rects[0].top = pData->nSplitterPos-(SPLIT_LINE_SIZE-2)/2; ! rects[0].bottom = pData->nSplitterPos+(SPLIT_LINE_SIZE-2)/2; ! rects[1].bottom = pData->nSplitterPos-SPLIT_LINE_SIZE/2; ! rects[2].top = pData->nSplitterPos+SPLIT_LINE_SIZE/2; ! } ! else ! { ! rects[0].left = pData->nSplitterPos-(SPLIT_LINE_SIZE-2)/2; ! rects[0].right = pData->nSplitterPos+(SPLIT_LINE_SIZE-2)/2; ! rects[1].right = pData->nSplitterPos-SPLIT_LINE_SIZE/2; ! rects[2].left = pData->nSplitterPos+SPLIT_LINE_SIZE/2; } } --- 18,34 ---- rects[2] = rects[0]; ! if (GetWindowLong(hWnd, GWL_STYLE) & CCS_VERT) ! { ! rects[0].top = pData->nSplitterPos-(SPLIT_LINE_SIZE-2)/2; ! rects[0].bottom = pData->nSplitterPos+(SPLIT_LINE_SIZE-2)/2; ! rects[1].bottom = pData->nSplitterPos-SPLIT_LINE_SIZE/2; ! rects[2].top = pData->nSplitterPos+SPLIT_LINE_SIZE/2; ! } ! else ! { ! rects[0].left = pData->nSplitterPos-(SPLIT_LINE_SIZE-2)/2; ! rects[0].right = pData->nSplitterPos+(SPLIT_LINE_SIZE-2)/2; ! rects[1].right = pData->nSplitterPos-SPLIT_LINE_SIZE/2; ! rects[2].left = pData->nSplitterPos+SPLIT_LINE_SIZE/2; } } *************** *** 56,63 **** pData = malloc(sizeof(SplitterData)); pData->nSplitterPos = 100; ! pData->hCtrl1 = NULL; ! pData->hCtrl2 = NULL; SetWindowLong(hWnd, GWL_USERDATA, (LONG) pData); } break; --- 56,83 ---- pData = malloc(sizeof(SplitterData)); pData->nSplitterPos = 100; ! ! pData->hCtrl1 = CreateWindow( ! "HCOMPOUND", ! NULL, ! WS_CHILD | WS_BORDER | WS_HSCROLL | WS_VSCROLL, ! 0,0,0,0, ! hWnd, ! NULL, ! ghModule, ! NULL ! ); ! pData->hCtrl2 = CreateWindow( ! "HCOMPOUND", ! NULL, ! WS_CHILD | WS_BORDER | WS_HSCROLL | WS_VSCROLL, ! 0,0,0,0, ! hWnd, ! NULL, ! ghModule, ! NULL ! ); SetWindowLong(hWnd, GWL_USERDATA, (LONG) pData); + RelayoutPanes(hWnd, pData); } break; *************** *** 69,102 **** RECT rects[3]; PAINTSTRUCT ps; ! HDC hDC = BeginPaint(hWnd, &ps); ! ! CalcPaneRects(hWnd, pData, rects); ! ! FillRect(hDC, &rects[0], GetSysColorBrush(COLOR_BTNFACE)); ! ! if (GetWindowLong(hWnd, GWL_STYLE) & CCS_VERT) ! { ! MoveToEx(hDC, rects[0].left, rects[0].top-1, NULL); ! LineTo(hDC, rects[0].right, rects[0].top-1); ! ! MoveToEx(hDC, rects[0].left, rects[0].bottom+1, NULL); ! LineTo(hDC, rects[0].right, rects[0].bottom+1); ! } ! else ! { ! MoveToEx(hDC, rects[0].left-1, rects[0].top, NULL); ! LineTo(hDC, rects[0].left-1, rects[0].bottom); ! ! MoveToEx(hDC, rects[0].right+1, rects[0].top, NULL); ! LineTo(hDC, rects[0].right+1, rects[0].bottom); ! } ! ! if (!pData->hCtrl1) ! FillRect(hDC, &rects[1], GetSysColorBrush(COLOR_BTNFACE)); ! ! if (!pData->hCtrl2) ! FillRect(hDC, &rects[2], GetSysColorBrush(COLOR_BTNFACE)); ! ! EndPaint(hWnd, &ps); } break; --- 89,122 ---- RECT rects[3]; PAINTSTRUCT ps; ! HDC hDC = BeginPaint(hWnd, &ps); ! ! CalcPaneRects(hWnd, pData, rects); ! ! FillRect(hDC, &rects[0], GetSysColorBrush(COLOR_BTNFACE)); ! ! if (GetWindowLong(hWnd, GWL_STYLE) & CCS_VERT) ! { ! MoveToEx(hDC, rects[0].left, rects[0].top-1, NULL); ! LineTo(hDC, rects[0].right, rects[0].top-1); ! ! MoveToEx(hDC, rects[0].left, rects[0].bottom+1, NULL); ! LineTo(hDC, rects[0].right, rects[0].bottom+1); ! } ! else ! { ! MoveToEx(hDC, rects[0].left-1, rects[0].top, NULL); ! LineTo(hDC, rects[0].left-1, rects[0].bottom); ! ! MoveToEx(hDC, rects[0].right+1, rects[0].top, NULL); ! LineTo(hDC, rects[0].right+1, rects[0].bottom); ! } ! ! if (!pData->hCtrl1) ! FillRect(hDC, &rects[1], GetSysColorBrush(COLOR_BTNFACE)); ! ! if (!pData->hCtrl2) ! FillRect(hDC, &rects[2], GetSysColorBrush(COLOR_BTNFACE)); ! ! EndPaint(hWnd, &ps); } break; *************** *** 111,122 **** } ! WindowHandle osCreateHorzSplitter(WindowHandle window) ! { HWND hSplitter; hSplitter = CreateWindow( "HSPLITTER", NULL, ! WS_CHILD | WS_TABSTOP, 0,0,0,0, window, --- 131,143 ---- } ! WindowHandle osCreateSplitter(WindowHandle window, BOOL isVert, /* out */ WindowHandle *panes) ! { HWND hSplitter; + SplitterData *pData; hSplitter = CreateWindow( "HSPLITTER", NULL, ! WS_CHILD | WS_TABSTOP | (isVert ? CCS_VERT : 0), 0,0,0,0, window, *************** *** 125,148 **** NULL ); - return checkWindow(hSplitter, "HSPLITTER"); - } - - WindowHandle osCreateVertSplitter(WindowHandle window) - { - HWND hSplitter; ! hSplitter = CreateWindow( ! "HSPLITTER", ! NULL, ! WS_CHILD | WS_TABSTOP | CCS_VERT, ! 0,0,0,0, ! window, ! NULL, ! ghModule, ! NULL ! ); ! return checkWindow(hSplitter, "HSPLITTER"); ! } ! void osGetSplitterReqSize(WindowHandle splitter, int *res) { --- 146,157 ---- NULL ); ! pData = (SplitterData *) GetWindowLong(splitter, GWL_USERDATA); ! panes[0] = pData->hCtrl1; ! panes[2] = pData->hCtrl2; ! ! return checkWindow(hSplitter, "HSPLITTER"); ! } ! void osGetSplitterReqSize(WindowHandle splitter, int *res) { *************** *** 151,160 **** } ! void osSetSplitterChildren(WindowHandle splitter, WindowHandle child1, WindowHandle child2) { ! SplitterData *pData = (SplitterData *) GetWindowLong(splitter, GWL_USERDATA); ! pData->hCtrl1 = child1; ! pData->hCtrl2 = child2; ! RelayoutPanes(splitter, pData); ! InvalidateRect(splitter,NULL,TRUE); } --- 160,173 ---- } ! void osGetSplitterRange(WindowHandle splitter, int *range) { ! } ! ! void osSetSplitterPosition(WindowHandle splitter, int pos) ! { ! } ! ! int osGetSplitterPosition(WindowHandle splitter) ! { ! return 0; } |