|
From: <kr_...@us...> - 2003-09-01 20:27:55
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv26139/port/src/cbits/Win32
Modified Files:
Util.c Window.c
Added Files:
GroupBox.c
Log Message:
Added GroupBox control. /* Still only for Windows */
--- NEW FILE: GroupBox.c ---
#include "GroupBox.h"
#include "Internals.h"
WNDPROC DefGroupBoxProc = NULL;
extern LRESULT CALLBACK HWindowSharedFunction(WNDPROC pDefWindowProc, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK HGroupBoxFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_PAINT:
return CallWindowProc(DefGroupBoxProc, hWnd, uMsg, wParam, lParam);
};
return HWindowSharedFunction(DefGroupBoxProc, hWnd, uMsg, wParam, lParam);
}
WindowHandle osCreateGroupBox(WindowHandle form)
{
HWND hWnd;
hWnd = CreateWindow(
"HGROUPBOX",
NULL,
WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
0,0,0,0,
form,
NULL,
ghModule,
NULL
);
return checkWindow(hWnd, "HGROUPBOX");
};
void osGetGroupBoxBordersSize(WindowHandle box, int *res)
{
SIZE sz;
HDC hDC = GetDC(box);
HFONT hFont = (HFONT) SendMessage(box,WM_GETFONT,0,0);
int nLen = GetWindowTextLength(box);
char *buffer = (char *) rmalloc(nLen+1);
nLen = GetWindowText(box, buffer, nLen+1);
if (hFont)
SelectObject(hDC, hFont);
GetTextExtentPoint32(hDC, buffer, nLen, &sz);
rfree(buffer);
ReleaseDC(box, hDC);
res[0] = 10;
res[1] = sz.cy+2;
res[2] = 10;
res[3] = 10;
}
char *osGetGroupBoxText(WindowHandle box)
{
int nLen = GetWindowTextLength(box);
char *buffer = (char *) rmalloc(nLen+1);
GetWindowText(box, buffer, nLen+1);
return buffer;
};
void osSetGroupBoxText(WindowHandle box, char *txt)
{
SetWindowText(box, txt);
};
Index: Util.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Util.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** Util.c 27 Aug 2003 08:16:53 -0000 1.23
--- Util.c 1 Sep 2003 20:27:49 -0000 1.24
***************
*** 37,43 ****
--- 37,45 ----
extern LRESULT CALLBACK HNotebookFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern LRESULT CALLBACK HNotebookPageFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ extern LRESULT CALLBACK HGroupBoxFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern WNDPROC DefToolBarProc;
extern WNDPROC DefTabCtrlProc;
+ extern WNDPROC DefGroupBoxProc;
void osInit(char *appName, char *appVersion, int DocumentInterface)
***************
*** 126,129 ****
--- 128,139 ----
wc.lpszMenuName = NULL;
wc.lpszClassName = "HCOMPOUND";
+ RegisterClass(&wc);
+
+ // GroupBox class
+ GetClassInfo(ghModule, "BUTTON", &wc);
+ DefGroupBoxProc = wc.lpfnWndProc;
+ wc.style = CS_DBLCLKS;
+ wc.lpfnWndProc = HGroupBoxFunction;
+ wc.lpszClassName = "HGROUPBOX";
RegisterClass(&wc);
Index: Window.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** Window.c 27 Aug 2003 08:22:13 -0000 1.46
--- Window.c 1 Sep 2003 20:27:49 -0000 1.47
***************
*** 59,73 ****
while (hCtrl)
{
! GetWindowRect(hCtrl,&rect);
! upLeft.x = rect.left;
! upLeft.y = rect.top;
! ScreenToClient(hWnd,&upLeft);
! downRight.x = rect.right;
! downRight.y = rect.bottom;
! ScreenToClient(hWnd,&downRight);
! hTmpRgn = CreateRectRgn(upLeft.x, upLeft.y, downRight.x, downRight.y);
! CombineRgn(hRgn, hRgn, hTmpRgn, RGN_DIFF);
! DeleteObject(hTmpRgn);
hCtrl = GetNextWindow(hCtrl,GW_HWNDNEXT);
--- 59,81 ----
while (hCtrl)
{
! char buffer[20];
!
! GetClassName(hCtrl,buffer,sizeof(buffer));
!
! // fill background for all windows except GroupBox
! if (_stricmp(buffer, "HGROUPBOX") != 0)
! {
! GetWindowRect(hCtrl,&rect);
! upLeft.x = rect.left;
! upLeft.y = rect.top;
! ScreenToClient(hWnd,&upLeft);
! downRight.x = rect.right;
! downRight.y = rect.bottom;
! ScreenToClient(hWnd,&downRight);
! hTmpRgn = CreateRectRgn(upLeft.x, upLeft.y, downRight.x, downRight.y);
! CombineRgn(hRgn, hRgn, hTmpRgn, RGN_DIFF);
! DeleteObject(hTmpRgn);
! }
hCtrl = GetNextWindow(hCtrl,GW_HWNDNEXT);
***************
*** 591,595 ****
}
! return pDefWindowProc(hWnd, uMsg, wParam, lParam);
};
--- 599,603 ----
}
! return CallWindowProc(pDefWindowProc, hWnd, uMsg, wParam, lParam);
};
***************
*** 703,707 ****
LRESULT CALLBACK HCompoundControlFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
! return HWindowSharedFunction(DefMDIChildProc, hWnd, uMsg, wParam, lParam);
}
--- 711,715 ----
LRESULT CALLBACK HCompoundControlFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
! return HWindowSharedFunction(DefWindowProc, hWnd, uMsg, wParam, lParam);
}
***************
*** 1344,1348 ****
if (_stricmp(buffer, "HNOTEBOOK") != 0 &&
! _stricmp(buffer, "HNOTEBOOKPAGE") != 0)
{
handleContainerReLayout(hWnd);
--- 1352,1357 ----
if (_stricmp(buffer, "HNOTEBOOK") != 0 &&
! _stricmp(buffer, "HNOTEBOOKPAGE") != 0 &&
! _stricmp(buffer, "HGROUPBOX") != 0)
{
handleContainerReLayout(hWnd);
|