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
;
65 * We need this one to open the fonts.
67 if ( DiskfontBase
= OpenLibrary( "diskfont.library", 36 )) {
69 * We open the fonts ourselves since BGUI
70 * opens all fonts with OpenFont() which
71 * means that they have to be resident
74 if ( Button
= OpenDiskFont( &ButtonFont
)) {
75 if ( Info1
= OpenDiskFont( &Info1Font
)) {
76 if ( Info2
= OpenDiskFont( &Info2Font
)) {
78 * Create the window object.
80 WO_Window
= WindowObject
,
81 WINDOW_Title
, "Multi-Font Demo",
82 WINDOW_AutoAspect
, TRUE
,
83 WINDOW_LockHeight
, TRUE
,
86 VGroupObject
, HOffset( 4 ), VOffset( 4 ), Spacing( 4 ), GROUP_BackFill
, SHINE_RASTER
,
88 VGroupObject
, HOffset( 4 ), VOffset( 4 ), Spacing( 2 ),
89 FRM_Type
, FRTYPE_BUTTON
,
93 INFO_TextFormat
, IText1
,
96 INFO_FixTextWidth
, TRUE
,
98 BT_TextAttr
, &Info1Font
,
106 INFO_TextFormat
, IText2
,
109 INFO_FixTextWidth
, TRUE
,
111 BT_TextAttr
, &Info2Font
,
120 GO_Quit
= ButtonObject
,
125 BT_TextAttr
, &ButtonFont
,
129 EndObject
, FixMinHeight
,
139 * Assign the key to the button.
141 if ( GadgetKey( WO_Window
, GO_Quit
, "q" )) {
143 * try to open the window.
145 if ( window
= WindowOpen( WO_Window
)) {
147 * Obtain it's wait mask.
149 GetAttr( WINDOW_SigMask
, WO_Window
, &signal
);
158 while (( rc
= HandleEvent( WO_Window
)) != WMHI_NOMORE
) {
160 * Evaluate return code.
164 case WMHI_CLOSEWINDOW
:
172 Tell( "Could not open the window\n" );
174 Tell( "Could not assign gadget keys\n" );
176 * Disposing of the window object will
177 * also close the window if it is
178 * already opened and it will dispose of
179 * all objects attached to it.
181 DisposeObject( WO_Window
);
183 Tell( "Could not create the window object\n" );
186 Tell( "Could not open opal.font\n" );
189 Tell( "Could not open emerald.font\n" );
192 Tell( "Could not open diamond.font\n" );
193 CloseLibrary( DiskfontBase
);
195 Tell( "Could not open diskfont.library\n" );