mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 18:50:38 +00:00
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:
parent
3005771e57
commit
c201ae734e
6 changed files with 50 additions and 24 deletions
|
@ -353,7 +353,7 @@ backgroundColorHint:(NSColor *)bg
|
|||
}
|
||||
return cursor;
|
||||
}
|
||||
- (void)dealloc
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE (_cursor_image);
|
||||
[super dealloc];
|
||||
|
@ -550,8 +550,10 @@ backgroundColorHint:(NSColor *)bg
|
|||
}
|
||||
else
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_set_on_mouse_entered];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_set_on_mouse_exited];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL)
|
||||
at: &_is_set_on_mouse_entered];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL)
|
||||
at: &_is_set_on_mouse_exited];
|
||||
_cursor_image = [aDecoder decodeObject];
|
||||
_hot_spot = [aDecoder decodePoint];
|
||||
[self _computeCid];
|
||||
|
|
|
@ -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]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -180,14 +180,16 @@
|
|||
|
||||
- (void) helpRequested: (NSEvent*)theEvent
|
||||
{
|
||||
if (![[NSHelpManager sharedHelpManager]
|
||||
showContextHelpForObject: self
|
||||
locationHint: [theEvent locationInWindow]])
|
||||
if (_next_responder)
|
||||
{
|
||||
[_next_responder helpRequested: theEvent];
|
||||
return;
|
||||
}
|
||||
if ([[NSHelpManager sharedHelpManager]
|
||||
showContextHelpForObject: self
|
||||
locationHint: [theEvent locationInWindow]] == NO)
|
||||
{
|
||||
if (_next_responder)
|
||||
{
|
||||
[_next_responder helpRequested: theEvent];
|
||||
return;
|
||||
}
|
||||
}
|
||||
[NSHelpManager setContextHelpModeActive: NO];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue