2015-05-17 12:01:42 -05:00
// 16 may 2015
2015-05-16 19:28:35 -05:00
# 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 )
{
2015-05-17 12:01:42 -05:00
return FALSE ;
2015-05-16 19:28:35 -05:00
}
static void onDestroy ( void * data )
{
2015-05-17 12:01:42 -05:00
// TODO
2015-05-16 19:28:35 -05:00
}
static void tabPreferredSize ( uiControl * c , uiSizing * d , intmax_t * width , intmax_t * height )
{
2015-05-17 12:01:42 -05:00
// TODO
2015-05-16 19:28:35 -05:00
}
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 )
{
2015-05-17 12:01:42 -05:00
return 0 ;
2015-05-16 19:28:35 -05:00
}
static int tabMargined ( uiTab * tt , uintmax_t n )
{
2015-05-17 12:01:42 -05:00
return 0 ;
2015-05-16 19:28:35 -05:00
}
static void tabSetMargined ( uiTab * tt , uintmax_t n , int margined )
{
}
uiTab * uiNewTab ( void )
{
struct tab * t ;
uiWindowsMakeControlParams p ;
t = uiNew ( struct tab ) ;
2015-05-17 18:07:07 -05:00
uiTyped ( t ) - > Type = uiTypeTab ( ) ;
2015-05-16 19:28:35 -05:00
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 ) ;
}
2015-05-16 19:33:20 -05:00
// unfortunately WS_TABSTOP and WS_EX_CONTROLPARENT are mutually exclusive, so we have to toggle between them
// see main.c for more details
void tabEnterTabNavigation ( HWND hwnd )
{
setStyle ( hwnd , getStyle ( hwnd ) & ~ WS_TABSTOP ) ;
setExStyle ( hwnd , getExStyle ( hwnd ) | WS_EX_CONTROLPARENT ) ;
}
void tabLeaveTabNavigation ( HWND hwnd )
{
setExStyle ( hwnd , getExStyle ( hwnd ) & ~ WS_EX_CONTROLPARENT ) ;
setStyle ( hwnd , getStyle ( hwnd ) | WS_TABSTOP ) ;
}