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

@ -4,9 +4,13 @@
Make themes in panel be in alphabetical order except for the
default theme (always first in the list).
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
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>

View file

@ -19,7 +19,8 @@
#
# You should have received a copy of the GNU Library General Public
# 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)
@ -50,6 +51,7 @@ common_CloseBroken.tiff \
common_CloseBrokenH.tiff \
common_ColorSwatch.tiff \
common_2DDash.tiff \
common_HelpCursor.tiff \
common_Home.tiff \
common_HomeDirectory.tiff \
common_Mount.tiff \

Binary file not shown.

View file

@ -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];

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]];
}
}
}

View file

@ -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];
}