Fixed tab dialog textures.

This commit is contained in:
Pietro Gagliardi 2015-05-30 15:01:21 -04:00
parent d18cd47a4b
commit 4f41b2d18d
2 changed files with 16 additions and 7 deletions

View File

@ -1,14 +1,15 @@
// 30 may 2015
//TODO#include "winapi.h"
#include <windows.h>
#include "resources.h"
// this is a UTF-8 file
#pragma code_page(65001)
// this is the dialog template used
// this is the dialog template used by tab pages; see windows/tabpage.c for details
rcTabPageDialog DIALOGEX 0, 0, 100, 100
STYLE WS_CHILD | WS_VISIBLE
// TODO EXSTYLE WS_EX_CONTROLPARENT
EXSTYLE WS_EX_CONTROLPARENT
BEGIN
// nothing
END

View File

@ -55,6 +55,14 @@ static void tabPageResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width,
uiFreeSizing(dchild);
}
// dummy dialog function; see below for details
INT_PTR CALLBACK dlgproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_INITDIALOG)
return TRUE;
return FALSE;
}
uiControl *newTabPage(uiControl *child)
{
struct tabPage *t;
@ -62,11 +70,11 @@ uiControl *newTabPage(uiControl *child)
t = (struct tabPage *) uiWindowsNewSingleHWNDControl(tabPageType());
t->hwnd = uiWindowsUtilCreateControlHWND(WS_EX_CONTROLPARENT,
WC_DIALOG, L"",
0,
hInstance, NULL,
FALSE);
// unfortunately this needs to be a proper dialog for EnableThemeDialogTexture() to work; CreateWindowExW() won't suffice
t->hwnd = CreateDialogW(hInstance, MAKEINTRESOURCE(rcTabPageDialog),
utilWindow, dlgproc);
if (t->hwnd == NULL)
logLastError("error creating tab page in newTabPage()");
// TODO figure out why this is not working
hr = EnableThemeDialogTexture(t->hwnd, ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_ENABLETAB);