From eaf998582981a0669d65ab2a90cb56e9e500669a Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Thu, 17 Sep 2009 14:59:13 +0000 Subject: [PATCH] carbon: Fix TTrayIcon bold menu item size git-svn-id: trunk@21750 - --- .gitattributes | 1 + lcl/interfaces/carbon/carbontrayicon.inc | 9 +- .../carbon/pascocoa/appkit/AppKit.inc | 6 +- .../carbon/pascocoa/appkit/NSFontManager.inc | 625 ++++++++++++++++++ .../carbon/pascocoa/build/buildappkit.sh | 5 +- .../carbon/pascocoa/build/buildfoundation.sh | 3 + 6 files changed, 644 insertions(+), 5 deletions(-) create mode 100644 lcl/interfaces/carbon/pascocoa/appkit/NSFontManager.inc diff --git a/.gitattributes b/.gitattributes index f45d0ebcab..7acbe0e8ef 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4137,6 +4137,7 @@ lcl/interfaces/carbon/pascocoa/appkit/NSCell.inc svneol=native#text/plain lcl/interfaces/carbon/pascocoa/appkit/NSColor.inc svneol=native#text/plain lcl/interfaces/carbon/pascocoa/appkit/NSControl.inc svneol=native#text/plain lcl/interfaces/carbon/pascocoa/appkit/NSFont.inc svneol=native#text/plain +lcl/interfaces/carbon/pascocoa/appkit/NSFontManager.inc svneol=native#text/plain lcl/interfaces/carbon/pascocoa/appkit/NSGraphics.inc svneol=native#text/plain lcl/interfaces/carbon/pascocoa/appkit/NSGraphicsContext.inc svneol=native#text/plain lcl/interfaces/carbon/pascocoa/appkit/NSImage.inc svneol=native#text/plain diff --git a/lcl/interfaces/carbon/carbontrayicon.inc b/lcl/interfaces/carbon/carbontrayicon.inc index e2899fd323..03705062de 100644 --- a/lcl/interfaces/carbon/carbontrayicon.inc +++ b/lcl/interfaces/carbon/carbontrayicon.inc @@ -199,6 +199,7 @@ var AImage: NSImage; StrBuffer: string; // Default property implementation (=bold) + FontManager: NSFontManager; AttrString: NSAttributedString; AttrStringFont: NSFont; AttrDictionary: NSDictionary; @@ -238,7 +239,11 @@ begin { Assign default (=bold) state } if AMenuItem.Default then begin - AttrStringFont := NSFont.boldSystemFontOfSize(0); // 0 = default size + FontManager := NSFontManager.sharedFontManager; + // For now hard-code the menu font to 14, because the default size + // is 13, which is wrong, and looks bad. + AttrStringFont := NSFont.menuFontOfSize(14); // 0 = default size + AttrStringFont.Handle := FontManager.convertFont_toHaveTrait_(AttrStringFont.Handle, NSBoldFontMask); AttrDictionary := NSDictionary.dictionaryWithObject_forKey(AttrStringFont.Handle, objc.id(NSFontAttributeName)); AttrString := NSAttributedString.initWithString_attributes(ItemText, CFDictionaryRef(AttrDictionary.Handle)); if AttrString.Handle <> nil then @@ -251,6 +256,8 @@ begin AttrDictionary.Free; AttrStringFont.Handle := nil; AttrStringFont.Free; + FontManager.Handle := nil; + FontManager.Free; end; { Assign enabled/disabled state } diff --git a/lcl/interfaces/carbon/pascocoa/appkit/AppKit.inc b/lcl/interfaces/carbon/pascocoa/appkit/AppKit.inc index 37761fe1a3..35bab932f9 100644 --- a/lcl/interfaces/carbon/pascocoa/appkit/AppKit.inc +++ b/lcl/interfaces/carbon/pascocoa/appkit/AppKit.inc @@ -22,9 +22,9 @@ //#import {$include NSControl.inc} {$include NSFont.inc} -{#import -#import -#import +{#import } +{$include NSFontManager.inc} +{#import #import #import #import } diff --git a/lcl/interfaces/carbon/pascocoa/appkit/NSFontManager.inc b/lcl/interfaces/carbon/pascocoa/appkit/NSFontManager.inc new file mode 100644 index 0000000000..b2eb1cf70c --- /dev/null +++ b/lcl/interfaces/carbon/pascocoa/appkit/NSFontManager.inc @@ -0,0 +1,625 @@ +{%mainunit appkit.pas} +(* + NSFontManager.h + Application Kit + Copyright (c) 1994-2005, Apple Computer, Inc. + All rights reserved. +*) + +{$ifdef HEADER} +{$ifndef NSFONTMANAGER_PAS_H} +{$define NSFONTMANAGER_PAS_H} + +//#import +type + NSFontTraitMask = LongWord; + + // * Font Traits + // * + // * This list should be kept small since the more traits that are assigned + // * to a given font, the harder it will be to map it to some other family. + // * Some traits are mutually exclusive such as NSExpanded and NSCondensed. + // +const + NSItalicFontMask = $00000001; + NSBoldFontMask = $00000002; + NSUnboldFontMask = $00000004; + NSNonStandardCharacterSetFontMask = $00000008; + NSNarrowFontMask = $00000010; + NSExpandedFontMask = $00000020; + NSCondensedFontMask = $00000040; + NSSmallCapsFontMask = $00000080; + NSPosterFontMask = $00000100; + NSCompressedFontMask = $00000200; + NSFixedPitchFontMask = $00000400; + NSUnitalicFontMask = $01000000; + +const + NSFontCollectionApplicationOnlyMask = 1 shl 0; + + // And these "actions" are really tag values in Font Menu cells which send any of the + // action messages listed above. Normally, they're pre-defined in the font panel. +type + NSFontAction = ( + NSNoFontChangeAction = 0, + NSViaPanelFontAction = 1, + NSAddTraitFontAction = 2, + NSSizeUpFontAction = 3, + NSSizeDownFontAction = 4, + NSHeavierFontAction = 5, + NSLighterFontAction = 6, + NSRemoveTraitFontAction = 7 + ); + + + // This method is perhaps inappropriately named; it is sent to the delegate of the + // shared NSFontPanel instance, not to the delegate of the NSFontManager. + // This is the message that's propagated up the responder chain. + +{$endif} +{$endif} + +{$ifdef FORWARD} + NSFontManager = class; + +{$endif} + +{$ifdef CLASSES} +{$ifndef NSFONTMANAGER_PAS_C} +{$define NSFONTMANAGER_PAS_C} + + + { NSFontManager } + + NSFontManager = class(NSObject) + public + class function getClass: objc.id; override; + // All instance variables are private + class procedure setFontPanelFactory_(_factoryId: _Class); + class procedure setFontManagerFactory_(_factoryId: _Class); + constructor sharedFontManager; + function isMultiple: LongBool; + function selectedFont: objc.id; + procedure setSelectedFont_isMultiple_(_fontObj: objc.id; _flag: LongBool); + procedure setFontMenu_(_newMenu: objc.id); + function fontMenu_(_create: LongBool): objc.id; + function fontPanel_(_create: LongBool): objc.id; + function fontWithFamily_traits_weight_size_(_family: CFStringRef; _traits: NSFontTraitMask; _weight: Integer; _size: Single): objc.id; + function traitsOfFont_(_fontObj: objc.id): NSFontTraitMask; + function weightOfFont_(_fontObj: objc.id): Integer; + // Three methods for supporting app font management. The fonts and names used/returned + // by these functions are the same as those used by the NSFontPanel. The third method + // below takes as input a name as returned by "availableFontFamilies" and returns an + // NSArray of NSArrays. The elements of the "inner" arrays are: (0) the font's name, + // (1) non-family part of the name as used by NSFontPanel, (2) an NSNumber indicating + // the weight, and (3) an NSNumber indicating the traits. + function availableFonts: CFArrayRef; + function availableFontFamilies: CFArrayRef; + function availableMembersOfFontFamily_(_fam: CFStringRef): CFArrayRef; + function convertFont_(_fontObj: objc.id): objc.id; + function convertFont_toSize_(_fontObj: objc.id; _size: Single): objc.id; + function convertFont_toFace_(_fontObj: objc.id; _typeface: CFStringRef): objc.id; + function convertFont_toFamily_(_fontObj: objc.id; _family: CFStringRef): objc.id; + function convertFont_toHaveTrait_(_fontObj: objc.id; _trait: NSFontTraitMask): objc.id; + function convertFont_toNotHaveTrait_(_fontObj: objc.id; _trait: NSFontTraitMask): objc.id; + function convertWeight_ofFont_(_upFlag: LongBool; _fontObj: objc.id): objc.id; + function isEnabled: LongBool; + procedure setEnabled_(_flag: LongBool); + function action: SEL; + procedure setAction_(_aSelector: SEL); + function sendAction: LongBool; + procedure setDelegate_(_anObject: objc.id); + function delegate: objc.id; + function localizedNameForFamily_face_(_family: CFStringRef; _faceKey: CFStringRef): CFStringRef; + procedure setSelectedAttributes_isMultiple_(_attributes: CFDictionaryRef; _flag: LongBool); + function convertAttributes_(_attributes: CFDictionaryRef): CFDictionaryRef; + function availableFontNamesMatchingFontDescriptor_(_descriptor: objc.id): CFArrayRef; + function collectionNames: CFArrayRef; + function fontDescriptorsInCollection_(_collectionNames: CFStringRef): CFArrayRef; + function addCollection_options_(_collectionName: CFStringRef; _collectionOptions: Integer): LongBool; + function removeCollection_(_collectionName: CFStringRef): LongBool; + procedure addFontDescriptors_toCollection_(_descriptors: CFArrayRef; _collectionName: CFStringRef); + procedure removeFontDescriptor_fromCollection_(_descriptor: objc.id; _collection: CFStringRef); + function fontNamed_hasTraits_(_fName: CFStringRef; _someTraits: NSFontTraitMask): LongBool; + // The following is like "availableFonts", but checks traits. Returns an auto-released + // instance. To get fonts with "non-italic" or "non-bold" combine the flags NSUnitalicFontMask + // and/or NSUnboldFontMask as the argument "someTraits". + function availableFontNamesWithTraits_(_someTraits: NSFontTraitMask): CFArrayRef; + // These methods are action messages sent from Font Menu items: + procedure addFontTrait_(_sender: objc.id); + procedure removeFontTrait_(_sender: objc.id); + procedure modifyFontViaPanel_(_sender: objc.id); + procedure modifyFont_(_sender: objc.id); + procedure orderFrontFontPanel_(_sender: objc.id); + procedure orderFrontStylesPanel_(_sender: objc.id); + end; + +{$endif} +{$endif} + +{$ifdef IMPLEMENTATION} +const + StrNSFontManager_NSFontManager = 'NSFontManager'; + StrNSFontManager_setFontPanelFactory_ = 'setFontPanelFactory:'; + StrNSFontManager_setFontManagerFactory_ = 'setFontManagerFactory:'; + StrNSFontManager_sharedFontManager = 'sharedFontManager'; + StrNSFontManager_isMultiple = 'isMultiple'; + StrNSFontManager_selectedFont = 'selectedFont'; + StrNSFontManager_setSelectedFont_isMultiple_ = 'setSelectedFont:isMultiple:'; + StrNSFontManager_setFontMenu_ = 'setFontMenu:'; + StrNSFontManager_fontMenu_ = 'fontMenu:'; + StrNSFontManager_fontPanel_ = 'fontPanel:'; + StrNSFontManager_fontWithFamily_traits_weight_size_ = 'fontWithFamily:traits:weight:size:'; + StrNSFontManager_traitsOfFont_ = 'traitsOfFont:'; + StrNSFontManager_weightOfFont_ = 'weightOfFont:'; + StrNSFontManager_availableFonts = 'availableFonts'; + StrNSFontManager_availableFontFamilies = 'availableFontFamilies'; + StrNSFontManager_availableMembersOfFontFamily_ = 'availableMembersOfFontFamily:'; + StrNSFontManager_convertFont_ = 'convertFont:'; + StrNSFontManager_convertFont_toSize_ = 'convertFont:toSize:'; + StrNSFontManager_convertFont_toFace_ = 'convertFont:toFace:'; + StrNSFontManager_convertFont_toFamily_ = 'convertFont:toFamily:'; + StrNSFontManager_convertFont_toHaveTrait_ = 'convertFont:toHaveTrait:'; + StrNSFontManager_convertFont_toNotHaveTrait_ = 'convertFont:toNotHaveTrait:'; + StrNSFontManager_convertWeight_ofFont_ = 'convertWeight:ofFont:'; + StrNSFontManager_isEnabled = 'isEnabled'; + StrNSFontManager_setEnabled_ = 'setEnabled:'; + StrNSFontManager_action = 'action'; + StrNSFontManager_setAction_ = 'setAction:'; + StrNSFontManager_sendAction = 'sendAction'; + StrNSFontManager_setDelegate_ = 'setDelegate:'; + StrNSFontManager_delegate = 'delegate'; + StrNSFontManager_localizedNameForFamily_face_ = 'localizedNameForFamily:face:'; + StrNSFontManager_setSelectedAttributes_isMultiple_ = 'setSelectedAttributes:isMultiple:'; + StrNSFontManager_convertAttributes_ = 'convertAttributes:'; + StrNSFontManager_availableFontNamesMatchingFontDescriptor_ = 'availableFontNamesMatchingFontDescriptor:'; + StrNSFontManager_collectionNames = 'collectionNames'; + StrNSFontManager_fontDescriptorsInCollection_ = 'fontDescriptorsInCollection:'; + StrNSFontManager_addCollection_options_ = 'addCollection:options:'; + StrNSFontManager_removeCollection_ = 'removeCollection:'; + StrNSFontManager_addFontDescriptors_toCollection_ = 'addFontDescriptors:toCollection:'; + StrNSFontManager_removeFontDescriptor_fromCollection_ = 'removeFontDescriptor:fromCollection:'; + + StrNSFontManager_fontNamed_hasTraits_ = 'fontNamed:hasTraits:'; + StrNSFontManager_availableFontNamesWithTraits_ = 'availableFontNamesWithTraits:'; + StrNSFontManager_addFontTrait_ = 'addFontTrait:'; + StrNSFontManager_removeFontTrait_ = 'removeFontTrait:'; + StrNSFontManager_modifyFontViaPanel_ = 'modifyFontViaPanel:'; + StrNSFontManager_modifyFont_ = 'modifyFont:'; + StrNSFontManager_orderFrontFontPanel_ = 'orderFrontFontPanel:'; + StrNSFontManager_orderFrontStylesPanel_ = 'orderFrontStylesPanel:'; + +{ NSFontManager } + +class function NSFontManager.getClass: objc.id; +begin + Result := objc_getClass(StrNSFontManager_NSFontManager); +end; + +class procedure NSFontManager.setFontPanelFactory_(_factoryId: _Class); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_factoryId: _Class);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(getClass, sel_registerName(PChar(StrNSFontManager_setFontPanelFactory_)), _factoryId); +end; + +class procedure NSFontManager.setFontManagerFactory_(_factoryId: _Class); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_factoryId: _Class);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(getClass, sel_registerName(PChar(StrNSFontManager_setFontManagerFactory_)), _factoryId); +end; + +constructor NSFontManager.sharedFontManager; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL): objc.id;cdecl; +var + vmethod: TmsgSendWrapper; +begin + ClassID := getClass(); + vmethod := TmsgSendWrapper(@objc_msgSend); + Handle := vmethod(ClassID, sel_registerName(PChar(StrNSFontManager_sharedFontManager))); +end; + +function NSFontManager.isMultiple: LongBool; +begin + Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSFontManager_isMultiple)), [])); +end; + +function NSFontManager.selectedFont: objc.id; +begin + Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSFontManager_selectedFont)), [])); +end; + +procedure NSFontManager.setSelectedFont_isMultiple_(_fontObj: objc.id; _flag: LongBool); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_fontObj: objc.id; _flag: LongBool);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(Handle, sel_registerName(PChar(StrNSFontManager_setSelectedFont_isMultiple_)), _fontObj, _flag); +end; + +procedure NSFontManager.setFontMenu_(_newMenu: objc.id); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_newMenu: objc.id);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(Handle, sel_registerName(PChar(StrNSFontManager_setFontMenu_)), _newMenu); +end; + +function NSFontManager.fontMenu_(_create: LongBool): objc.id; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_create: LongBool): objc.id;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := objc.id(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_fontMenu_)), _create)); +end; + +function NSFontManager.fontPanel_(_create: LongBool): objc.id; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_create: LongBool): objc.id;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := objc.id(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_fontPanel_)), _create)); +end; + +function NSFontManager.fontWithFamily_traits_weight_size_(_family: CFStringRef; _traits: NSFontTraitMask; _weight: Integer; _size: Single): objc.id; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_family: CFStringRef; _traits: NSFontTraitMask; _weight: Integer; _size: Single): objc.id;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := objc.id(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_fontWithFamily_traits_weight_size_)), _family, _traits, _weight, _size)); +end; + +function NSFontManager.traitsOfFont_(_fontObj: objc.id): NSFontTraitMask; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_fontObj: objc.id): NSFontTraitMask;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := NSFontTraitMask(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_traitsOfFont_)), _fontObj)); +end; + +function NSFontManager.weightOfFont_(_fontObj: objc.id): Integer; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_fontObj: objc.id): Integer;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := Integer(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_weightOfFont_)), _fontObj)); +end; + +function NSFontManager.availableFonts: CFArrayRef; +begin + Result := CFArrayRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSFontManager_availableFonts)), [])); +end; + +function NSFontManager.availableFontFamilies: CFArrayRef; +begin + Result := CFArrayRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSFontManager_availableFontFamilies)), [])); +end; + +function NSFontManager.availableMembersOfFontFamily_(_fam: CFStringRef): CFArrayRef; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_fam: CFStringRef): CFArrayRef;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := CFArrayRef(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_availableMembersOfFontFamily_)), _fam)); +end; + +function NSFontManager.convertFont_(_fontObj: objc.id): objc.id; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_fontObj: objc.id): objc.id;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := objc.id(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_convertFont_)), _fontObj)); +end; + +function NSFontManager.convertFont_toSize_(_fontObj: objc.id; _size: Single): objc.id; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_fontObj: objc.id; _size: Single): objc.id;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := objc.id(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_convertFont_toSize_)), _fontObj, _size)); +end; + +function NSFontManager.convertFont_toFace_(_fontObj: objc.id; _typeface: CFStringRef): objc.id; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_fontObj: objc.id; _typeface: CFStringRef): objc.id;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := objc.id(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_convertFont_toFace_)), _fontObj, _typeface)); +end; + +function NSFontManager.convertFont_toFamily_(_fontObj: objc.id; _family: CFStringRef): objc.id; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_fontObj: objc.id; _family: CFStringRef): objc.id;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := objc.id(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_convertFont_toFamily_)), _fontObj, _family)); +end; + +function NSFontManager.convertFont_toHaveTrait_(_fontObj: objc.id; _trait: NSFontTraitMask): objc.id; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_fontObj: objc.id; _trait: NSFontTraitMask): objc.id;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := objc.id(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_convertFont_toHaveTrait_)), _fontObj, _trait)); +end; + +function NSFontManager.convertFont_toNotHaveTrait_(_fontObj: objc.id; _trait: NSFontTraitMask): objc.id; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_fontObj: objc.id; _trait: NSFontTraitMask): objc.id;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := objc.id(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_convertFont_toNotHaveTrait_)), _fontObj, _trait)); +end; + +function NSFontManager.convertWeight_ofFont_(_upFlag: LongBool; _fontObj: objc.id): objc.id; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_upFlag: LongBool; _fontObj: objc.id): objc.id;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := objc.id(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_convertWeight_ofFont_)), _upFlag, _fontObj)); +end; + +function NSFontManager.isEnabled: LongBool; +begin + Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSFontManager_isEnabled)), [])); +end; + +procedure NSFontManager.setEnabled_(_flag: LongBool); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_flag: LongBool);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(Handle, sel_registerName(PChar(StrNSFontManager_setEnabled_)), _flag); +end; + +function NSFontManager.action: SEL; +begin + Result := SEL(objc_msgSend(Handle, sel_registerName(PChar(StrNSFontManager_action)), [])); +end; + +procedure NSFontManager.setAction_(_aSelector: SEL); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_aSelector: SEL);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(Handle, sel_registerName(PChar(StrNSFontManager_setAction_)), _aSelector); +end; + +function NSFontManager.sendAction: LongBool; +begin + Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSFontManager_sendAction)), [])); +end; + +procedure NSFontManager.setDelegate_(_anObject: objc.id); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_anObject: objc.id);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(Handle, sel_registerName(PChar(StrNSFontManager_setDelegate_)), _anObject); +end; + +function NSFontManager.delegate: objc.id; +begin + Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSFontManager_delegate)), [])); +end; + +function NSFontManager.localizedNameForFamily_face_(_family: CFStringRef; _faceKey: CFStringRef): CFStringRef; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_family: CFStringRef; _faceKey: CFStringRef): CFStringRef;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := CFStringRef(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_localizedNameForFamily_face_)), _family, _faceKey)); +end; + +procedure NSFontManager.setSelectedAttributes_isMultiple_(_attributes: CFDictionaryRef; _flag: LongBool); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_attributes: CFDictionaryRef; _flag: LongBool);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(Handle, sel_registerName(PChar(StrNSFontManager_setSelectedAttributes_isMultiple_)), _attributes, _flag); +end; + +function NSFontManager.convertAttributes_(_attributes: CFDictionaryRef): CFDictionaryRef; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_attributes: CFDictionaryRef): CFDictionaryRef;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := CFDictionaryRef(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_convertAttributes_)), _attributes)); +end; + +function NSFontManager.availableFontNamesMatchingFontDescriptor_(_descriptor: objc.id): CFArrayRef; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_descriptor: objc.id): CFArrayRef;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := CFArrayRef(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_availableFontNamesMatchingFontDescriptor_)), _descriptor)); +end; + +function NSFontManager.collectionNames: CFArrayRef; +begin + Result := CFArrayRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSFontManager_collectionNames)), [])); +end; + +function NSFontManager.fontDescriptorsInCollection_(_collectionNames: CFStringRef): CFArrayRef; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_collectionNames: CFStringRef): CFArrayRef;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := CFArrayRef(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_fontDescriptorsInCollection_)), _collectionNames)); +end; + +function NSFontManager.addCollection_options_(_collectionName: CFStringRef; _collectionOptions: Integer): LongBool; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_collectionName: CFStringRef; _collectionOptions: Integer): LongBool;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_addCollection_options_)), _collectionName, _collectionOptions)); +end; + +function NSFontManager.removeCollection_(_collectionName: CFStringRef): LongBool; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_collectionName: CFStringRef): LongBool;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_removeCollection_)), _collectionName)); +end; + +procedure NSFontManager.addFontDescriptors_toCollection_(_descriptors: CFArrayRef; _collectionName: CFStringRef); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_descriptors: CFArrayRef; _collectionName: CFStringRef);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(Handle, sel_registerName(PChar(StrNSFontManager_addFontDescriptors_toCollection_)), _descriptors, _collectionName); +end; + +procedure NSFontManager.removeFontDescriptor_fromCollection_(_descriptor: objc.id; _collection: CFStringRef); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_descriptor: objc.id; _collection: CFStringRef);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(Handle, sel_registerName(PChar(StrNSFontManager_removeFontDescriptor_fromCollection_)), _descriptor, _collection); +end; + +function NSFontManager.fontNamed_hasTraits_(_fName: CFStringRef; _someTraits: NSFontTraitMask): LongBool; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_fName: CFStringRef; _someTraits: NSFontTraitMask): LongBool;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := LongBool(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_fontNamed_hasTraits_)), _fName, _someTraits)); +end; + +function NSFontManager.availableFontNamesWithTraits_(_someTraits: NSFontTraitMask): CFArrayRef; +type + TmsgSendWrapper = function (param1: objc.id; param2: SEL;_someTraits: NSFontTraitMask): CFArrayRef;cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + Result := CFArrayRef(vmethod(Handle, sel_registerName(PChar(StrNSFontManager_availableFontNamesWithTraits_)), _someTraits)); +end; + +procedure NSFontManager.addFontTrait_(_sender: objc.id); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(Handle, sel_registerName(PChar(StrNSFontManager_addFontTrait_)), _sender); +end; + +procedure NSFontManager.removeFontTrait_(_sender: objc.id); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(Handle, sel_registerName(PChar(StrNSFontManager_removeFontTrait_)), _sender); +end; + +procedure NSFontManager.modifyFontViaPanel_(_sender: objc.id); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(Handle, sel_registerName(PChar(StrNSFontManager_modifyFontViaPanel_)), _sender); +end; + +procedure NSFontManager.modifyFont_(_sender: objc.id); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(Handle, sel_registerName(PChar(StrNSFontManager_modifyFont_)), _sender); +end; + +procedure NSFontManager.orderFrontFontPanel_(_sender: objc.id); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(Handle, sel_registerName(PChar(StrNSFontManager_orderFrontFontPanel_)), _sender); +end; + +procedure NSFontManager.orderFrontStylesPanel_(_sender: objc.id); +type + TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_sender: objc.id);cdecl; +var + vmethod: TmsgSendWrapper; +begin + vmethod := TmsgSendWrapper(@objc_msgSend); + vmethod(Handle, sel_registerName(PChar(StrNSFontManager_orderFrontStylesPanel_)), _sender); +end; + +{$endif} diff --git a/lcl/interfaces/carbon/pascocoa/build/buildappkit.sh b/lcl/interfaces/carbon/pascocoa/build/buildappkit.sh index 0650e713bf..7e4522c2cb 100755 --- a/lcl/interfaces/carbon/pascocoa/build/buildappkit.sh +++ b/lcl/interfaces/carbon/pascocoa/build/buildappkit.sh @@ -4,11 +4,14 @@ DEFAULT_INI="default.ini" APPKIT_INI="../build/appkit.ini" FRAMEWORK="/System/Library/Frameworks/AppKit.framework/Headers" #./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSApplication.h > ../appkit/NSApplication.inc +#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSAttributedString.h > ../appkit/NSAttributedString.inc #./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSBitmapImageRep.h > ../appkit/NSBitmapImageRep.inc #./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSBox.h > ../appkit/NSBox.inc #./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSButton.h > ../appkit/NSButton.inc #./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSControl.h > ../appkit/NSControl.inc -./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSColor.h > ../appkit/NSColor.inc +#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSColor.h > ../appkit/NSColor.inc +#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSFont.h > ../appkit/NSFont.inc +./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSFontManager.h > ../appkit/NSFontManager.inc #./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSGraphics.h > ../appkit/NSGraphics.inc #./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSGraphicsContext.h > ../appkit/NSGraphicsContext.inc #./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSImage.h > ../appkit/NSImage.inc diff --git a/lcl/interfaces/carbon/pascocoa/build/buildfoundation.sh b/lcl/interfaces/carbon/pascocoa/build/buildfoundation.sh index 2722bd3387..c5c66c038a 100755 --- a/lcl/interfaces/carbon/pascocoa/build/buildfoundation.sh +++ b/lcl/interfaces/carbon/pascocoa/build/buildfoundation.sh @@ -5,8 +5,11 @@ LOCAL_INI="../build/foundation.ini" FRAMEWORK="/System/Library/Frameworks/Foundation.framework/Headers" #./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSObjCRuntime.h > ../foundation/NSObjCRuntime.inc #./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSArray.h > ../foundation/NSArray.inc +#./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSAttributedString.h > ../foundation/NSAttributedString.inc #./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSBundle.h > ../foundation/NSBundle.inc +#./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSData.h > ../foundation/NSData.inc #./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSDate.h > ../foundation/NSDate.inc +./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSDictionary.h > ../foundation/NSDictionary.inc #./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSRange.h > ../foundation/NSRange.inc #./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSString.h > ../foundation/NSString.inc #./objcparser -ini=$DEFAULT_INI -ini=$LOCAL_INI $FRAMEWORK/NSValue.h > ../foundation/NSValue.inc