chiark / gitweb /
Initial revision
[ssr] / StraySrc / Libraries / Steel / h / fontMenu
1 /*
2  * fontMenu
3  *  creates (and handles) a hierarchical font menu
4  *
5  * v. 1.00 (22 August 1991)
6  *
7  * © 1991-1998 Straylight
8  */
9
10 /*----- Licensing note ----------------------------------------------------*
11  *
12  * This file is part of Straylight's Steel library.
13  *
14  * Steel is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2, or (at your option)
17  * any later version.
18  *
19  * Steel is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with Steel.  If not, write to the Free Software Foundation,
26  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27  */
28
29 #ifndef __fontMenu_h
30 #define __fontMenu_h
31
32 #ifndef __menu_h
33 #include "menu.h"
34 #endif
35
36 #ifndef __event_h
37 #include "event.h"
38 #endif
39
40 /*
41  * menu fontMenu_createFontMenu(BOOL includeSystem)
42  *
43  * Use
44  *  Creates a hierarchical font menu and returns a handle.  If the menu is
45  *  out-of-date it will be recreated, if not the old handle will be
46  *  returned.  You must call this before using routines such as
47  *  fontMenu_make() (so that the system knows whether you want to use a
48  *  menu containing the system font or not).  The returned pointer will be
49  *  NULL if there are no fonts.  
50  *
51  * Parameters
52  *  BOOL includeSystem == whether you want to include a 'System font' item
53  *
54  * Returns
55  *  A menu handle for the menu.
56  */
57
58 menu fontMenu_createFontMenu(BOOL includeSystem);
59
60 /*
61  * menu fontMenu(BOOL includeSystem)
62  *
63  * Use
64  *  Compatibility.  Don't use this function.
65  */
66
67 menu fontMenu(BOOL includeSystem);
68
69 /*
70  * char *fontMenu_fontname(int item1,int item2)
71  *
72  * Use
73  *  Returns the font name given by the the menu hit passed.  Example code:
74  *
75  *  switch (hit[n])
76  *  {
77  *    ...
78  *    case FONTMENU:
79  *      {
80  *        char *fontname=fontMenu_fontname(hit[n+1],hit[n+2]);
81  *        ...
82  *      }
83  *      break;
84  *    ...
85  *  }
86  *
87  *  Type promotion does the rest!  If the hits give a silly result, then a
88  *  null string (not a null pointer!) is returned.
89  *
90  *  You should check for the system font yourself (hit[n+1]==1).
91  *
92  * Parameters
93  *  int item1 == the item number in the main menu
94  *  int item2 == the item number in the submenu
95  *
96  * Returns
97  *  A pointer to a read-only string.
98  */
99
100 char *fontMenu_fontname(int item1,int item2);
101
102 /*
103  * void fontMenu_submenu(BOOL includeSystem)
104  *
105  * Use
106  *  Opens a font menu as the submenu of another menu.
107  *
108  * Parameters
109  *  BOOL includeSystem == whether we need to include a system font item.
110  */
111
112 void fontMenu_submenu(BOOL includeSystem);
113
114 /*
115  * void fontMenu_findFont(char *name,int *item1,int *item2)
116  *
117  * Use
118  *  Finds a font in the font list.  Returns the result in two integers,
119  *  which are the menu item numbers in the main font menu and the submenu
120  *  respectively.  -1 is returned as the first item number if the font
121  *  wasn't found.
122  *
123  * Parameters
124  *  char *name == the (case sensitive) name of the font.
125  *  int *item1 == where to store the first item number.
126  *  int *item2 == where to store the second item number.
127  */
128
129 void fontMenu_findFont(char *name,int *item1,int *item2);
130
131 /*
132  * void fontMenu_tick(int item1,int item2)
133  *
134  * Use
135  *  Ticks the item specified.  Only one font may be ticked at a time.  If
136  *  the menu item specified is silly, no item will be ticked.  No range
137  *  checking is performed.
138  *
139  * Parameters
140  *  int item1 == the item number in the main menu
141  *  int item2 == the item number in the submenu
142  */
143
144 void fontMenu_tick(int item1,int item2);
145
146 /*
147  * void fontMenu_tickGivenName(char *name)
148  *
149  * Use
150  *  Ticks the item specified by it's name.  If the name is silly, no item
151  *  will be ticked.
152  *
153  * Parameters
154  *  char *name == the font name to tick
155  */
156
157 void fontMenu_tickGivenName(char *name);
158
159 #endif