fontselect 4.58 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
/* Copyright 2001 Pace Micro Technology plc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/****************************************************************************
 * This source file was written by Acorn Computers Limited. It is part of   *
 * the RISCOS library for writing applications in C for RISC OS. It may be  *
 * used freely in the creation of programs for Archimedes. It should be     *
 * used with Acorn's C Compiler Release 3 or later.                         *
 *                                                                          *
 ***************************************************************************/
/*
 * Title: fontselect.h
 * Purpose: Consistent interface to font choosing
 *
 */

#ifndef __fontselect_h
#define __fontselect_h


typedef BOOL (*fontselect_fn)(char *font_name, double width, double height, wimp_eventstr *event );

/* --------------------------- fontselect_init -----------------------------
 * Description:   Read in the font list and prepare data for the font selector window
 *
 * Parameters:
 * Returns:       TRUE if initialisation succeeded.
 * Other Info:
 */
int fontselect_init( void );




/* --------------------------- fontselect_closedown -----------------------------
 * Description:   Close the font selector windows if they are open, and free the font selector data structures
 *
 * Parameters:
 * Returns:
 * Other Info:    This call is provided to return the machine to the state it was in before a call of fontselect_init()
 */
void fontselect_closedown( void );



/* --------------------------- fontselect_closewindows -----------------------------
 * Description:   Close the font selector windows if they are open
 *
 * Parameters:
 * Returns:
 * Other Info:    This call will close the font selector windows and unattach the handlers, if they are open.
 */
void fontselect_closewindows( void );



/* --------------------------- fontselect_selector -----------------------------
 * Description:   Opens up or reopens the font chooser window.
 *
 * Parameters:    char *title                -- The title for the window (can be NULL if flags SETTITLE is clear)
 *                int flags                  -- The flags for the call (see below)
 *                char *font_name            -- The font name to set the window contents to (only if SETFONT is set)
 *                double width               -- The width in point size of the font
 *                double height              --
 *                fontselect_fn unknown_icon --
 * Returns:       The window handle of the font selector main window, if the function
 *                call was successful. Otherwise it returns 0.
 * Other Info:    The flags word allows the call to have different effects.
 *                    If fontselect_SETFONT is set then the window contents wil be updated to reflect the font choice passed in
 *                    If fontselect_SETTITLE is set then the title of the window will be set, otherwise title is ignored.
 *                    If fontselect_REOPEN is set then the font selector will only open the window if it is already open. This
 *                      lets the application update the contents of the window only if it is currently open.
 *                Note that the fontselect_init() must be called before this routine.
 */
int fontselect_selector( char *title, int flags, char *font_name, double width, double height, fontselect_fn unknown_icon_routine );

#define fontselect_REOPEN    0x001
#define fontselect_SETTITLE  0x002
#define fontselect_SETFONT   0x004



/* ---------------------------- fontselect_attach_menu ----------------------------
 * Description:   Attaches a menu to all four font selector windows
 *
 * Parameters:    menu mn                        -- menu to attach
 *                event_menu_proc menu_processor -- menu processor for the menu events
 *                void *handle                   -- handle to pass to the menu processor
 * Returns:       TRUE if the menus were attached, FALSE otherwise
 * Other Info:    none.
 */

BOOL fontselect_attach_menu( menu mn, event_menu_proc menu_processor, void *handle );



#endif


/* end fontselect.h */