6 * (C) Copyright 1998 Manuel Lemos.
7 * (C) Copyright 1995 Jaba Development.
8 * (C) Copyright 1995 Jan van den Baard.
12 * Revision 42.0 2000/05/09 22:20:00 mlemos
13 * Bumped to revision 42.0 before handing BGUI to AROS team
15 * Revision 41.11 2000/05/09 20:33:49 mlemos
16 * Bumped to revision 41.11
18 * Revision 1.2 2000/05/09 19:59:06 mlemos
19 * Merged with the branch Manuel_Lemos_fixes.
21 * Revision 1.1.2.1 1998/02/28 17:45:34 mlemos
28 dcc MultiFont.c -mi -ms -mRR -proto -lbgui
35 * Fonts used in the code.
37 struct TextAttr ButtonFont
= { "diamond.font", 12, FS_NORMAL
, FPF_DISKFONT
};
38 struct TextAttr Info1Font
= { "emerald.font", 17, FS_NORMAL
, FPF_DISKFONT
};
39 struct TextAttr Info2Font
= { "opal.font", 9, FS_NORMAL
, FPF_DISKFONT
};
41 struct TextFont
*Button
, *Info1
, *Info2
;
42 struct Library
*DiskfontBase
;
52 UBYTE
*IText1
= ISEQ_C ISEQ_HIGHLIGHT
"MultiFont";
53 UBYTE
*IText2
= ISEQ_C
"This demo shows you how you\n"
54 "can use different fonts inside a\n"
57 VOID
StartDemo( void )
59 struct Window
*window
;
60 Object
*WO_Window
, *GO_Quit
;
66 * We need this one to open the fonts.
68 if (( DiskfontBase
= OpenLibrary( "diskfont.library", 36 ))) {
70 * We open the fonts ourselves since BGUI
71 * opens all fonts with OpenFont() which
72 * means that they have to be resident
75 if (( Button
= OpenDiskFont( &ButtonFont
))) {
76 if (( Info1
= OpenDiskFont( &Info1Font
))) {
77 if (( Info2
= OpenDiskFont( &Info2Font
))) {
79 * Create the window object.
81 WO_Window
= WindowObject
,
82 WINDOW_Title
, "Multi-Font Demo",
83 WINDOW_AutoAspect
, TRUE
,
84 WINDOW_LockHeight
, TRUE
,
87 VGroupObject
, HOffset( 4 ), VOffset( 4 ), Spacing( 4 ), GROUP_BackFill
, SHINE_RASTER
,
89 VGroupObject
, HOffset( 4 ), VOffset( 4 ), Spacing( 2 ),
90 FRM_Type
, FRTYPE_BUTTON
,
94 INFO_TextFormat
, IText1
,
97 INFO_FixTextWidth
, TRUE
,
99 BT_TextAttr
, &Info1Font
,
107 INFO_TextFormat
, IText2
,
110 INFO_FixTextWidth
, TRUE
,
112 BT_TextAttr
, &Info2Font
,
121 GO_Quit
= ButtonObject
,
126 BT_TextAttr
, &ButtonFont
,
130 EndObject
, FixMinHeight
,
140 * Assign the key to the button.
142 if ( GadgetKey( WO_Window
, GO_Quit
, "q" )) {
144 * try to open the window.
146 if (( window
= WindowOpen( WO_Window
))) {
148 * Obtain it's wait mask.
150 GetAttr( WINDOW_SigMask
, WO_Window
, &signal
);
159 while (( rc
= HandleEvent( WO_Window
)) != WMHI_NOMORE
) {
161 * Evaluate return code.
165 case WMHI_CLOSEWINDOW
:
173 Tell( "Could not open the window\n" );
175 Tell( "Could not assign gadget keys\n" );
177 * Disposing of the window object will
178 * also close the window if it is
179 * already opened and it will dispose of
180 * all objects attached to it.
182 DisposeObject( WO_Window
);
184 Tell( "Could not create the window object\n" );
187 Tell( "Could not open opal.font\n" );
190 Tell( "Could not open emerald.font\n" );
193 Tell( "Could not open diamond.font\n" );
194 CloseLibrary( DiskfontBase
);
196 Tell( "Could not open diskfont.library\n" );