diff options
author | patthoyts <patthoyts@users.sourceforge.net> | 2008-11-01 15:34:23 (GMT) |
---|---|---|
committer | patthoyts <patthoyts@users.sourceforge.net> | 2008-11-01 15:34:23 (GMT) |
commit | 1ed5704ca8775530ac5ef1ca6d648a4029112823 (patch) | |
tree | b7d15a510acb56835dde346dca064c75f8284acf /win/ttkWinTheme.c | |
parent | 6554e94184299faab586db5a555ecf119365b845 (diff) | |
download | tk-1ed5704ca8775530ac5ef1ca6d648a4029112823.zip tk-1ed5704ca8775530ac5ef1ca6d648a4029112823.tar.gz tk-1ed5704ca8775530ac5ef1ca6d648a4029112823.tar.bz2 |
Implemented the themed spinbox widget ttk::spinbox.
Diffstat (limited to 'win/ttkWinTheme.c')
-rw-r--r-- | win/ttkWinTheme.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c index 749fe3f..e224f57 100644 --- a/win/ttkWinTheme.c +++ b/win/ttkWinTheme.c @@ -1,6 +1,6 @@ /* winTheme.c - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net> * - * $Id: ttkWinTheme.c,v 1.13 2008/01/08 17:01:00 jenglish Exp $ + * $Id: ttkWinTheme.c,v 1.14 2008/11/01 15:34:24 patthoyts Exp $ */ #ifdef _MSC_VER @@ -104,10 +104,12 @@ typedef struct { Ttk_Padding margins; /* additional placement padding */ } FrameControlElementData; -#define _FIXEDSIZE 0x8000 +#define _FIXEDSIZE 0x80000000L +#define _HALFMETRIC 0x40000000L #define FIXEDSIZE(id) (id|_FIXEDSIZE) +#define HALFMETRIC(id) (id|_HALFMETRIC) #define GETMETRIC(m) \ - ((m) & _FIXEDSIZE ? (m) & ~_FIXEDSIZE : GetSystemMetrics(m)) + ((m) & _FIXEDSIZE ? (m) & ~_FIXEDSIZE : GetSystemMetrics((m)&0x0fffffff)) static FrameControlElementData FrameControlElements[] = { { "Checkbutton.indicator", @@ -131,6 +133,12 @@ static FrameControlElementData FrameControlElements[] = { { "sizegrip", DFC_SCROLL, DFCS_SCROLLSIZEGRIP, SM_CXVSCROLL, SM_CYHSCROLL, arrow_statemap, {0,0,0,0} }, + { "Spinbox.uparrow", + DFC_SCROLL, DFCS_SCROLLUP, SM_CXVSCROLL, HALFMETRIC(SM_CYVSCROLL), + arrow_statemap, {0,0,0,0} }, + { "Spinbox.downarrow", + DFC_SCROLL, DFCS_SCROLLDOWN, SM_CXVSCROLL, HALFMETRIC(SM_CYVSCROLL), + arrow_statemap, {0,0,0,0} }, { 0,0,0,0,0,0, {0,0,0,0} } }; @@ -142,8 +150,12 @@ static void FrameControlElementSize( int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { FrameControlElementData *p = clientData; - *widthPtr = GETMETRIC(p->cxId) + Ttk_PaddingWidth(p->margins); - *heightPtr = GETMETRIC(p->cyId) + Ttk_PaddingHeight(p->margins); + int cx = GETMETRIC(p->cxId); + int cy = GETMETRIC(p->cyId); + if (p->cxId & _HALFMETRIC) cx /= 2; + if (p->cyId & _HALFMETRIC) cy /= 2; + *widthPtr = cx + Ttk_PaddingWidth(p->margins); + *heightPtr = cy + Ttk_PaddingHeight(p->margins); } static void FrameControlElementDraw( |