libui/redo/windows/tab.c

88 lines
1.8 KiB
C
Raw Normal View History

// 16 may 2015
#include "uipriv_windows.h"
struct tab {
uiTab t;
HWND hwnd;
};
static BOOL onWM_COMMAND(uiControl *c, WORD code, LRESULT *lResult)
{
return FALSE;
}
static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult)
{
return FALSE;
}
static void onDestroy(void *data)
{
// TODO
}
static void tabPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height)
{
// TODO
}
static void tabAppendPage(uiTab *tt, const char *name, uiControl *child)
{
}
static void tabInsertPageBefore(uiTab *tt, const char *name, uintmax_t n, uiControl *child)
{
}
static void tabDeletePage(uiTab *tt, uintmax_t n)
{
}
static uintmax_t tabNumPages(uiTab *tt)
{
return 0;
}
static int tabMargined(uiTab *tt, uintmax_t n)
{
return 0;
}
static void tabSetMargined(uiTab *tt, uintmax_t n, int margined)
{
}
uiTab *uiNewTab(void)
{
struct tab *t;
uiWindowsMakeControlParams p;
t = uiNew(struct tab);
p.dwExStyle = 0; // don't set WS_EX_CONTROLPARENT yet; we do that dynamically in the message loop (see main_windows.c)
p.lpClassName = WC_TABCONTROLW;
p.lpWindowName = L"";
p.dwStyle = TCS_TOOLTIPS | WS_TABSTOP; // start with this; we will alternate between this and WS_EX_CONTROLPARENT as needed (see main.c and msgHasTabStops above and the toggling functions below)
p.hInstance = hInstance;
p.lpParam = NULL;
p.useStandardControlFont = TRUE;
p.onWM_COMMAND = onWM_COMMAND;
p.onWM_NOTIFY = onWM_NOTIFY;
p.onDestroy = onDestroy;
p.onDestroyData = t;
uiWindowsMakeControl(uiControl(t), &p);
t->hwnd = (HWND) uiControlHandle(uiControl(t));
uiControl(t)->PreferredSize = tabPreferredSize;
uiTab(t)->AppendPage = tabAppendPage;
uiTab(t)->InsertPageBefore = tabInsertPageBefore;
uiTab(t)->DeletePage = tabDeletePage;
uiTab(t)->NumPages = tabNumPages;
uiTab(t)->Margined = tabMargined;
uiTab(t)->SetMargined = tabSetMargined;
return uiTab(t);
}