mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
* Headers/Additions/GNUstepGUI/GSHelpManagerPanel.h: added -buttonAction:
method. * Source/GSHelpManagerPanel.m: implemented -buttonAction:. added a button to close the panel and changed the style mask of the window to NSTitledWindowMask | NSResizableWindowMask. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23171 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
30dc6bf85a
commit
acf57e2b37
3 changed files with 45 additions and 15 deletions
|
@ -1,3 +1,11 @@
|
|||
2006-07-16 Enrico Sersale <enrico@fibernet.ro>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSHelpManagerPanel.h: added -buttonAction:
|
||||
method.
|
||||
* Source/GSHelpManagerPanel.m: implemented -buttonAction:.
|
||||
added a button to close the panel and changed the style mask of the window
|
||||
to NSTitledWindowMask | NSResizableWindowMask.
|
||||
|
||||
2006-07-15 Enrico Sersale <enrico@fibernet.ro>
|
||||
|
||||
* Headers/AppKit/AppKit.h: added NSHelpManager.h.
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
|
||||
-(void)setHelpText: (NSAttributedString*)helpText;
|
||||
|
||||
- (void)buttonAction:(id)sender;
|
||||
|
||||
@end
|
||||
|
||||
#endif // _GNUstep_H_GSHelpManagerPanel
|
||||
|
|
|
@ -30,10 +30,12 @@
|
|||
#include "AppKit/NSTextView.h"
|
||||
#include "AppKit/NSTextContainer.h"
|
||||
#include "AppKit/NSScrollView.h"
|
||||
#include "AppKit/NSButton.h"
|
||||
#include "AppKit/NSClipView.h"
|
||||
#include "AppKit/NSColor.h"
|
||||
|
||||
#include "AppKit/NSImage.h"
|
||||
#include "GNUstepGUI/GSHelpManagerPanel.h"
|
||||
#include "GSGuiPrivate.h"
|
||||
|
||||
@implementation GSHelpManagerPanel
|
||||
|
||||
|
@ -49,29 +51,27 @@ static GSHelpManagerPanel* _GSsharedGSHelpPanel;
|
|||
|
||||
- (id)init
|
||||
{
|
||||
NSRect winRect = {{100, 100}, {470, 150}};
|
||||
unsigned int style = NSTitledWindowMask | NSClosableWindowMask
|
||||
| NSMiniaturizableWindowMask | NSResizableWindowMask;
|
||||
|
||||
self = [super initWithContentRect: winRect
|
||||
styleMask: style
|
||||
self = [super initWithContentRect: NSMakeRect(100, 100, 470, 200)
|
||||
styleMask: NSTitledWindowMask | NSResizableWindowMask
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO];
|
||||
|
||||
if (self) {
|
||||
NSRect scrollViewRect = {{0, 0}, {470, 150}};
|
||||
NSRect scrollViewRect = {{8, 40}, {454, 152}};
|
||||
NSRect buttonRect = {{390, 6}, {72, 27}};
|
||||
NSRect r;
|
||||
NSScrollView *scrollView;
|
||||
|
||||
NSButton *button;
|
||||
|
||||
[self setReleasedWhenClosed: NO];
|
||||
[self setFloatingPanel: YES];
|
||||
// [self setTitle: NSLocalizedString(@"Help", @"")];
|
||||
[self setTitle: @"Help"];
|
||||
[self setTitle: NSLocalizedString(@"Help", @"")];
|
||||
|
||||
scrollView = [[NSScrollView alloc] initWithFrame: scrollViewRect];
|
||||
[scrollView setBorderType: NSBezelBorder];
|
||||
[scrollView setHasHorizontalScroller: NO];
|
||||
[scrollView setHasVerticalScroller: YES];
|
||||
[scrollView setAutoresizingMask: NSViewHeightSizable];
|
||||
[scrollView setAutoresizingMask: NSViewHeightSizable | NSViewWidthSizable];
|
||||
|
||||
r = [[scrollView contentView] frame];
|
||||
textView = [[NSTextView alloc] initWithFrame: r];
|
||||
|
@ -86,13 +86,28 @@ static GSHelpManagerPanel* _GSsharedGSHelpPanel;
|
|||
[[textView textContainer] setContainerSize: NSMakeSize(r.size.width, 1e7)];
|
||||
[[textView textContainer] setWidthTracksTextView: YES];
|
||||
[textView setUsesRuler: NO];
|
||||
// [textView setBackgroundColor: [NSColor colorWithCalibratedWhite: 0.85 alpha: 1.0]];
|
||||
|
||||
[scrollView setDocumentView: textView];
|
||||
RELEASE(textView);
|
||||
RELEASE (textView);
|
||||
|
||||
[[self contentView] addSubview: scrollView];
|
||||
RELEASE(scrollView);
|
||||
RELEASE (scrollView);
|
||||
|
||||
button = [[NSButton alloc] initWithFrame: buttonRect];
|
||||
[button setAutoresizingMask: NSViewMinXMargin | NSViewMaxYMargin];
|
||||
[button setButtonType: NSMomentaryLight];
|
||||
[button setTitle: NSLocalizedString(@"OK", @"")];
|
||||
[button setKeyEquivalent: @"\r"];
|
||||
[button setImagePosition: NSImageRight];
|
||||
[button setImage: [NSImage imageNamed: @"common_ret"]];
|
||||
[button setAlternateImage: [NSImage imageNamed: @"common_retH"]];
|
||||
[button setTarget: self];
|
||||
[button setAction: @selector(buttonAction:)];
|
||||
|
||||
[[self contentView] addSubview: button];
|
||||
RELEASE (button);
|
||||
|
||||
[self makeFirstResponder: button];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -103,6 +118,11 @@ static GSHelpManagerPanel* _GSsharedGSHelpPanel;
|
|||
[[textView textStorage] setAttributedString: helpText];
|
||||
}
|
||||
|
||||
- (void)buttonAction:(id)sender
|
||||
{
|
||||
[self close];
|
||||
}
|
||||
|
||||
- (void) close
|
||||
{
|
||||
if ([self isVisible])
|
||||
|
|
Loading…
Reference in a new issue