mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 10:01:56 +00:00
* Headers/AppKit/AppKit.h: Add NSPopover.h to set of files
included. * Headers/AppKit/NSApplication.h: Add NSApplicationDelegate. Inherit from GSAppDelegateProtocol. * Headers/AppKit/NSPopover.h: NSPopover header. * Source/GNUmakefile: Added NSPopover.[hm] * Source/GSXibLoader.m: Translate NSCustomView to NSView when unarchiving. * Source/NSPopover.m: Skeletal implementation of NSPopover.m. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36552 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ab56e573e7
commit
8df483e637
7 changed files with 330 additions and 0 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2013-04-21 09:26-EDT Gregory John Casamento <greg.casamento@gmail.com>
|
||||||
|
|
||||||
|
* Headers/AppKit/AppKit.h: Add NSPopover.h to set of files
|
||||||
|
included.
|
||||||
|
* Headers/AppKit/NSApplication.h: Add NSApplicationDelegate.
|
||||||
|
Inherit from GSAppDelegateProtocol.
|
||||||
|
* Headers/AppKit/NSPopover.h: NSPopover header.
|
||||||
|
* Source/GNUmakefile: Added NSPopover.[hm]
|
||||||
|
* Source/GSXibLoader.m: Translate NSCustomView to NSView when
|
||||||
|
unarchiving.
|
||||||
|
* Source/NSPopover.m: Skeletal implementation of NSPopover.m.
|
||||||
|
|
||||||
2013-04-21 Fred Kiefer <FredKiefer@gmx.de>
|
2013-04-21 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSTableView.m (-selectedColumnIndexes, -selectedRowIndexes): Return an
|
* Source/NSTableView.m (-selectedColumnIndexes, -selectedRowIndexes): Return an
|
||||||
|
|
|
@ -91,6 +91,7 @@
|
||||||
#import <AppKit/NSPageLayout.h>
|
#import <AppKit/NSPageLayout.h>
|
||||||
#import <AppKit/NSPanel.h>
|
#import <AppKit/NSPanel.h>
|
||||||
#import <AppKit/NSPasteboard.h>
|
#import <AppKit/NSPasteboard.h>
|
||||||
|
#import <AppKit/NSPopover.h>
|
||||||
#import <AppKit/NSPopUpButton.h>
|
#import <AppKit/NSPopUpButton.h>
|
||||||
#import <AppKit/NSPopUpButtonCell.h>
|
#import <AppKit/NSPopUpButtonCell.h>
|
||||||
#import <AppKit/NSPrinter.h>
|
#import <AppKit/NSPrinter.h>
|
||||||
|
|
|
@ -650,6 +650,13 @@ APPKIT_EXPORT NSString *NSEventTrackingRunLoopMode;
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NSApplicationDelegate inherits from GSAppDelegateProtocol to
|
||||||
|
* avoid compiler warnings.
|
||||||
|
*/
|
||||||
|
@protocol NSApplicationDelegate <GSAppDelegateProtocol>
|
||||||
|
@end
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Notifications
|
* Notifications
|
||||||
*/
|
*/
|
||||||
|
|
117
Headers/AppKit/NSPopover.h
Normal file
117
Headers/AppKit/NSPopover.h
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
/*
|
||||||
|
NSPopover.h
|
||||||
|
|
||||||
|
The popover class
|
||||||
|
|
||||||
|
Copyright (C) 2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Author: Gregory Casamento <greg.casamento@gmail.com>
|
||||||
|
Date: 2013
|
||||||
|
|
||||||
|
This file is part of the GNUstep GUI Library.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; see the file COPYING.LIB.
|
||||||
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||||
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
#ifndef _GNUstep_H_NSPopover
|
||||||
|
#define _GNUstep_H_NSPopover
|
||||||
|
|
||||||
|
#include <Foundation/NSGeometry.h>
|
||||||
|
#include <AppKit/NSResponder.h>
|
||||||
|
|
||||||
|
/* Keys */
|
||||||
|
APPKIT_EXPORT NSString *NSPopoverCloseReasonKey;
|
||||||
|
APPKIT_EXPORT NSString *NSPopoverCloseReasonStandard;
|
||||||
|
APPKIT_EXPORT NSString *NSPopoverCloseReasonDetachToWindow;
|
||||||
|
|
||||||
|
/* Notifications */
|
||||||
|
APPKIT_EXPORT NSString *NSPopoverWillShowNotification;
|
||||||
|
APPKIT_EXPORT NSString *NSPopoverDidShowNotification;
|
||||||
|
APPKIT_EXPORT NSString *NSPopoverWillCloseNotification;
|
||||||
|
APPKIT_EXPORT NSString *NSPopoverDidCloseNotification;
|
||||||
|
|
||||||
|
/* Constants and enums */
|
||||||
|
enum {
|
||||||
|
NSPopoverAppearanceMinimal = 0,
|
||||||
|
NSPopoverAppearanceHUD = 1
|
||||||
|
};
|
||||||
|
typedef NSInteger NSPopoverAppearance;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
NSPopoverBehaviorApplicationDefined = 0,
|
||||||
|
NSPopoverBehaviorTransient = 1,
|
||||||
|
NSPopoverBehaviorSemitransient = 2
|
||||||
|
};
|
||||||
|
typedef NSInteger NSPopoverBehavior;
|
||||||
|
|
||||||
|
/* Forward declarations */
|
||||||
|
@class NSViewController, NSWindow, NSView, NSNotification;
|
||||||
|
@protocol NSPopoverDelegate;
|
||||||
|
|
||||||
|
/* Class */
|
||||||
|
@interface NSPopover : NSResponder
|
||||||
|
{
|
||||||
|
BOOL _animates;
|
||||||
|
NSPopoverAppearance _appearance;
|
||||||
|
NSPopoverBehavior _behavior;
|
||||||
|
NSSize _contentSize;
|
||||||
|
IBOutlet NSViewController *_contentViewController;
|
||||||
|
id<NSPopoverDelegate> _delegate;
|
||||||
|
NSRect _positioningRect;
|
||||||
|
BOOL _shown;
|
||||||
|
|
||||||
|
NSWindow *_realWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Properties */
|
||||||
|
- (void)setAnimates:(BOOL)flag;
|
||||||
|
- (BOOL)animates;
|
||||||
|
- (void)setAppearance: (NSPopoverAppearance)value;
|
||||||
|
- (NSPopoverAppearance)appearance;
|
||||||
|
- (void)setBehavior:(NSPopoverBehavior)value;
|
||||||
|
- (NSPopoverBehavior)behavior;
|
||||||
|
- (void)setContentSize:(NSSize)value;
|
||||||
|
- (NSSize)contentSize;
|
||||||
|
- (void)setContentViewController:(NSViewController *)controller;
|
||||||
|
- (NSViewController *)contentViewController;
|
||||||
|
- (void)setDelegate:(id<NSPopoverDelegate>)value;
|
||||||
|
- (id<NSPopoverDelegate>)delegate;
|
||||||
|
- (void)setPositioningRect:(NSRect)value;
|
||||||
|
- (NSRect)positioningRect;
|
||||||
|
- (BOOL)isShown;
|
||||||
|
|
||||||
|
/* Methods */
|
||||||
|
- (void)close;
|
||||||
|
- (IBAction)performClose:(id)sender;
|
||||||
|
- (void)showRelativeToRect:(NSRect)positioningRect
|
||||||
|
ofView:(NSView *)positioningView
|
||||||
|
preferredEdge:(NSRectEdge)preferredEdge;
|
||||||
|
@end
|
||||||
|
|
||||||
|
/* Delegate */
|
||||||
|
@protocol NSPopoverDelegate
|
||||||
|
#ifdef __OBJC2__
|
||||||
|
@optional
|
||||||
|
- (NSWindow *)detachableWindowForPopover:(NSPopover *)popover;
|
||||||
|
- (void)popoverDidClose:(NSNotification *)notification;
|
||||||
|
- (void)popoverDidShow:(NSNotification *)notification;
|
||||||
|
- (void)popoverShouldClose:(NSNotification *)notification;
|
||||||
|
- (void)popoverWillClose:(NSNotification *)notification;
|
||||||
|
- (void)popoverWillShow:(NSNotification *)notification;
|
||||||
|
#endif
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
|
@ -132,6 +132,7 @@ NSOutlineView.m \
|
||||||
NSPageLayout.m \
|
NSPageLayout.m \
|
||||||
NSPanel.m \
|
NSPanel.m \
|
||||||
NSParagraphStyle.m \
|
NSParagraphStyle.m \
|
||||||
|
NSPopover.m \
|
||||||
NSPopUpButton.m \
|
NSPopUpButton.m \
|
||||||
NSPopUpButtonCell.m \
|
NSPopUpButtonCell.m \
|
||||||
NSPrinter.m \
|
NSPrinter.m \
|
||||||
|
@ -341,6 +342,7 @@ NSPageLayout.h \
|
||||||
NSPanel.h \
|
NSPanel.h \
|
||||||
NSParagraphStyle.h \
|
NSParagraphStyle.h \
|
||||||
NSPasteboard.h \
|
NSPasteboard.h \
|
||||||
|
NSPopover.h \
|
||||||
NSPopUpButton.h \
|
NSPopUpButton.h \
|
||||||
NSPopUpButtonCell.h \
|
NSPopUpButtonCell.h \
|
||||||
NSPrintInfo.h \
|
NSPrintInfo.h \
|
||||||
|
|
|
@ -1492,6 +1492,10 @@ didStartElement: (NSString*)elementName
|
||||||
if ([@"object" isEqualToString: elementName])
|
if ([@"object" isEqualToString: elementName])
|
||||||
{
|
{
|
||||||
NSString *classname = [element attributeForKey: @"class"];
|
NSString *classname = [element attributeForKey: @"class"];
|
||||||
|
if([classname isEqualToString:@"NSCustomView"])
|
||||||
|
{
|
||||||
|
classname = @"NSView"; // instantiate an NSView instead...
|
||||||
|
}
|
||||||
return [self decodeObjectForXib: element
|
return [self decodeObjectForXib: element
|
||||||
forClassName: classname
|
forClassName: classname
|
||||||
withID: objID];
|
withID: objID];
|
||||||
|
|
187
Source/NSPopover.m
Normal file
187
Source/NSPopover.m
Normal file
|
@ -0,0 +1,187 @@
|
||||||
|
/*
|
||||||
|
NSPopover.m
|
||||||
|
|
||||||
|
The popover class
|
||||||
|
|
||||||
|
Copyright (C) 2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Author: Gregory Casamento <greg.casamento@gmail.com>
|
||||||
|
Date: 2013
|
||||||
|
|
||||||
|
This file is part of the GNUstep GUI Library.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; see the file COPYING.LIB.
|
||||||
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||||
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||||
|
Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Foundation/NSArchiver.h>
|
||||||
|
#include <Foundation/NSKeyedArchiver.h>
|
||||||
|
#include <Foundation/NSNotification.h>
|
||||||
|
#include <AppKit/NSPopover.h>
|
||||||
|
#include <AppKit/NSViewController.h>
|
||||||
|
#include <AppKit/NSView.h>
|
||||||
|
|
||||||
|
/* Keys */
|
||||||
|
NSString *NSPopoverCloseReasonKey = @"NSPopoverCloseReasonKey";
|
||||||
|
NSString *NSPopoverCloseReasonStandard = @"NSPopoverCloseReasonStandard";
|
||||||
|
NSString *NSPopoverCloseReasonDetachToWindow = @"NSPopoverCloseReasonDetachToWindow";
|
||||||
|
|
||||||
|
/* Notifications */
|
||||||
|
NSString *NSPopoverWillShowNotification = @"NSPopoverWillShowNotification";
|
||||||
|
NSString *NSPopoverDidShowNotification = @"NSPopoverDidShowNotification";
|
||||||
|
NSString *NSPopoverWillCloseNotification = @"NSPopoverWillCloseNotification";
|
||||||
|
NSString *NSPopoverDidCloseNotification = @"NSPopoverDidCloseNotification";
|
||||||
|
|
||||||
|
/* Class */
|
||||||
|
@implementation NSPopover
|
||||||
|
|
||||||
|
/* Properties */
|
||||||
|
- (void)setAnimates:(BOOL)flag
|
||||||
|
{
|
||||||
|
_animates = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)animates
|
||||||
|
{
|
||||||
|
return _animates;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setAppearance: (NSPopoverAppearance)value
|
||||||
|
{
|
||||||
|
_appearance = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSPopoverAppearance)appearance
|
||||||
|
{
|
||||||
|
return _appearance;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setBehavior:(NSPopoverBehavior)value
|
||||||
|
{
|
||||||
|
_behavior = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSPopoverBehavior)behavior
|
||||||
|
{
|
||||||
|
return _behavior;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setContentSize:(NSSize)value
|
||||||
|
{
|
||||||
|
_contentSize = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSSize)contentSize
|
||||||
|
{
|
||||||
|
return _contentSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setContentViewController:(NSViewController *)controller
|
||||||
|
{
|
||||||
|
ASSIGN(_contentViewController,controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSViewController *)contentViewController
|
||||||
|
{
|
||||||
|
return _contentViewController;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setDelegate:(id<NSPopoverDelegate>)value
|
||||||
|
{
|
||||||
|
_delegate = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id<NSPopoverDelegate>)delegate
|
||||||
|
{
|
||||||
|
return _delegate;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setPositioningRect:(NSRect)value
|
||||||
|
{
|
||||||
|
_positioningRect = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSRect)positioningRect
|
||||||
|
{
|
||||||
|
return _positioningRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)isShown
|
||||||
|
{
|
||||||
|
return _shown;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Methods */
|
||||||
|
- (void)close
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (IBAction)performClose:(id)sender
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)showRelativeToRect:(NSRect)positioningRect
|
||||||
|
ofView:(NSView *)positioningView
|
||||||
|
preferredEdge:(NSRectEdge)preferredEdge
|
||||||
|
{
|
||||||
|
// NSLog(@"Test...");
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)initWithCoder:(NSCoder *)coder
|
||||||
|
{
|
||||||
|
if(nil != (self = [super initWithCoder:coder]))
|
||||||
|
{
|
||||||
|
if(YES == [coder allowsKeyedCoding])
|
||||||
|
{
|
||||||
|
_appearance = [coder decodeIntForKey:@"NSAppearance"];
|
||||||
|
_behavior = [coder decodeIntForKey:@"NSBehavior"];
|
||||||
|
_animates = [coder decodeBoolForKey:@"NSAnimates"];
|
||||||
|
_contentSize.width = [coder decodeDoubleForKey:@"NSContentWidth"];
|
||||||
|
_contentSize.height = [coder decodeDoubleForKey:@"NSContentHeight"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[coder decodeValueOfObjCType:@encode(NSInteger) at:&_appearance];
|
||||||
|
[coder decodeValueOfObjCType:@encode(NSInteger) at:&_behavior];
|
||||||
|
[coder decodeValueOfObjCType:@encode(BOOL) at:&_animates];
|
||||||
|
[coder decodeValueOfObjCType:@encode(CGFloat) at:&_contentSize.width];
|
||||||
|
[coder decodeValueOfObjCType:@encode(CGFloat) at:&_contentSize.height];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)encodeWithCoder:(NSCoder *)coder
|
||||||
|
{
|
||||||
|
[super encodeWithCoder:coder];
|
||||||
|
if(YES == [coder allowsKeyedCoding])
|
||||||
|
{
|
||||||
|
[coder encodeInt:_appearance forKey:@"NSAppearance"];
|
||||||
|
[coder encodeInt:_behavior forKey:@"NSBehavior"];
|
||||||
|
[coder encodeBool:_animates forKey:@"NSAnimates"];
|
||||||
|
[coder encodeDouble:_contentSize.width forKey:@"NSContentWidth"];
|
||||||
|
[coder encodeDouble:_contentSize.height forKey:@"NSContentHeight"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[coder encodeValueOfObjCType:@encode(NSInteger) at:&_appearance];
|
||||||
|
[coder encodeValueOfObjCType:@encode(NSInteger) at:&_behavior];
|
||||||
|
[coder encodeValueOfObjCType:@encode(BOOL) at:&_animates];
|
||||||
|
[coder encodeValueOfObjCType:@encode(CGFloat) at:&_contentSize.width];
|
||||||
|
[coder encodeValueOfObjCType:@encode(CGFloat) at:&_contentSize.height];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@end
|
Loading…
Add table
Add a link
Reference in a new issue