Adjusted background painting code on Windows for the new container structure.

This commit is contained in:
Pietro Gagliardi 2014-10-17 13:21:20 -04:00
parent d2e1c9f261
commit 492845da5d
3 changed files with 7 additions and 4 deletions

View File

@ -103,7 +103,7 @@ void paintControlBackground(HWND hwnd, HDC dc)
WCHAR classname[128] = L""; // more than enough to avoid collisions
parent = hwnd;
do {
for (;;) {
parent = GetParent(parent);
if (parent == NULL)
xpanic("error getting parent container of control in paintControlBackground()", GetLastError());
@ -117,7 +117,11 @@ void paintControlBackground(HWND hwnd, HDC dc)
return;
if (GetClassNameW(parent, classname, 128) == 0)
xpanic("error getting name of focused window class in paintControlBackground()", GetLastError());
} while (_wcsicmp(classname, L"button") == 0); // skip groupboxes
// skip container and groupboxes
if (_wcsicmp(classname, containerclass) != 0) // container
if (_wcsicmp(classname, L"button") != 0) // groupbox
break;
}
if (GetWindowRect(hwnd, &r) == 0)
xpanic("error getting control's window rect in paintControlBackground()", GetLastError());
// the above is a window rect; convert to client rect

View File

@ -9,8 +9,6 @@ In this case, I chose to waste a window handle rather than keep things super com
If this is seriously an issue in the future, I can roll it back.
*/
#define containerclass L"gouicontainer"
static LRESULT CALLBACK containerWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LRESULT lResult;

View File

@ -122,6 +122,7 @@ extern intptr_t tableSelectedItem(HWND);
extern void tableSelectItem(HWND, intptr_t);
// container_windows.c
#define containerclass L"gouicontainer"
extern DWORD makeContainerWindowClass(char **);
extern HWND newContainer();
extern void calculateBaseUnits(HWND, int *, int *, LONG *);