Files
cappuccino/AppKit/_CPToolbarCustomizeToolbarItem.j
David Richardson d7390bdbf3 CPToolbarItem: Implement standard Show Fonts, Print, and Customize Toolbar items
Although these three identifiers were defined, no standard toolbar items
handled them. Toolbars referencing them fell back to the delegate and
raised an exception when none was supplied, while items decoded from a
XIB rendered with empty images.

Each identifier now resolves to a standard item configured with AppKit's
standard label and action: Show Fonts targets the shared font manager
with orderFrontFontPanel:, while Print and Customize Toolbar send
printDocument: and runToolbarCustomizationPalette: up the responder
chain. Aristo3 supplies their icons as glyphs tinted to the active text
color so they adapt automatically to appearance changes.
2026-11-19 13:03:42 -06:00

67 lines
1.9 KiB
Plaintext

/*
* _CPToolbarCustomizeToolbarItem.j
* AppKit
*
* Created by David Richardson on 2026-11-19.
* Copyright David Richardson 2026.
*
* 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.1 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; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "_CPToolbarItem.j"
/*
The standard Customize Toolbar item (CPToolbarCustomizeToolbarItemIdentifier). As in
AppKit, it sends -runToolbarCustomizationPalette: along the responder chain to the window.
*/
@implementation _CPToolbarCustomizeToolbarItem : CPToolbarItem
{
}
- (id)initWithItemIdentifier:(CPString)anIgnoredIdentifier
{
self = [super initWithItemIdentifier:CPToolbarCustomizeToolbarItemIdentifier];
if (self)
{
[self setMinSize:CGSizeMake(32.0, 32.0)];
[self setMaxSize:CGSizeMake(32.0, 32.0)];
[self setLabel:@"Customize"];
[self setPaletteLabel:@"Customize Toolbar"];
[self setTarget:nil];
[self setAction:@selector(runToolbarCustomizationPalette:)];
[self setImage:[CPImage imageNamed:CPImageNameCustomizeToolbar]];
[self setToolTip:@"Customize the toolbar."];
}
return self;
}
/*
A standard item is archived by its identifier alone, so it decodes as a new standard item.
*/
- (id)initWithCoder:(CPCoder)aCoder
{
return [self init];
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
}
@end