|
From: <kr_...@us...> - 2003-10-12 21:33:55
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv1230/port/src/cbits/Win32
Modified Files:
GroupBox.c Internals.h Util.c Window.c
Log Message:
Improved dynamic layout for GroupBox and Notebook
Index: GroupBox.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/GroupBox.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** GroupBox.c 12 Oct 2003 07:53:57 -0000 1.3
--- GroupBox.c 12 Oct 2003 21:33:46 -0000 1.4
***************
*** 8,27 ****
LRESULT CALLBACK HGroupBoxFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_PAINT:
return CallWindowProc(DefGroupBoxProc, hWnd, uMsg, wParam, lParam);
! case WM_SIZE:
! {
! RECT rect;
! HWND hParent;
!
! hParent = GetParent(hWnd);
! GetWindowRect(hWnd, &rect);
! ScreenToClient(hParent, ((POINT *) &rect));
! ScreenToClient(hParent, ((POINT *) &rect)+1);
! InvalidateRect(hParent, &rect, FALSE);
}
! break;
};
--- 8,39 ----
LRESULT CALLBACK HGroupBoxFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
+ WindowData *pData = (WindowData *) GetWindowLong(hWnd,GWL_USERDATA);
+
switch (uMsg)
{
case WM_PAINT:
return CallWindowProc(DefGroupBoxProc, hWnd, uMsg, wParam, lParam);
! case WM_ERASEBKGND:
! {
! HDC hDC = (HDC) wParam;
! RECT rect;
! HRGN hRgn;
! HWND hCtrl;
!
! hCtrl = hWnd;
! while (hCtrl && !pData->hBackBrush)
! {
! hCtrl = GetParent(hCtrl);
! pData = (WindowData *) GetWindowLong(hCtrl,GWL_USERDATA);
! }
!
! GetClipBox(hDC, &rect);
! hRgn = CreateRectRgn(rect.left, rect.top, rect.right, rect.bottom);
! GetClipRgn(hDC, hRgn);
! getWindowClipRgn(hWnd, hRgn);
! FillRgn(hDC, hRgn, pData->hBackBrush);
! DeleteObject(hRgn);
}
! return TRUE;
};
***************
*** 62,69 ****
ReleaseDC(box, hDC);
! res[0] = 10;
! res[1] = sz.cy+2;
! res[2] = 10;
! res[3] = 10;
}
--- 74,81 ----
ReleaseDC(box, hDC);
! res[0] = 5;
! res[1] = max(10,sz.cy+2);
! res[2] = 5;
! res[3] = 5;
}
Index: Internals.h
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Internals.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Internals.h 24 Aug 2003 21:07:48 -0000 1.9
--- Internals.h 12 Oct 2003 21:33:46 -0000 1.10
***************
*** 72,75 ****
--- 72,97 ----
} FrameData;
+ typedef struct
+ {
+ POINT Origin;
+ SIZE DomainSize;
+ SIZE LineSize, PageSize;
+ BOOL bInDragMode;
+
+ COLORREF foreColor;
+ COLORREF backColor;
+ HBRUSH hBackBrush;
+ int hatchStyle;
+ BitmapHandle patBmp;
+
+ BOOL enabled;
+ int disabledCtrlsCount;
+ HWND *disabledCtrls;
+
+ HWND hTooltip;
+ HWND hGripWnd;
+ } WindowData;
+
+
extern void rfree(void *ptr);
extern void *rmalloc(unsigned long bytes);
Index: Util.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Util.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** Util.c 10 Oct 2003 22:59:03 -0000 1.26
--- Util.c 12 Oct 2003 21:33:46 -0000 1.27
***************
*** 60,64 ****
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
! wc.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE+1); // For best results (Petzold)
wc.lpszMenuName = NULL;
wc.lpszClassName = "HSDIFRAME";
--- 60,64 ----
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
! wc.hbrBackground = GetSysColorBrush(COLOR_APPWORKSPACE);
wc.lpszMenuName = NULL;
wc.lpszClassName = "HSDIFRAME";
***************
*** 73,77 ****
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
! wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
wc.lpszMenuName = NULL;
wc.lpszClassName = "HSDIWINDOW";
--- 73,77 ----
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
! wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
wc.lpszMenuName = NULL;
wc.lpszClassName = "HSDIWINDOW";
***************
*** 86,90 ****
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
! wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
wc.lpszMenuName = NULL;
wc.lpszClassName = "HDIALOG";
--- 86,90 ----
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
! wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
wc.lpszMenuName = NULL;
wc.lpszClassName = "HDIALOG";
***************
*** 99,103 ****
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
! wc.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE+1); // For best results (Petzold)
wc.lpszMenuName = NULL;
wc.lpszClassName = "HMDIFRAME";
--- 99,103 ----
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
! wc.hbrBackground = GetSysColorBrush(COLOR_APPWORKSPACE);
wc.lpszMenuName = NULL;
wc.lpszClassName = "HMDIFRAME";
***************
*** 112,116 ****
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
! wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1); // For best results (Petzold)
wc.lpszMenuName = NULL;
wc.lpszClassName = "HMDIWINDOW";
--- 112,116 ----
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
! wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
wc.lpszMenuName = NULL;
wc.lpszClassName = "HMDIWINDOW";
***************
*** 125,129 ****
wc.hIcon = NULL;
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
! wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1); // For best results (Petzold)
wc.lpszMenuName = NULL;
wc.lpszClassName = "HCOMPOUND";
--- 125,129 ----
wc.hIcon = NULL;
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
! wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
wc.lpszMenuName = NULL;
wc.lpszClassName = "HCOMPOUND";
***************
*** 146,150 ****
wc.hIcon = NULL;
wc.hCursor = NULL;
! wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = "HDOCKBAR";
--- 146,150 ----
wc.hIcon = NULL;
wc.hCursor = NULL;
! wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
wc.lpszMenuName = NULL;
wc.lpszClassName = "HDOCKBAR";
***************
*** 175,179 ****
wc.hIcon = NULL;
wc.hCursor = NULL;
! wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = "HNOTEBOOKPAGE";
--- 175,179 ----
wc.hIcon = NULL;
wc.hCursor = NULL;
! wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE);
wc.lpszMenuName = NULL;
wc.lpszClassName = "HNOTEBOOKPAGE";
Index: Window.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** Window.c 11 Oct 2003 08:50:54 -0000 1.56
--- Window.c 12 Oct 2003 21:33:46 -0000 1.57
***************
*** 5,29 ****
#include <windowsx.h>
- typedef struct
- {
- POINT Origin;
- SIZE DomainSize;
- SIZE LineSize, PageSize;
- BOOL bInDragMode;
-
- COLORREF foreColor;
- COLORREF backColor;
- HBRUSH hBackBrush;
- int hatchStyle;
- BitmapHandle patBmp;
-
- BOOL enabled;
- int disabledCtrlsCount;
- HWND *disabledCtrls;
-
- HWND hTooltip;
- HWND hGripWnd;
- } WindowData;
-
unsigned int GetModifiers()
{
--- 5,8 ----
***************
*** 54,58 ****
}
! static void getWindowClipRgn(HWND hWnd, HRGN hRgn)
{
RECT rect;
--- 33,37 ----
}
! void getWindowClipRgn(HWND hWnd, HRGN hRgn)
{
RECT rect;
***************
*** 64,73 ****
while (hCtrl)
{
! char buffer[20];
!
! GetClassName(hCtrl,buffer,sizeof(buffer));
!
! // fill background for all windows except GroupBox
! if (_stricmp(buffer, "HGROUPBOX") != 0 && (GetWindowLong(hCtrl,GWL_STYLE) & WS_VISIBLE))
{
GetWindowRect(hCtrl,&rect);
--- 43,47 ----
while (hCtrl)
{
! if (GetWindowLong(hCtrl,GWL_STYLE) & WS_VISIBLE)
{
GetWindowRect(hCtrl,&rect);
***************
*** 178,182 ****
pData->hatchStyle = 0;
pData->patBmp = NULL;
! pData->hBackBrush = CreateSolidBrush (pData->backColor);
pData->enabled = TRUE;
pData->disabledCtrlsCount = 0;
--- 152,156 ----
pData->hatchStyle = 0;
pData->patBmp = NULL;
! pData->hBackBrush = (HBRUSH) GetClassLong(hWnd, GCL_HBRBACKGROUND);
pData->enabled = TRUE;
pData->disabledCtrlsCount = 0;
***************
*** 627,630 ****
--- 601,611 ----
{
HDC hDC = (HDC) wParam;
+
+ while (hWnd && !pData->hBackBrush)
+ {
+ hWnd = GetParent(hWnd);
+ pData = (WindowData *) GetWindowLong(hWnd,GWL_USERDATA);
+ }
+
SelectObject(hDC, pData->hBackBrush);
SetBkColor(hDC, pData->backColor);
***************
*** 900,904 ****
void osSetWindowColor(WindowHandle window, int foreColor, int backColor, int hatchStyle, BitmapHandle patBmp)
{
! LOGBRUSH lb;
WindowData *pData = (WindowData *) GetWindowLong(window,GWL_USERDATA);
--- 881,885 ----
void osSetWindowColor(WindowHandle window, int foreColor, int backColor, int hatchStyle, BitmapHandle patBmp)
{
! LOGBRUSH lb;
WindowData *pData = (WindowData *) GetWindowLong(window,GWL_USERDATA);
***************
*** 1285,1289 ****
ScreenToClient(hParent, ((LPPOINT) &rect) );
ScreenToClient(hParent, ((LPPOINT) &rect)+1);
! InvalidateRect(GetParent(ctrl),&rect,FALSE);
}
--- 1266,1270 ----
ScreenToClient(hParent, ((LPPOINT) &rect) );
ScreenToClient(hParent, ((LPPOINT) &rect)+1);
! InvalidateRect(hParent,&rect,FALSE);
}
***************
*** 1439,1443 ****
handleContainerReLayout(hwnd);
}
!
void osForceContainerReLayout(HWND hCtrl)
{
--- 1420,1439 ----
handleContainerReLayout(hwnd);
}
!
! void osReLayoutContainer(WindowHandle window)
! {
! char buffer[20];
! GetClassName(window,buffer,sizeof(buffer));
!
! if (_stricmp(buffer, "HNOTEBOOK") == 0 ||
! _stricmp(buffer, "HNOTEBOOKPAGE") == 0 ||
! _stricmp(buffer, "HGROUPBOX") == 0)
! {
! osForceContainerReLayout(window);
! }
!
! handleContainerReLayout(window);
! }
!
void osForceContainerReLayout(HWND hCtrl)
{
|