summaryrefslogtreecommitdiffstats
path: root/win/ttkWinXPTheme.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/ttkWinXPTheme.c')
-rw-r--r--win/ttkWinXPTheme.c123
1 files changed, 37 insertions, 86 deletions
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index 723b7d7..6e4ebe9 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -1,5 +1,5 @@
/*
- * $Id: ttkWinXPTheme.c,v 1.9 2007/02/22 13:56:35 dkf Exp $
+ * $Id: ttkWinXPTheme.c,v 1.10 2007/04/10 18:05:48 jenglish Exp $
*
* Tk theme engine which uses the Windows XP "Visual Styles" API
* Adapted from Georgios Petasis' XP theme patch.
@@ -88,8 +88,7 @@ typedef struct
*/
static XPThemeProcs *
-LoadXPThemeProcs(
- HINSTANCE *phlib)
+LoadXPThemeProcs(HINSTANCE *phlib)
{
OSVERSIONINFO os;
@@ -146,8 +145,7 @@ LoadXPThemeProcs(
*/
static void
-XPThemeDeleteProc(
- void *clientData)
+XPThemeDeleteProc(void *clientData)
{
XPThemeData *themeData = clientData;
FreeLibrary(themeData->hlibrary);
@@ -155,9 +153,7 @@ XPThemeDeleteProc(
}
static int
-XPThemeEnabled(
- Ttk_Theme theme,
- void *clientData)
+XPThemeEnabled(Ttk_Theme theme, void *clientData)
{
XPThemeData *themeData = clientData;
int active = themeData->procs->IsThemeActive();
@@ -170,8 +166,7 @@ XPThemeEnabled(
* Helper routine. Returns a RECT data structure.
*/
static RECT
-BoxToRect(
- Ttk_Box b)
+BoxToRect(Ttk_Box b)
{
RECT rc;
rc.top = b.y;
@@ -411,9 +406,7 @@ typedef struct
} ElementData;
static ElementData *
-NewElementData(
- XPThemeProcs *procs,
- ElementInfo *info)
+NewElementData(XPThemeProcs *procs, ElementInfo *info)
{
ElementData *elementData = (ElementData*)ckalloc(sizeof(ElementData));
@@ -424,9 +417,7 @@ NewElementData(
return elementData;
}
-static void
-DestroyElementData(
- void *elementData)
+static void DestroyElementData(void *elementData)
{
ckfree(elementData);
}
@@ -443,10 +434,7 @@ DestroyElementData(
*/
static int
-InitElementData(
- ElementData *elementData,
- Tk_Window tkwin,
- Drawable d)
+InitElementData(ElementData *elementData, Tk_Window tkwin, Drawable d)
{
Window win = Tk_WindowId(tkwin);
@@ -472,8 +460,7 @@ InitElementData(
}
static void
-FreeElementData(
- ElementData *elementData)
+FreeElementData(ElementData *elementData)
{
elementData->procs->CloseThemeData(elementData->hTheme);
if (elementData->drawable != 0) {
@@ -484,19 +471,15 @@ FreeElementData(
/*----------------------------------------------------------------------
* +++ Generic element implementation.
- *
+ *
* Used for elements which are handled entirely by the XP Theme API,
* such as radiobutton and checkbutton indicators, scrollbar arrows, etc.
*/
static void
GenericElementGeometry(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- int *widthPtr,
- int *heightPtr,
- Ttk_Padding *paddingPtr)
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
ElementData *elementData = clientData;
HRESULT result;
@@ -528,12 +511,8 @@ GenericElementGeometry(
static void
GenericElementDraw(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- Drawable d,
- Ttk_Box b,
- unsigned int state)
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
{
ElementData *elementData = clientData;
RECT rc;
@@ -574,12 +553,8 @@ static Ttk_ElementSpec GenericElementSpec =
static void
ThumbElementDraw(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- Drawable d,
- Ttk_Box b,
- unsigned int state)
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
{
ElementData *elementData = clientData;
unsigned stateId = Ttk_StateTableLookup(elementData->info->statemap, state);
@@ -613,17 +588,12 @@ static Ttk_ElementSpec ThumbElementSpec =
/*----------------------------------------------------------------------
* +++ Progress bar element.
* Increases the requested length of PP_CHUNK and PP_CHUNKVERT parts
- * so that indeterminate progress bars show 3 bars instead of 1.
+ * so that indeterminate progress bars show 3 bars instead of 1.
*/
-static void
-PbarElementGeometry(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- int *widthPtr,
- int *heightPtr,
- Ttk_Padding *paddingPtr)
+static void PbarElementGeometry(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
ElementData *elementData = clientData;
int nBars = 3;
@@ -651,25 +621,19 @@ static Ttk_ElementSpec PbarElementSpec =
* +++ Notebook tab element.
* Same as generic element, with additional logic to select
* proper iPartID for the leftmost tab.
- *
- * Notes: TABP_TABITEMRIGHTEDGE (or TABP_TOPTABITEMRIGHTEDGE,
+ *
+ * Notes: TABP_TABITEMRIGHTEDGE (or TABP_TOPTABITEMRIGHTEDGE,
* which appears to be identical) should be used if the
* tab is exactly at the right edge of the notebook, but
* not if it's simply the rightmost tab. This information
* is not available.
*
- * The TIS_* and TILES_* definitions are identical, so
+ * The TIS_* and TILES_* definitions are identical, so
* we can use the same statemap no matter what the partId.
*/
-
-static void
-TabElementDraw(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- Drawable d,
- Ttk_Box b,
- unsigned int state)
+static void TabElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
{
ElementData *elementData = clientData;
int partId = elementData->info->partId;
@@ -703,7 +667,7 @@ static Ttk_ElementSpec TabElementSpec =
#define TTK_STATE_OPEN TTK_STATE_USER1
#define TTK_STATE_LEAF TTK_STATE_USER2
-static Ttk_StateTable header_statemap[] =
+static Ttk_StateTable header_statemap[] =
{
{ HIS_PRESSED, TTK_STATE_PRESSED, 0 },
{ HIS_HOT, TTK_STATE_ACTIVE, 0 },
@@ -716,14 +680,9 @@ static Ttk_StateTable tvpglyph_statemap[] =
{ GLPS_CLOSED, 0,0 },
};
-static void
-TreeIndicatorElementDraw(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- Drawable d,
- Ttk_Box b,
- unsigned int state)
+static void TreeIndicatorElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
{
if (!(state & TTK_STATE_LEAF)) {
GenericElementDraw(clientData,elementRecord,tkwin,d,b,state);
@@ -745,11 +704,11 @@ static Ttk_ElementSpec TreeIndicatorElementSpec =
*----------------------------------------------------------------------
* Text element (does not work yet).
*
- * According to "Using Windows XP Visual Styles", we need to select
+ * According to "Using Windows XP Visual Styles", we need to select
* a font into the DC before calling DrawThemeText().
* There's just no easy way to get an HFONT out of a Tk_Font.
* Maybe GetThemeFont() would work?
- *
+ *
*/
typedef struct
@@ -769,12 +728,8 @@ static Ttk_ElementOptionSpec TextElementOptions[] =
static void
TextElementGeometry(
- void *clientData,
- void *elementRecord,
- Tk_Window tkwin,
- int *widthPtr,
- int *heightPtr,
- Ttk_Padding *paddingPtr)
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
TextElement *element = elementRecord;
ElementData *elementData = clientData;
@@ -805,14 +760,10 @@ TextElementGeometry(
FreeElementData(elementData);
}
-static void
+static void
TextElementDraw(
- ClientData clientData,
- void *elementRecord,
- Tk_Window tkwin,
- Drawable d,
- Ttk_Box b,
- unsigned int state)
+ ClientData clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
{
TextElement *element = elementRecord;
ElementData *elementData = clientData;