diff options
author | jenglish <jenglish@flightlab.com> | 2008-12-03 18:44:49 (GMT) |
---|---|---|
committer | jenglish <jenglish@flightlab.com> | 2008-12-03 18:44:49 (GMT) |
commit | be03330f5858260351f40d4c3dffb0363d358ee5 (patch) | |
tree | e50af7dbf34fa6fba912218b8b2ee694ef0f76e8 /generic/ttk | |
parent | ebcb804ce2070734ebccaae2d4fa9398bf0332cf (diff) | |
download | tk-be03330f5858260351f40d4c3dffb0363d358ee5.zip tk-be03330f5858260351f40d4c3dffb0363d358ee5.tar.gz tk-be03330f5858260351f40d4c3dffb0363d358ee5.tar.bz2 |
Add new "hover" state
(patch from Pat Thoyts; needed to support proper visual feedback on Vista).
Diffstat (limited to 'generic/ttk')
-rw-r--r-- | generic/ttk/ttkState.c | 9 | ||||
-rw-r--r-- | generic/ttk/ttkTheme.h | 4 | ||||
-rw-r--r-- | generic/ttk/ttkWidget.c | 12 |
3 files changed, 21 insertions, 4 deletions
diff --git a/generic/ttk/ttkState.c b/generic/ttk/ttkState.c index 29a526d..693c5d7 100644 --- a/generic/ttk/ttkState.c +++ b/generic/ttk/ttkState.c @@ -1,5 +1,5 @@ /* - * $Id: ttkState.c,v 1.2 2008/11/02 09:54:02 nijtmans Exp $ + * $Id: ttkState.c,v 1.3 2008/12/03 18:44:49 jenglish Exp $ * * Tk widget state utilities. * @@ -27,6 +27,13 @@ static const char *const stateNames[] = "alternate", /* Widget-specific alternate display style */ "invalid", /* Bad value */ "readonly", /* Editing/modification disabled */ + "hover", /* Mouse cursor is over widget */ + "reserved1", /* Reserved for future extension */ + "reserved2", /* Reserved for future extension */ + "reserved3", /* Reserved for future extension */ + "user3", /* User-definable state */ + "user2", /* User-definable state */ + "user1", /* User-definable state */ NULL }; diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h index f054181..01a1571 100644 --- a/generic/ttk/ttkTheme.h +++ b/generic/ttk/ttkTheme.h @@ -1,4 +1,4 @@ -/* $Id: ttkTheme.h,v 1.15 2008/11/02 09:54:02 nijtmans Exp $ +/* $Id: ttkTheme.h,v 1.16 2008/12/03 18:44:49 jenglish Exp $ * Copyright (c) 2003 Joe English. Freely redistributable. * * Declarations for Tk theme engine. @@ -48,7 +48,7 @@ typedef unsigned int Ttk_State; #define TTK_STATE_ALTERNATE (1<<6) #define TTK_STATE_INVALID (1<<7) #define TTK_STATE_READONLY (1<<8) -#define TTK_STATE_USER7 (1<<9) +#define TTK_STATE_HOVER (1<<9) #define TTK_STATE_USER6 (1<<10) #define TTK_STATE_USER5 (1<<11) #define TTK_STATE_USER4 (1<<12) diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index 9f8e0a4..820d3d8 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -1,4 +1,4 @@ -/* $Id: ttkWidget.c,v 1.19 2008/11/16 17:14:16 jenglish Exp $ +/* $Id: ttkWidget.c,v 1.20 2008/12/03 18:44:50 jenglish Exp $ * Copyright (c) 2003, Joe English * * Core widget utilities. @@ -281,6 +281,8 @@ static const unsigned CoreEventMask | FocusChangeMask | VirtualEventMask | ActivateMask + | EnterWindowMask + | LeaveWindowMask ; static void CoreEventProc(ClientData clientData, XEvent *eventPtr) @@ -324,6 +326,14 @@ static void CoreEventProc(ClientData clientData, XEvent *eventPtr) corePtr->state |= TTK_STATE_BACKGROUND; TtkRedisplayWidget(corePtr); break; + case LeaveNotify: + corePtr->state &= ~TTK_STATE_HOVER; + TtkRedisplayWidget(corePtr); + break; + case EnterNotify: + corePtr->state |= TTK_STATE_HOVER; + TtkRedisplayWidget(corePtr); + break; case VirtualEvent: if (!strcmp("ThemeChanged", ((XVirtualEvent *)(eventPtr))->name)) { (void)UpdateLayout(corePtr->interp, corePtr); |