mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 16:00:37 +00:00
Added new methods to NSFont and moved NSControlSize into NSColor header.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20868 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
666144bbd8
commit
7133a6a263
5 changed files with 90 additions and 7 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2005-03-07 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Header/AppKit/NSCell.h: Moved NSControlSize definition to ...
|
||||
* Header/AppKit/NSColor.h: ... here and added
|
||||
NSMiniControlSize. For NSControlTint added NSBlueControlTint and
|
||||
NSGraphiteControlTint.
|
||||
* Header/AppKit/NSFont.h (+menuBarFontOfSize:,
|
||||
+systemFontSizeForControlSize:, -numberOfGlyphs,
|
||||
-coveredCharacterSet, -fontDescriptor): New MacOSX 10.3 methods.
|
||||
* Source/NSFont.m: Added dummy implementations for the new methods.
|
||||
|
||||
2005-03-05 Adrian Robert <arobert@cogsci.ucsd.edu>
|
||||
|
||||
* Source/NSApplication.m (-_windowDidResignKey:) Unhide mouse.
|
||||
|
|
|
@ -113,11 +113,6 @@ enum {
|
|||
NSMixedState = -1
|
||||
};
|
||||
|
||||
typedef enum _NSControlSize {
|
||||
NSRegularControlSize,
|
||||
NSSmallControlSize
|
||||
} NSControlSize;
|
||||
|
||||
@interface NSCell : NSObject <NSCopying, NSCoding>
|
||||
{
|
||||
// Attributes
|
||||
|
|
|
@ -39,9 +39,17 @@
|
|||
|
||||
typedef enum _NSControlTint {
|
||||
NSDefaultControlTint,
|
||||
NSClearControlTint
|
||||
NSClearControlTint,
|
||||
NSBlueControlTint,
|
||||
NSGraphiteControlTint
|
||||
} NSControlTint;
|
||||
|
||||
typedef enum _NSControlSize {
|
||||
NSRegularControlSize,
|
||||
NSSmallControlSize,
|
||||
NSMiniControlSize
|
||||
} NSControlSize;
|
||||
|
||||
/*
|
||||
* NSColor is an abstract super class of the class cluster of the real colour classes.
|
||||
* For each colour space exists a specific subclass that implements the behaviour for
|
||||
|
|
|
@ -34,8 +34,12 @@
|
|||
#include <Foundation/NSGeometry.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <AppKit/AppKitDefines.h>
|
||||
// For NSControlSize
|
||||
#include <AppKit/NSColor.h>
|
||||
|
||||
@class NSDictionary;
|
||||
@class NSCharacterSet;
|
||||
@class NSFontDescriptor;
|
||||
|
||||
typedef unsigned int NSGlyph;
|
||||
|
||||
|
@ -98,6 +102,7 @@ APPKIT_EXPORT const float *NSFontIdentityMatrix;
|
|||
+ (NSFont*) userFixedPitchFontOfSize: (float)fontSize;
|
||||
+ (NSFont*) userFontOfSize: (float)fontSize;
|
||||
|
||||
#ifndef STRICT_OPENSTEP
|
||||
+ (NSFont*) titleBarFontOfSize: (float)fontSize;
|
||||
+ (NSFont*) menuFontOfSize: (float)fontSize;
|
||||
+ (NSFont*) messageFontOfSize: (float)fontSize;
|
||||
|
@ -105,13 +110,18 @@ APPKIT_EXPORT const float *NSFontIdentityMatrix;
|
|||
+ (NSFont*) toolTipsFontOfSize: (float)fontSize;
|
||||
+ (NSFont*) controlContentFontOfSize: (float)fontSize;
|
||||
+ (NSFont*) labelFontOfSize: (float)fontSize;
|
||||
+ (NSFont*) menuBarFontOfSize: (float)fontSize;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Font Sizes
|
||||
//
|
||||
#ifndef STRICT_OPENSTEP
|
||||
+ (float) labelFontSize;
|
||||
+ (float) smallSystemFontSize;
|
||||
+ (float) systemFontSize;
|
||||
+ (float) systemFontSizeForControlSize: (NSControlSize)controlSize;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Preferred Fonts
|
||||
|
@ -155,6 +165,12 @@ APPKIT_EXPORT const float *NSFontIdentityMatrix;
|
|||
- (float) widthOfString: (NSString*)string;
|
||||
- (float) defaultLineHeightForFont;
|
||||
|
||||
#ifndef STRICT_OPENSTEP
|
||||
- (unsigned) numberOfGlyphs;
|
||||
- (NSCharacterSet*) coveredCharacterSet;
|
||||
- (NSFontDescriptor*) fontDescriptor;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Manipulating Glyphs
|
||||
//
|
||||
|
|
|
@ -148,6 +148,7 @@ keyForFont(NSString *name, const float *matrix, BOOL fix,
|
|||
<item>NSFont Helvetica (System Font)</item>
|
||||
<item>NSLabelFont System font</item>
|
||||
<item>NSMenuFont System font</item>
|
||||
<item>NSMenuBarFont System font</item>
|
||||
<item>NSMessageFont System font</item>
|
||||
<item>NSPaletteFont System bold font</item>
|
||||
<item>NSTitleBarFont System bold font</item>
|
||||
|
@ -164,6 +165,7 @@ keyForFont(NSString *name, const float *matrix, BOOL fix,
|
|||
<item>NSFontSize 12 (System Font Size)</item>
|
||||
<item>NSLabelFontSize (none)</item>
|
||||
<item>NSMenuFontSize (none)</item>
|
||||
<item>NSMiniFontSize 6</item>
|
||||
<item>NSMessageFontSize (none)</item>
|
||||
<item>NSPaletteFontSize (none)</item>
|
||||
<item>NSSmallFontSize 9</item>
|
||||
|
@ -220,6 +222,7 @@ RolePaletteFont,
|
|||
RoleToolTipsFont,
|
||||
RoleControlContentFont,
|
||||
RoleLabelFont,
|
||||
RoleMenuBarFont,
|
||||
RoleMax
|
||||
};
|
||||
|
||||
|
@ -256,7 +259,8 @@ static font_role_info_t font_roles[RoleMax]={
|
|||
{@"NSPaletteFont" , RoleBoldSystemFont, nil, nil},
|
||||
{@"NSToolTipsFont" , RoleSystemFont , nil, nil},
|
||||
{@"NSControlContentFont", RoleSystemFont , nil, nil},
|
||||
{@"NSLabelFont" , RoleSystemFont , nil, nil}
|
||||
{@"NSLabelFont" , RoleSystemFont , nil, nil},
|
||||
{@"NSMenuBarFont" , RoleSystemFont , nil, nil}
|
||||
};
|
||||
|
||||
|
||||
|
@ -533,6 +537,11 @@ static void setNSFont(NSString *key, NSFont *font)
|
|||
return getNSFont(fontSize, RoleMenuFont);
|
||||
}
|
||||
|
||||
+ (NSFont*) menuBarFontOfSize: (float)fontSize
|
||||
{
|
||||
return getNSFont(fontSize, RoleMenuBarFont);
|
||||
}
|
||||
|
||||
+ (NSFont*) titleBarFontOfSize: (float)fontSize
|
||||
{
|
||||
return getNSFont(fontSize, RoleTitleBarFont);
|
||||
|
@ -592,6 +601,29 @@ static void setNSFont(NSString *key, NSFont *font)
|
|||
return fontSize;
|
||||
}
|
||||
|
||||
+ (float) systemFontSizeForControlSize: (NSControlSize)controlSize
|
||||
{
|
||||
switch (controlSize)
|
||||
{
|
||||
case NSMiniControlSize:
|
||||
{
|
||||
float fontSize = [defaults floatForKey: @"NSMiniFontSize"];
|
||||
|
||||
if (fontSize == 0)
|
||||
{
|
||||
fontSize = 6;
|
||||
}
|
||||
|
||||
return fontSize;
|
||||
}
|
||||
case NSSmallControlSize:
|
||||
return [self smallSystemFontSize];
|
||||
case NSRegularControlSize:
|
||||
default:
|
||||
return [self systemFontSize];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an autoreleased font with name aFontName and matrix fontMatrix.<br />
|
||||
* The fontMatrix is a standard size element matrix as used in PostScript
|
||||
|
@ -916,6 +948,24 @@ static BOOL flip_hack;
|
|||
return [fontInfo widthOfString: string];
|
||||
}
|
||||
|
||||
- (unsigned) numberOfGlyphs
|
||||
{
|
||||
// FIXME
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (NSCharacterSet*) coveredCharacterSet
|
||||
{
|
||||
// FIXME
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSFontDescriptor*) fontDescriptor
|
||||
{
|
||||
// FIXME
|
||||
return nil;
|
||||
}
|
||||
|
||||
/* The following methods have to be implemented by backends */
|
||||
|
||||
//
|
||||
|
@ -1182,6 +1232,9 @@ static BOOL flip_hack;
|
|||
case RoleLabelFont:
|
||||
new = [NSFont labelFontOfSize: size];
|
||||
break;
|
||||
case RoleMenuBarFont:
|
||||
new = [NSFont menuBarFontOfSize: size];
|
||||
break;
|
||||
|
||||
default:
|
||||
NSDebugLLog(@"NSFont", @"unknown role %i", the_role);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue