mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:40:48 +00:00
Add new private header file with shared toolbar classes interfaces.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27503 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2358f07c43
commit
cf906c58bb
7 changed files with 216 additions and 227 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,6 +1,17 @@
|
||||||
2009-01-02 Fred Kiefer <FredKiefer@gmx.de>
|
2009-01-02 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSWindow+Toolbar.m,
|
* Headers/Additions/GNUstepGUI/GSToolbarView.h: Remove now
|
||||||
|
unneeded include of NSToolbar.h
|
||||||
|
* Source/NSToolbarFrameworkPrivate.h: New header file with shared
|
||||||
|
toolbar classes extensions.
|
||||||
|
* Source/NSWindow+Toolbar.m,
|
||||||
|
* Source/NSToolbar.m
|
||||||
|
* Source/NSToolbarItem.m
|
||||||
|
* Source/GSToolbarView.m: Use this new header file.
|
||||||
|
|
||||||
|
2009-01-02 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSWindow+Toolbar.m,
|
||||||
* Source/NSToolbar.m: Rewrote interaction with GSToolbarView.
|
* Source/NSToolbar.m: Rewrote interaction with GSToolbarView.
|
||||||
* Source/NSToolbar.m (_toolbarItemForIdentifier:): Fix memory leak.
|
* Source/NSToolbar.m (_toolbarItemForIdentifier:): Fix memory leak.
|
||||||
* Headers/Additions/GNUstepGUI/GSToolbarView.h,
|
* Headers/Additions/GNUstepGUI/GSToolbarView.h,
|
||||||
|
|
|
@ -33,14 +33,12 @@
|
||||||
#define _GSToolbarView_h_INCLUDE
|
#define _GSToolbarView_h_INCLUDE
|
||||||
|
|
||||||
#include <Foundation/NSGeometry.h>
|
#include <Foundation/NSGeometry.h>
|
||||||
// Necessary for NSToolbarDisplayMode and NSToolbarSizeMode
|
|
||||||
#include <AppKit/NSToolbar.h>
|
|
||||||
#include <AppKit/NSView.h>
|
#include <AppKit/NSView.h>
|
||||||
#include <AppKit/NSColor.h>
|
#include <AppKit/NSColor.h>
|
||||||
|
|
||||||
|
|
||||||
@class NSMutableArray;
|
@class NSMutableArray;
|
||||||
@class NSClipView;
|
@class NSClipView;
|
||||||
|
@class NSToolbar;
|
||||||
@class NSToolbarItem;
|
@class NSToolbarItem;
|
||||||
@class GSToolbarClippedItemsButton;
|
@class GSToolbarClippedItemsButton;
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,8 @@
|
||||||
#include "AppKit/NSWindow.h"
|
#include "AppKit/NSWindow.h"
|
||||||
#include "GNUstepGUI/GSToolbarView.h"
|
#include "GNUstepGUI/GSToolbarView.h"
|
||||||
|
|
||||||
|
#include "NSToolbarFrameworkPrivate.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ToolbarViewDefaultHeight = 62,
|
ToolbarViewDefaultHeight = 62,
|
||||||
ToolbarViewRegularHeight = 62,
|
ToolbarViewRegularHeight = 62,
|
||||||
|
@ -155,34 +157,6 @@ static void initSystemExtensionsColors(void)
|
||||||
/*
|
/*
|
||||||
* Toolbar related code
|
* Toolbar related code
|
||||||
*/
|
*/
|
||||||
@interface NSToolbar (GNUstepPrivate)
|
|
||||||
- (void) _build;
|
|
||||||
|
|
||||||
- (void) _concludeRemoveItem: (NSToolbarItem *)item
|
|
||||||
atIndex: (int)index
|
|
||||||
broadcast: (BOOL)broadcast;
|
|
||||||
- (int) _indexOfItem: (NSToolbarItem *)item;
|
|
||||||
- (void) _insertPassivelyItem: (NSToolbarItem *)item atIndex: (int)newIndex;
|
|
||||||
- (void) _moveItemFromIndex: (int)index
|
|
||||||
toIndex: (int)newIndex
|
|
||||||
broadcast: (BOOL)broacast;
|
|
||||||
|
|
||||||
- (void) _toolbarViewWillMoveToSuperview: (NSView *)newSuperview;
|
|
||||||
|
|
||||||
// Accessors
|
|
||||||
- (void) _setToolbarView: (GSToolbarView *)toolbarView;
|
|
||||||
- (GSToolbarView *) _toolbarView;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface NSToolbarItem (GNUstepPrivate)
|
|
||||||
- (void) _layout;
|
|
||||||
|
|
||||||
// Accessors
|
|
||||||
- (NSView *) _backView;
|
|
||||||
- (NSMenuItem *) _defaultMenuFormRepresentation;
|
|
||||||
- (BOOL) _isModified;
|
|
||||||
- (BOOL) _isFlexibleSpace;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface GSToolbarButton
|
@interface GSToolbarButton
|
||||||
- (NSToolbarItem *) toolbarItem;
|
- (NSToolbarItem *) toolbarItem;
|
||||||
|
@ -192,20 +166,6 @@ static void initSystemExtensionsColors(void)
|
||||||
- (NSToolbarItem *) toolbarItem;
|
- (NSToolbarItem *) toolbarItem;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GSToolbarView (GNUstepPrivate)
|
|
||||||
- (void) _handleBackViewsFrame;
|
|
||||||
- (void) _handleViewsVisibility;
|
|
||||||
- (void) _reload;
|
|
||||||
- (void) _takeInAccountFlexibleSpaces;
|
|
||||||
- (int) _insertionIndexAtPoint: (NSPoint)location;
|
|
||||||
|
|
||||||
// Accessors
|
|
||||||
- (float) _heightFromLayout;
|
|
||||||
- (NSArray *) _visibleBackViews;
|
|
||||||
- (BOOL) _usesStandardBackgroundColor;
|
|
||||||
- (void) _setUsesStandardBackgroundColor: (BOOL)standard;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface GSToolbarClippedItemsButton : NSButton
|
@interface GSToolbarClippedItemsButton : NSButton
|
||||||
{
|
{
|
||||||
NSToolbar *_toolbar;
|
NSToolbar *_toolbar;
|
||||||
|
@ -374,6 +334,25 @@ static void initSystemExtensionsColors(void)
|
||||||
|
|
||||||
// Dragging related methods
|
// Dragging related methods
|
||||||
|
|
||||||
|
- (int) _insertionIndexAtPoint: (NSPoint)location
|
||||||
|
{
|
||||||
|
id hitView = [self hitTest: location];
|
||||||
|
NSRect hitViewFrame = [hitView frame];
|
||||||
|
int index;
|
||||||
|
|
||||||
|
if ((hitView != nil)
|
||||||
|
&& ([hitView isKindOfClass: NSClassFromString(@"GSToolbarButton")]
|
||||||
|
|| [hitView isKindOfClass: NSClassFromString(@"GSToolbarBackView")]))
|
||||||
|
{
|
||||||
|
index = [_toolbar _indexOfItem: [hitView toolbarItem]];
|
||||||
|
if (location.x - hitViewFrame.origin.x > hitViewFrame.size.width / 2)
|
||||||
|
index++;
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
return NSNotFound;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSDragOperation) draggingEntered: (id <NSDraggingInfo>)info
|
- (NSDragOperation) draggingEntered: (id <NSDraggingInfo>)info
|
||||||
{
|
{
|
||||||
NSToolbar *toolbar = [self toolbar];
|
NSToolbar *toolbar = [self toolbar];
|
||||||
|
@ -646,6 +625,63 @@ static void initSystemExtensionsColors(void)
|
||||||
_heightFromLayout = newHeight;
|
_heightFromLayout = newHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) _takeInAccountFlexibleSpaces
|
||||||
|
{
|
||||||
|
NSArray *items = [_toolbar items];
|
||||||
|
NSEnumerator *e = [items objectEnumerator];
|
||||||
|
NSToolbarItem *item;
|
||||||
|
NSView *backView;
|
||||||
|
NSRect lastBackViewFrame;
|
||||||
|
float lengthAvailable;
|
||||||
|
unsigned int flexibleSpaceItemsNumber = 0;
|
||||||
|
BOOL mustAdjustNext = NO;
|
||||||
|
float x = 0;
|
||||||
|
|
||||||
|
if ([items count] == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lastBackViewFrame = [[[items lastObject] _backView] frame];
|
||||||
|
lengthAvailable = [self frame].size.width - NSMaxX(lastBackViewFrame);
|
||||||
|
|
||||||
|
if (lengthAvailable < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
while ((item = [e nextObject]) != nil)
|
||||||
|
{
|
||||||
|
if ([item _isFlexibleSpace])
|
||||||
|
{
|
||||||
|
flexibleSpaceItemsNumber++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lengthAvailable < flexibleSpaceItemsNumber)
|
||||||
|
return;
|
||||||
|
|
||||||
|
e = [items objectEnumerator];
|
||||||
|
while ((item = [e nextObject]) != nil)
|
||||||
|
{
|
||||||
|
backView = [item _backView];
|
||||||
|
if ([item _isFlexibleSpace])
|
||||||
|
{
|
||||||
|
NSRect backViewFrame = [backView frame];
|
||||||
|
|
||||||
|
[backView setFrame: NSMakeRect(x, backViewFrame.origin.y,
|
||||||
|
lengthAvailable / flexibleSpaceItemsNumber,
|
||||||
|
backViewFrame.size.height)];
|
||||||
|
mustAdjustNext = YES;
|
||||||
|
}
|
||||||
|
else if (mustAdjustNext)
|
||||||
|
{
|
||||||
|
NSRect backViewFrame = [backView frame];
|
||||||
|
|
||||||
|
[backView setFrame: NSMakeRect(x, backViewFrame.origin.y,
|
||||||
|
backViewFrame.size.width, backViewFrame.size.height)];
|
||||||
|
}
|
||||||
|
x += [backView frame].size.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
- (void) _handleViewsVisibility
|
- (void) _handleViewsVisibility
|
||||||
{
|
{
|
||||||
NSArray *items = [_toolbar items];
|
NSArray *items = [_toolbar items];
|
||||||
|
@ -752,82 +788,6 @@ static void initSystemExtensionsColors(void)
|
||||||
[self setNeedsDisplay: YES];
|
[self setNeedsDisplay: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) _takeInAccountFlexibleSpaces
|
|
||||||
{
|
|
||||||
NSArray *items = [_toolbar items];
|
|
||||||
NSEnumerator *e = [items objectEnumerator];
|
|
||||||
NSToolbarItem *item;
|
|
||||||
NSView *backView;
|
|
||||||
NSRect lastBackViewFrame;
|
|
||||||
float lengthAvailable;
|
|
||||||
unsigned int flexibleSpaceItemsNumber = 0;
|
|
||||||
BOOL mustAdjustNext = NO;
|
|
||||||
float x = 0;
|
|
||||||
|
|
||||||
if ([items count] == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
lastBackViewFrame = [[[items lastObject] _backView] frame];
|
|
||||||
lengthAvailable = [self frame].size.width - NSMaxX(lastBackViewFrame);
|
|
||||||
|
|
||||||
if (lengthAvailable < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
while ((item = [e nextObject]) != nil)
|
|
||||||
{
|
|
||||||
if ([item _isFlexibleSpace])
|
|
||||||
{
|
|
||||||
flexibleSpaceItemsNumber++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lengthAvailable < flexibleSpaceItemsNumber)
|
|
||||||
return;
|
|
||||||
|
|
||||||
e = [items objectEnumerator];
|
|
||||||
while ((item = [e nextObject]) != nil)
|
|
||||||
{
|
|
||||||
backView = [item _backView];
|
|
||||||
if ([item _isFlexibleSpace])
|
|
||||||
{
|
|
||||||
NSRect backViewFrame = [backView frame];
|
|
||||||
|
|
||||||
[backView setFrame: NSMakeRect(x, backViewFrame.origin.y,
|
|
||||||
lengthAvailable / flexibleSpaceItemsNumber,
|
|
||||||
backViewFrame.size.height)];
|
|
||||||
mustAdjustNext = YES;
|
|
||||||
}
|
|
||||||
else if (mustAdjustNext)
|
|
||||||
{
|
|
||||||
NSRect backViewFrame = [backView frame];
|
|
||||||
|
|
||||||
[backView setFrame: NSMakeRect(x, backViewFrame.origin.y,
|
|
||||||
backViewFrame.size.width, backViewFrame.size.height)];
|
|
||||||
}
|
|
||||||
x += [backView frame].size.width;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
- (int) _insertionIndexAtPoint: (NSPoint)location
|
|
||||||
{
|
|
||||||
id hitView = [self hitTest: location];
|
|
||||||
NSRect hitViewFrame = [hitView frame];
|
|
||||||
int index;
|
|
||||||
|
|
||||||
if ((hitView != nil)
|
|
||||||
&& ([hitView isKindOfClass: NSClassFromString(@"GSToolbarButton")]
|
|
||||||
|| [hitView isKindOfClass: NSClassFromString(@"GSToolbarBackView")]))
|
|
||||||
{
|
|
||||||
index = [_toolbar _indexOfItem: [hitView toolbarItem]];
|
|
||||||
if (location.x - hitViewFrame.origin.x > hitViewFrame.size.width / 2)
|
|
||||||
index++;
|
|
||||||
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
return NSNotFound;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Accessors private methods
|
// Accessors private methods
|
||||||
|
|
||||||
- (float) _heightFromLayout
|
- (float) _heightFromLayout
|
||||||
|
|
|
@ -52,6 +52,8 @@
|
||||||
#include "GNUstepGUI/GSToolbarView.h"
|
#include "GNUstepGUI/GSToolbarView.h"
|
||||||
#include "AppKit/NSToolbar.h"
|
#include "AppKit/NSToolbar.h"
|
||||||
|
|
||||||
|
#include "NSToolbarFrameworkPrivate.h"
|
||||||
|
|
||||||
// internal
|
// internal
|
||||||
static NSNotificationCenter *nc = nil;
|
static NSNotificationCenter *nc = nil;
|
||||||
static NSMutableArray *toolbars = nil;
|
static NSMutableArray *toolbars = nil;
|
||||||
|
@ -467,68 +469,6 @@ static GSValidationCenter *vc = nil;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface NSToolbar (GNUstepPrivate)
|
|
||||||
// Private class method
|
|
||||||
+ (NSArray *) _toolbarsWithIdentifier: (NSString *)identifier;
|
|
||||||
|
|
||||||
// Private methods with broadcast support
|
|
||||||
- (void) _insertItemWithItemIdentifier: (NSString *)itemIdentifier
|
|
||||||
atIndex: (int)index
|
|
||||||
broadcast: (BOOL)broadcast;
|
|
||||||
- (void) _removeItemAtIndex: (int)index broadcast: (BOOL)broadcast;
|
|
||||||
- (void) _setAllowsUserCustomization: (BOOL)flag broadcast: (BOOL)broadcast;
|
|
||||||
- (void) _setAutosavesConfiguration: (BOOL)flag broadcast: (BOOL)broadcast;
|
|
||||||
- (void) _setConfigurationFromDictionary: (NSDictionary *)configDict
|
|
||||||
broadcast: (BOOL)broadcast;
|
|
||||||
- (void) _moveItemFromIndex: (int)index toIndex: (int)newIndex broadcast: (BOOL)broadcast;
|
|
||||||
- (void) _setDisplayMode: (NSToolbarDisplayMode)displayMode
|
|
||||||
broadcast: (BOOL)broadcast;
|
|
||||||
- (void) _setSizeMode: (NSToolbarSizeMode)sizeMode
|
|
||||||
broadcast: (BOOL)broadcast;
|
|
||||||
- (void) _setVisible: (BOOL)shown broadcast: (BOOL)broadcast;
|
|
||||||
|
|
||||||
// Few other private methods
|
|
||||||
- (void) _build;
|
|
||||||
- (int) _indexOfItem: (NSToolbarItem *)item;
|
|
||||||
- (void) _insertPassivelyItem: (NSToolbarItem *)item atIndex: (int)newIndex;
|
|
||||||
- (void) _performRemoveItem: (NSToolbarItem *)item;
|
|
||||||
- (void) _concludeRemoveItem: (NSToolbarItem *)item atIndex: (int)index broadcast: (BOOL)broadcast;
|
|
||||||
- (void) _loadConfig;
|
|
||||||
- (NSToolbarItem *) _toolbarItemForIdentifier: (NSString *)itemIdent;
|
|
||||||
- (NSToolbar *) _toolbarModel;
|
|
||||||
- (void) _validate: (NSWindow *)observedWindow;
|
|
||||||
- (void) _toolbarViewWillMoveToSuperview: (NSView *)newSuperview;
|
|
||||||
|
|
||||||
// Accessors
|
|
||||||
- (void) _setToolbarView: (GSToolbarView *)toolbarView;
|
|
||||||
- (GSToolbarView *) _toolbarView;
|
|
||||||
|
|
||||||
- (void) setUsesStandardBackgroundColor: (BOOL)standard;
|
|
||||||
- (BOOL) usesStandardBackgroundColor;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface NSToolbarItem (GNUstepPrivate)
|
|
||||||
- (BOOL) _selectable;
|
|
||||||
- (void) _setSelectable: (BOOL)selectable;
|
|
||||||
- (BOOL) _selected;
|
|
||||||
- (void) _setSelected: (BOOL)selected;
|
|
||||||
- (void) _setToolbar: (NSToolbar *)toolbar;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface GSToolbarView (GNUstepPrivate)
|
|
||||||
- (void) _reload;
|
|
||||||
|
|
||||||
// Accessors
|
|
||||||
- (NSArray *) _visibleBackViews;
|
|
||||||
- (BOOL) _usesStandardBackgroundColor;
|
|
||||||
- (void) _setUsesStandardBackgroundColor: (BOOL)standard;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface NSWindow (ToolbarPrivate)
|
|
||||||
- (void) _adjustToolbarView: (GSToolbarView*)view;
|
|
||||||
@end
|
|
||||||
|
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
@implementation NSToolbar
|
@implementation NSToolbar
|
||||||
|
|
118
Source/NSToolbarFrameworkPrivate.h
Normal file
118
Source/NSToolbarFrameworkPrivate.h
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
/*
|
||||||
|
<title>NSToolbarFrameworkPrivate.h</title>
|
||||||
|
|
||||||
|
<abstract>Private methods used throughout the toolbar classes.</abstract>
|
||||||
|
|
||||||
|
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||||
|
Date: January 2009
|
||||||
|
|
||||||
|
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 _NSToolbarFrameworkPrivate_h_INCLUDE
|
||||||
|
#define _NSToolbarFrameworkPrivate_h_INCLUDE
|
||||||
|
|
||||||
|
#include "AppKit/NSToolbar.h"
|
||||||
|
#include "AppKit/NSToolbarItem.h"
|
||||||
|
#include "AppKit/NSWindow+Toolbar.h"
|
||||||
|
#include "GNUstepGUI/GSToolbarView.h"
|
||||||
|
|
||||||
|
@interface GSToolbarView (GNUstepPrivate)
|
||||||
|
- (void) _reload;
|
||||||
|
|
||||||
|
// Accessors
|
||||||
|
- (float) _heightFromLayout;
|
||||||
|
- (NSArray *) _visibleBackViews;
|
||||||
|
|
||||||
|
- (BOOL) _usesStandardBackgroundColor;
|
||||||
|
- (void) _setUsesStandardBackgroundColor: (BOOL)standard;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSToolbarItem (GNUstepPrivate)
|
||||||
|
- (void) _layout;
|
||||||
|
- (void) _computeFlags;
|
||||||
|
|
||||||
|
// Accessors
|
||||||
|
- (NSView *) _backView;
|
||||||
|
- (NSMenuItem *) _defaultMenuFormRepresentation;
|
||||||
|
- (BOOL) _isModified;
|
||||||
|
- (BOOL) _isFlexibleSpace;
|
||||||
|
- (BOOL) _selectable;
|
||||||
|
- (void) _setSelectable: (BOOL)selectable;
|
||||||
|
- (BOOL) _selected;
|
||||||
|
- (void) _setSelected: (BOOL)selected;
|
||||||
|
- (void) _setToolbar: (NSToolbar *)toolbar;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSToolbar (GNUstepPrivate)
|
||||||
|
// Private class method
|
||||||
|
+ (NSArray *) _toolbarsWithIdentifier: (NSString *)identifier;
|
||||||
|
|
||||||
|
// Private methods with broadcast support
|
||||||
|
- (void) _insertItemWithItemIdentifier: (NSString *)itemIdentifier
|
||||||
|
atIndex: (int)index
|
||||||
|
broadcast: (BOOL)broadcast;
|
||||||
|
- (void) _removeItemAtIndex: (int)index broadcast: (BOOL)broadcast;
|
||||||
|
- (void) _setAllowsUserCustomization: (BOOL)flag broadcast: (BOOL)broadcast;
|
||||||
|
- (void) _setAutosavesConfiguration: (BOOL)flag broadcast: (BOOL)broadcast;
|
||||||
|
- (void) _setConfigurationFromDictionary: (NSDictionary *)configDict
|
||||||
|
broadcast: (BOOL)broadcast;
|
||||||
|
- (void) _moveItemFromIndex: (int)index toIndex: (int)newIndex broadcast: (BOOL)broadcast;
|
||||||
|
- (void) _setDisplayMode: (NSToolbarDisplayMode)displayMode
|
||||||
|
broadcast: (BOOL)broadcast;
|
||||||
|
- (void) _setSizeMode: (NSToolbarSizeMode)sizeMode
|
||||||
|
broadcast: (BOOL)broadcast;
|
||||||
|
- (void) _setVisible: (BOOL)shown broadcast: (BOOL)broadcast;
|
||||||
|
|
||||||
|
// Few other private methods
|
||||||
|
- (void) _build;
|
||||||
|
|
||||||
|
- (int) _indexOfItem: (NSToolbarItem *)item;
|
||||||
|
- (void) _concludeRemoveItem: (NSToolbarItem *)item
|
||||||
|
atIndex: (int)index
|
||||||
|
broadcast: (BOOL)broadcast;
|
||||||
|
- (void) _insertPassivelyItem: (NSToolbarItem *)item atIndex: (int)newIndex;
|
||||||
|
- (void) _moveItemFromIndex: (int)index
|
||||||
|
toIndex: (int)newIndex
|
||||||
|
broadcast: (BOOL)broacast;
|
||||||
|
- (void) _performRemoveItem: (NSToolbarItem *)item; // Used by drag setup
|
||||||
|
- (void) _loadConfig;
|
||||||
|
- (NSToolbarItem *) _toolbarItemForIdentifier: (NSString *)itemIdent;
|
||||||
|
- (NSToolbar *) _toolbarModel;
|
||||||
|
- (void) _validate: (NSWindow *)observedWindow;
|
||||||
|
- (void) _toolbarViewWillMoveToSuperview: (NSView *)newSuperview;
|
||||||
|
|
||||||
|
// Accessors
|
||||||
|
- (void) _setToolbarView: (GSToolbarView *)toolbarView;
|
||||||
|
- (GSToolbarView *) _toolbarView;
|
||||||
|
- (void) setUsesStandardBackgroundColor: (BOOL)standard;
|
||||||
|
- (BOOL) usesStandardBackgroundColor;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface NSWindow (ToolbarPrivate)
|
||||||
|
- (void) _adjustToolbarView: (GSToolbarView*)view;
|
||||||
|
- (void) _addToolbarView: (GSToolbarView*)view;
|
||||||
|
- (void) _removeToolbarView: (GSToolbarView*)view;
|
||||||
|
- (NSView *) _contentViewWithoutToolbar;
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _NSToolbarFrameworkPrivate_h_INCLUDE
|
|
@ -50,6 +50,8 @@
|
||||||
#include "GNUstepGUI/GSToolbarView.h"
|
#include "GNUstepGUI/GSToolbarView.h"
|
||||||
#include "AppKit/NSToolbarItem.h"
|
#include "AppKit/NSToolbarItem.h"
|
||||||
|
|
||||||
|
#include "NSToolbarFrameworkPrivate.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Each NSToolbarItem object are coupled with a backView which is their
|
* Each NSToolbarItem object are coupled with a backView which is their
|
||||||
* representation on the screen.
|
* representation on the screen.
|
||||||
|
@ -89,32 +91,6 @@ static NSFont *SmallFont = nil;
|
||||||
|
|
||||||
NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
|
NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
|
||||||
|
|
||||||
@interface NSToolbar (GNUstepPrivate)
|
|
||||||
- (GSToolbarView *) _toolbarView;
|
|
||||||
- (int) _indexOfItem: (NSToolbarItem *)item; // Used by drag setup
|
|
||||||
|
|
||||||
- (void) _performRemoveItem: (NSToolbarItem *)item; // Used by drag setup
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface NSToolbarItem (GNUstepPrivate)
|
|
||||||
- (void) _layout;
|
|
||||||
// ---
|
|
||||||
- (void) _computeFlags;
|
|
||||||
- (NSView *) _backView;
|
|
||||||
- (NSMenuItem *) _defaultMenuFormRepresentation;
|
|
||||||
- (BOOL) _isFlexibleSpace;
|
|
||||||
- (BOOL) _isModified;
|
|
||||||
- (BOOL) _selectable;
|
|
||||||
- (void) _setSelectable: (BOOL)selectable;
|
|
||||||
- (BOOL) _selected;
|
|
||||||
- (void) _setSelected: (BOOL)selected;
|
|
||||||
- (void) _setToolbar: (NSToolbar *)toolbar;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface GSToolbarView (GNUstepPrivate)
|
|
||||||
- (void) _reload;
|
|
||||||
@end
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NSButton subclass is the toolbar buttons _backView
|
* NSButton subclass is the toolbar buttons _backView
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -34,21 +34,7 @@
|
||||||
#include "AppKit/NSToolbar.h"
|
#include "AppKit/NSToolbar.h"
|
||||||
#include "GNUstepGUI/GSToolbarView.h"
|
#include "GNUstepGUI/GSToolbarView.h"
|
||||||
|
|
||||||
@interface NSToolbar (GNUstepPrivate)
|
#include "NSToolbarFrameworkPrivate.h"
|
||||||
- (GSToolbarView *) _toolbarView;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface GSToolbarView (GNUstepPrivate)
|
|
||||||
- (float) _heightFromLayout;
|
|
||||||
- (void) _reload;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface NSWindow (ToolbarPrivate)
|
|
||||||
- (void) _adjustToolbarView: (GSToolbarView*)view;
|
|
||||||
- (void) _addToolbarView: (GSToolbarView*)view;
|
|
||||||
- (void) _removeToolbarView: (GSToolbarView*)view;
|
|
||||||
- (NSView *) _contentViewWithoutToolbar;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation NSWindow (Toolbar)
|
@implementation NSWindow (Toolbar)
|
||||||
|
|
||||||
|
@ -123,6 +109,8 @@
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Instantiate the toolbar view
|
// Instantiate the toolbar view
|
||||||
|
// FIXME: Currently this is reatined until the toolbar
|
||||||
|
// gets removed from the window.
|
||||||
toolbarView = [[GSToolbarView alloc]
|
toolbarView = [[GSToolbarView alloc]
|
||||||
initWithFrame:
|
initWithFrame:
|
||||||
NSMakeRect(0, 0,
|
NSMakeRect(0, 0,
|
||||||
|
@ -267,7 +255,6 @@
|
||||||
contentViewWithoutToolbarFrame.size.width,
|
contentViewWithoutToolbarFrame.size.width,
|
||||||
newToolbarViewHeight)];
|
newToolbarViewHeight)];
|
||||||
[_contentView addSubview: toolbarView];
|
[_contentView addSubview: toolbarView];
|
||||||
RELEASE(toolbarView);
|
|
||||||
|
|
||||||
// Insert the previous content view
|
// Insert the previous content view
|
||||||
/* We want contentViewWithoutToolbarFrame at the origin of our new
|
/* We want contentViewWithoutToolbarFrame at the origin of our new
|
||||||
|
@ -295,7 +282,6 @@
|
||||||
contentViewWithoutToolbar = [self _contentViewWithoutToolbar];
|
contentViewWithoutToolbar = [self _contentViewWithoutToolbar];
|
||||||
|
|
||||||
// Unplug the toolbar view
|
// Unplug the toolbar view
|
||||||
RETAIN(toolbarView);
|
|
||||||
[toolbarView removeFromSuperviewWithoutNeedingDisplay];
|
[toolbarView removeFromSuperviewWithoutNeedingDisplay];
|
||||||
|
|
||||||
// Resize the window
|
// Resize the window
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue