source: releases/Pester/1.1b6/Source/NSFont-NJRExtensions.m@ 517

Last change on this file since 517 was 129, checked in by Nicholas Riley, 22 years ago

PSPreferencesController.[hm]: Manage preferences window, just like in
HostLauncher (and DockCam, I guess, though I didn't check.)

NJRHotKeyField.[hm], NJRHotKeyFieldCell.[hm]: Implements a NSTextField
subclass which intercepts every keyboard event it can, and turns it
into a human-readable representation. Don't ask me how many hours of
work this was.

English.lproj/MainMenu.nib: Hook up Preferences menu item.

English.lproj/Preferences.nib: Simple Preferences panel. One
NJRHotKeyField, one button, a couple of static text fields.

NSString-NJRExtensions.[hm]: Added method from HostLauncher (modified
to output attributed string, as it's needed in order to get the right
mix of fonts), -keyEquivalentAttributedStringWithModifierMask:.
Greatly broadened the number of keys which this method can process to
pretty much the entire extended keyboard.

NSFont-NJRExtensions.[hm]: Provide a class method for obtaining a
theme font as a NSFont.

File size: 1.0 KB
Line 
1//
2// NSFont-NJRExtensions.m
3// Pester
4//
5// Created by Nicholas Riley on Sun Mar 30 2003.
6// Copyright (c) 2003 Nicholas Riley. All rights reserved.
7//
8
9#import "NSFont-NJRExtensions.h"
10
11@implementation NSFont (NJRExtensions)
12
13+ (NSFont *)themeFont:(ThemeFontID)fontID;
14{
15 NSFont *themeFont = nil;
16 Str255 pstrFontName;
17 SInt16 fontSize = 0;
18 OSStatus status;
19 // can't simulate algorithmic styles in Cocoa in any case, so here's hoping nothing will be passed back - XXX guess this should at least accommodate the bold system font, but we don't need it
20 status = GetThemeFont(fontID, smSystemScript, pstrFontName, &fontSize, NULL);
21
22 if (status == noErr) {
23 NSString *fontName = (NSString *)CFStringCreateWithPascalString(NULL, pstrFontName, CFStringGetSystemEncoding());
24 themeFont = [NSFont fontWithName: fontName size: fontSize];
25 [fontName release];
26 }
27 if (themeFont == nil) {
28 themeFont = [NSFont systemFontOfSize: fontSize == 0 ? [NSFont systemFontSize] : fontSize];
29 }
30 return themeFont;
31}
32
33@end
Note: See TracBrowser for help on using the repository browser.