Add support for the context help cursor.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23708 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2006-10-02 08:42:04 +00:00
parent d40a3d4a05
commit 154961d6a3
6 changed files with 50 additions and 24 deletions

View file

@ -4,9 +4,13 @@
Make themes in panel be in alphabetical order except for the Make themes in panel be in alphabetical order except for the
default theme (always first in the list). default theme (always first in the list).
Allow setting of default theme for application. Allow setting of default theme for application.
* Source/NSHelpManager.m: * Source/NSHelpManager.m: Implement context help cursor.
* Source/NSHelpPanel.m: Implement simple fallback help panel display * Source/NSHelpPanel.m: Implement simple fallback help panel display
for systems where no rtf/rtfd viewing application is installed. for systems where no rtf/rtfd viewing application is installed.
* Source/NSResponder.m: Tweak context help
* Source/NSCursor.m: tidied a little
* Images/GNUmakefile: Install context help cursor
* Images/common_HelpCursor.tiff: add context help cursor
2006-09-30 Richard Frith-Macdonald <rfm@gnu.org> 2006-09-30 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -19,7 +19,8 @@
# #
# You should have received a copy of the GNU Library General Public # You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free # License along with this library; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. # Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02111 USA.
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT) GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
@ -50,6 +51,7 @@ common_CloseBroken.tiff \
common_CloseBrokenH.tiff \ common_CloseBrokenH.tiff \
common_ColorSwatch.tiff \ common_ColorSwatch.tiff \
common_2DDash.tiff \ common_2DDash.tiff \
common_HelpCursor.tiff \
common_Home.tiff \ common_Home.tiff \
common_HomeDirectory.tiff \ common_HomeDirectory.tiff \
common_Mount.tiff \ common_Mount.tiff \

Binary file not shown.

View file

@ -353,7 +353,7 @@ backgroundColorHint:(NSColor *)bg
} }
return cursor; return cursor;
} }
- (void)dealloc - (void) dealloc
{ {
RELEASE (_cursor_image); RELEASE (_cursor_image);
[super dealloc]; [super dealloc];
@ -550,8 +550,10 @@ backgroundColorHint:(NSColor *)bg
} }
else else
{ {
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_set_on_mouse_entered]; [aDecoder decodeValueOfObjCType: @encode(BOOL)
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_set_on_mouse_exited]; at: &_is_set_on_mouse_entered];
[aDecoder decodeValueOfObjCType: @encode(BOOL)
at: &_is_set_on_mouse_exited];
_cursor_image = [aDecoder decodeObject]; _cursor_image = [aDecoder decodeObject];
_hot_spot = [aDecoder decodePoint]; _hot_spot = [aDecoder decodePoint];
[self _computeCid]; [self _computeCid];

View file

@ -39,6 +39,8 @@
#include "AppKit/NSHelpManager.h" #include "AppKit/NSHelpManager.h"
#include "AppKit/NSHelpPanel.h" #include "AppKit/NSHelpPanel.h"
#include "AppKit/NSHelpPanel.h" #include "AppKit/NSHelpPanel.h"
#include "AppKit/NSCursor.h"
#include "AppKit/NSImage.h"
#include "AppKit/NSGraphics.h" #include "AppKit/NSGraphics.h"
#include "AppKit/NSScrollView.h" #include "AppKit/NSScrollView.h"
#include "AppKit/NSTextView.h" #include "AppKit/NSTextView.h"
@ -262,6 +264,7 @@
static NSHelpManager *_gnu_sharedHelpManager = nil; static NSHelpManager *_gnu_sharedHelpManager = nil;
static BOOL _gnu_contextHelpActive = NO; static BOOL _gnu_contextHelpActive = NO;
static NSCursor *helpCursor = nil;
// //
@ -284,18 +287,31 @@ static BOOL _gnu_contextHelpActive = NO;
+ (void) setContextHelpModeActive: (BOOL) flag + (void) setContextHelpModeActive: (BOOL) flag
{ {
_gnu_contextHelpActive = flag; if (flag != _gnu_contextHelpActive)
if (flag)
{ {
[[NSNotificationCenter defaultCenter] _gnu_contextHelpActive = flag;
postNotificationName: NSContextHelpModeDidActivateNotification if (flag)
object: [self sharedHelpManager]]; {
} if (helpCursor == nil)
else {
{ helpCursor = [[NSCursor alloc]
[[NSNotificationCenter defaultCenter] initWithImage: [NSImage imageNamed: @"common_HelpCursor"]
postNotificationName: NSContextHelpModeDidDeactivateNotification hotSpot: NSMakePoint(8, 2)];
object: [self sharedHelpManager]]; [helpCursor setOnMouseEntered: NO];
[helpCursor setOnMouseExited: NO];
}
[helpCursor push];
[[NSNotificationCenter defaultCenter]
postNotificationName: NSContextHelpModeDidActivateNotification
object: [self sharedHelpManager]];
}
else
{
[helpCursor pop];
[[NSNotificationCenter defaultCenter]
postNotificationName: NSContextHelpModeDidDeactivateNotification
object: [self sharedHelpManager]];
}
} }
} }

View file

@ -180,14 +180,16 @@
- (void) helpRequested: (NSEvent*)theEvent - (void) helpRequested: (NSEvent*)theEvent
{ {
if (![[NSHelpManager sharedHelpManager] if ([[NSHelpManager sharedHelpManager]
showContextHelpForObject: self showContextHelpForObject: self
locationHint: [theEvent locationInWindow]]) locationHint: [theEvent locationInWindow]] == NO)
if (_next_responder) {
{ if (_next_responder)
[_next_responder helpRequested: theEvent]; {
return; [_next_responder helpRequested: theEvent];
} return;
}
}
[NSHelpManager setContextHelpModeActive: NO]; [NSHelpManager setContextHelpModeActive: NO];
} }