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:
Richard Frith-MacDonald 2006-10-02 08:42:04 +00:00
parent 3005771e57
commit c201ae734e
6 changed files with 50 additions and 24 deletions

View file

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