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 // 30 may 2015
//TODO#include "winapi.h" //TODO#include "winapi.h"
#include <windows.h> #include <windows.h>
#include "resources.h"
// this is a UTF-8 file // this is a UTF-8 file
#pragma code_page(65001) #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 rcTabPageDialog DIALOGEX 0, 0, 100, 100
STYLE WS_CHILD | WS_VISIBLE STYLE WS_CHILD | WS_VISIBLE
// TODO EXSTYLE WS_EX_CONTROLPARENT EXSTYLE WS_EX_CONTROLPARENT
BEGIN BEGIN
// nothing // nothing
END END

View File

@ -55,6 +55,14 @@ static void tabPageResize(uiControl *c, intmax_t x, intmax_t y, intmax_t width,
uiFreeSizing(dchild); 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) uiControl *newTabPage(uiControl *child)
{ {
struct tabPage *t; struct tabPage *t;
@ -62,11 +70,11 @@ uiControl *newTabPage(uiControl *child)
t = (struct tabPage *) uiWindowsNewSingleHWNDControl(tabPageType()); t = (struct tabPage *) uiWindowsNewSingleHWNDControl(tabPageType());
t->hwnd = uiWindowsUtilCreateControlHWND(WS_EX_CONTROLPARENT, // unfortunately this needs to be a proper dialog for EnableThemeDialogTexture() to work; CreateWindowExW() won't suffice
WC_DIALOG, L"", t->hwnd = CreateDialogW(hInstance, MAKEINTRESOURCE(rcTabPageDialog),
0, utilWindow, dlgproc);
hInstance, NULL, if (t->hwnd == NULL)
FALSE); logLastError("error creating tab page in newTabPage()");
// TODO figure out why this is not working // TODO figure out why this is not working
hr = EnableThemeDialogTexture(t->hwnd, ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_ENABLETAB); hr = EnableThemeDialogTexture(t->hwnd, ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_ENABLETAB);