#include "FiveMac.ch"
function Main()
MsgInfo( ChooseFont() )
return nil
#pragma BEGINDUMP
#include <fivemac.h>
HB_FUNC( CHOOSEFONT )
{
NSFontManager * fontManager = [ NSFontManager sharedFontManager ];
NSFontPanel * fontPanel = [ fontManager fontPanel:YES ];
[ fontPanel makeKeyAndOrderFront: fontPanel ];
// [ NSApp runModalForWindow: fontPanel ];
}
#pragma ENDDUMP
#include "FiveMac.ch"
function Main()
MsgInfo( ChooseFont() )
return nil
#pragma BEGINDUMP
#include <fivemac.h>
@interface FontPanelController : NSWindowController <NSWindowDelegate>
{
}
-( void ) changeFont: ( id ) sender;
-( void ) windowWillClose: ( id ) sender;
@end
@implementation FontPanelController
-( void ) changeFont: ( id ) sender
{
NSBeep();
}
- ( void ) windowWillClose: ( id ) sender
{
NSBeep();
[ NSApp abortModal ];
// hb_retc( [ [ sender font ].fontName cStringUsingEncoding : NSWindowsCP125$sCP1252StringEncoding ] );
hb_retc( "font name" );
}
@end
HB_FUNC( CHOOSEFONT )
{
NSFontManager * fontManager = [ NSFontManager sharedFontManager ];
NSFontPanel * fontPanel = [ fontManager fontPanel:YES ];
[ fontPanel setDelegate: [ [ FontPanelController alloc ] init ] ];
[ fontPanel makeKeyAndOrderFront: fontPanel ];
[ NSApp runModalForWindow: fontPanel ];
}
#pragma ENDDUMP
#include "FiveMac.ch"
function Main()
MsgInfo( ChooseFont() )
return nil
#pragma BEGINDUMP
#include <fivemac.h>
@interface FontPanelController : NSWindowController <NSWindowDelegate>
{
@public NSFont * font;
@public NSFont * newFont;
}
-( void ) changeFont: ( id ) sender;
-( void ) windowWillClose: ( id ) sender;
@end
@implementation FontPanelController
-( void ) changeFont: ( id ) sender
{
newFont = [ sender convertFont: font ];
}
- ( void ) windowWillClose: ( id ) sender
{
[ NSApp abortModal ];
hb_retc( [ [ ( newFont ? newFont: font ) displayName ] cStringUsingEncoding : NSWindowsCP1252StringEncoding ] );
}
@end
HB_FUNC( CHOOSEFONT )
{
NSFontManager * fontManager = [ NSFontManager sharedFontManager ];
NSFontPanel * fontPanel = [ fontManager fontPanel:YES ];
FontPanelController * fontPanelController = [ [ FontPanelController alloc ] init ];
[ fontPanel setDelegate: fontPanelController ];
fontPanelController->font = [ NSFont systemFontOfSize : 10 ];
[ fontPanel makeKeyAndOrderFront: fontPanel ];
[ NSApp runModalForWindow: fontPanel ];
}
#pragma ENDDUMP
#include "FiveMac.ch"
function Main()
MsgInfo( ChooseFont() )
return nil
HB_FUNC( FM_AVAILABLEFONTS )
{
NSArray * aFonts = [ [ NSFontManager sharedFontManager ] availableFonts ];
int i;
hb_reta( [ aFonts count ] );
for( i = 0; i < [ aFonts count ]; i++ )
hb_storvc( [ ( NSString * ) [ aFonts objectAtIndex: i ] cStringUsingEncoding : NSWindowsCP1252StringEncoding ], -1, i + 1 );
}
#include "FiveMac.ch"
function Main()
local oDlg, cVar
local aFonts := FM_availableFonts()
DEFINE DIALOG oDlg TITLE "Available fonts" SIZE 300, 300
@ 200, 50 COMBOBOX cVar ITEMS aFonts SIZE 200, 20 OF oDlg
ACTIVATE DIALOG oDlg CENTERED
return nil
Return to FiveMac / FivePhone (iPhone, iPad)
Users browsing this forum: No registered users and 4 guests