mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 15:31:56 +00:00
Get NSToolbar setVisible: to really display/hide the toolbar.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28722 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0777c0574e
commit
73ac66ae1b
3 changed files with 61 additions and 6 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2009-09-21 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSWindow.m (+standardWindowButton:forStyleMask:): Add
|
||||||
|
support for toolbar button.
|
||||||
|
* Source/NSWindow.m (-toggleToolbarShown:): Reorder the code.
|
||||||
|
* Source/NSToolbar.m (_setVisible:broadcast:): Add code to really
|
||||||
|
make the toolbar visible.
|
||||||
|
* Source/NSToolbar.m (_window): New helper method for this.
|
||||||
|
|
||||||
2009-09-19 Fred Kiefer <FredKiefer@gmx.de>
|
2009-09-19 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/GSHorizontalTypesetter.m (-_cacheMoveTo:): Use default
|
* Source/GSHorizontalTypesetter.m (-_cacheMoveTo:): Use default
|
||||||
|
|
|
@ -898,11 +898,12 @@ static GSValidationCenter *vc = nil;
|
||||||
NSString *tableKey =
|
NSString *tableKey =
|
||||||
[NSString stringWithFormat: @"NSToolbar Config %@",_identifier];
|
[NSString stringWithFormat: @"NSToolbar Config %@",_identifier];
|
||||||
NSDictionary *config = [defaults objectForKey: tableKey];
|
NSDictionary *config = [defaults objectForKey: tableKey];
|
||||||
NSToolbarDisplayMode displayMode = 0;
|
|
||||||
NSToolbarSizeMode sizeMode = 0;
|
|
||||||
|
|
||||||
if(config)
|
if (config)
|
||||||
{
|
{
|
||||||
|
NSToolbarDisplayMode displayMode = 0;
|
||||||
|
NSToolbarSizeMode sizeMode = 0;
|
||||||
|
|
||||||
displayMode = (NSToolbarDisplayMode)[[config objectForKey: @"displayMode"] intValue];
|
displayMode = (NSToolbarDisplayMode)[[config objectForKey: @"displayMode"] intValue];
|
||||||
[self setDisplayMode: displayMode];
|
[self setDisplayMode: displayMode];
|
||||||
sizeMode = (NSToolbarDisplayMode)[[config objectForKey: @"sizeMode"] intValue];
|
sizeMode = (NSToolbarDisplayMode)[[config objectForKey: @"sizeMode"] intValue];
|
||||||
|
@ -1319,6 +1320,25 @@ static GSValidationCenter *vc = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (NSWindow*) _window
|
||||||
|
{
|
||||||
|
NSWindow *window = [_toolbarView window];
|
||||||
|
NSEnumerator *wenum;
|
||||||
|
|
||||||
|
if (window)
|
||||||
|
return window;
|
||||||
|
|
||||||
|
wenum = [GSAllWindows() objectEnumerator];
|
||||||
|
while ((window = [wenum nextObject]))
|
||||||
|
{
|
||||||
|
if ([window toolbar] == self)
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
// This method wont make a toolbar visible or invisible by itself.
|
// This method wont make a toolbar visible or invisible by itself.
|
||||||
// Use [NSWindow toggleToolbarShown:]
|
// Use [NSWindow toggleToolbarShown:]
|
||||||
- (void) _setVisible: (BOOL)shown broadcast: (BOOL)broadcast
|
- (void) _setVisible: (BOOL)shown broadcast: (BOOL)broadcast
|
||||||
|
@ -1326,7 +1346,29 @@ static GSValidationCenter *vc = nil;
|
||||||
if (_visible != shown)
|
if (_visible != shown)
|
||||||
{
|
{
|
||||||
_visible = shown;
|
_visible = shown;
|
||||||
|
|
||||||
|
if (shown)
|
||||||
|
[self _build];
|
||||||
|
|
||||||
|
if (shown)
|
||||||
|
{
|
||||||
|
if ((_toolbarView == nil) || ([_toolbarView superview] == nil))
|
||||||
|
{
|
||||||
|
NSWindow *w = [self _window];
|
||||||
|
|
||||||
|
[(id)[w _windowView] addToolbarView: [self _toolbarView]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((_toolbarView != nil) && ([_toolbarView superview] != nil))
|
||||||
|
{
|
||||||
|
NSWindow *w = [self _window];
|
||||||
|
|
||||||
|
[(id)[w _windowView] removeToolbarView: [self _toolbarView]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (broadcast)
|
if (broadcast)
|
||||||
{
|
{
|
||||||
TRANSMIT(_setVisible: _visible broadcast: NO);
|
TRANSMIT(_setVisible: _visible broadcast: NO);
|
||||||
|
|
|
@ -2902,6 +2902,9 @@ resetCursorRectsForView(NSView *theView)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSWindowToolbarButton:
|
case NSWindowToolbarButton:
|
||||||
|
// FIXME
|
||||||
|
[newButton setAction: @selector(toggleToolbarShown:)];
|
||||||
|
break;
|
||||||
case NSWindowDocumentIconButton:
|
case NSWindowDocumentIconButton:
|
||||||
default:
|
default:
|
||||||
// FIXME
|
// FIXME
|
||||||
|
@ -5121,9 +5124,8 @@ current key view.<br />
|
||||||
|
|
||||||
if (!toolbar)
|
if (!toolbar)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
[toolbar setVisible: !isVisible];
|
|
||||||
|
|
||||||
|
// We do this again on a lower level, but doing it here is faster.
|
||||||
if (isVisible)
|
if (isVisible)
|
||||||
{
|
{
|
||||||
[_wv removeToolbarView: [toolbar _toolbarView]];
|
[_wv removeToolbarView: [toolbar _toolbarView]];
|
||||||
|
@ -5133,6 +5135,8 @@ current key view.<br />
|
||||||
[_wv addToolbarView: [toolbar _toolbarView]];
|
[_wv addToolbarView: [toolbar _toolbarView]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[toolbar setVisible: !isVisible];
|
||||||
|
|
||||||
[self display];
|
[self display];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue