mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 06:50:38 +00:00
Added more of the implementation for toolbar/toolbaritem. Added check in GSClassSwapper to prevent an error case.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17532 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
577c9532e6
commit
a32c4a14df
8 changed files with 173 additions and 40 deletions
|
@ -38,19 +38,12 @@
|
|||
#include "AppKit/NSView.h"
|
||||
#include "AppKit/NSButton.h"
|
||||
#include "AppKit/NSNibLoading.h"
|
||||
#include "GNUstepGUI/GSToolbarView.h"
|
||||
|
||||
// internal
|
||||
static NSNotificationCenter *nc = nil;
|
||||
static const int current_version = 1;
|
||||
|
||||
@interface GSToolbarView : NSView
|
||||
{
|
||||
NSToolbar *_toolbar;
|
||||
}
|
||||
- (void) setToolbar: (NSToolbar *)toolbar;
|
||||
- (NSToolbar *) toolbar;
|
||||
@end
|
||||
|
||||
@implementation GSToolbarView
|
||||
- (void) dealloc
|
||||
{
|
||||
|
@ -61,6 +54,7 @@ static const int current_version = 1;
|
|||
- (void) setToolbar: (NSToolbar *)toolbar
|
||||
{
|
||||
ASSIGN(_toolbar, toolbar);
|
||||
|
||||
}
|
||||
- (NSToolbar *) toolbar
|
||||
{
|
||||
|
@ -69,7 +63,23 @@ static const int current_version = 1;
|
|||
|
||||
- (void) drawRect: (NSRect)aRect
|
||||
{
|
||||
NSArray *items = [_toolbar items];
|
||||
NSEnumerator *en = [items objectEnumerator];
|
||||
id item = nil;
|
||||
float x = 0;
|
||||
|
||||
[super drawRect: aRect];
|
||||
while((item = [en nextObject]) != nil)
|
||||
{
|
||||
NSView *itemView = [item view];
|
||||
NSRect itemFrame = [itemView frame];
|
||||
|
||||
// now we need to draw the items...
|
||||
itemFrame.origin.x = x; // start at x
|
||||
itemFrame.origin.y = 0; // reset to top of view.
|
||||
[itemView drawRect: itemFrame];
|
||||
x += NSWidth(itemFrame) + 2; // move over by the frame width plus 2 pixels.
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
|
@ -101,13 +111,12 @@ static const int current_version = 1;
|
|||
@end
|
||||
|
||||
@implementation NSToolbar (GNUstepPrivate)
|
||||
- (GSToolbarView *) _toolbarView
|
||||
- (id) _toolbarView
|
||||
{
|
||||
return _toolbarView;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation NSToolbar
|
||||
// Initialize the class when it is loaded
|
||||
+ (void) initialize
|
||||
|
@ -309,5 +318,3 @@ static const int current_version = 1;
|
|||
return _visibleItems;
|
||||
}
|
||||
@end /* interface of NSToolbar */
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue