baricon 5.72 KB
Newer Older
Neil Turton's avatar
Neil Turton committed
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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
/* Copyright 1996 Acorn Computers Ltd
 *
 * 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: baricon.h
 * Purpose: Support placing of an icon on the icon bar.
 *
 */

#ifndef __baricon_h
#define __baricon_h

# ifndef __wimp_h
# include "wimp.h"
# endif

/* -------------------------baricon_clickproc---------------------- */

/* baricon_clickproc is the type of a function to be called when Select
 * is clicked.
 */

typedef void (*baricon_clickproc)(wimp_i);

/* ----------------------------- baricon -----------------------------------
 * Description:   Installs the named sprite as an icon on the right of the
 *                icon bar and registers a function to be called when Select
 *                is clicked.
 *
 * Parameters:    char *spritename     -- name of sprite to be used
 *                int spritearea       -- area in which sprite is held
 *                baricon_clickproc p  -- pointer to function to be
 *                                        called on left mouse click
 * Returns:       the icon number of the installed icon (of type wimp_i).
 *                This will be passed to function "p" on left mouse click.
 * Other info:    For details of installing a menu handler for this icon
 *                see event_attachmenu().
 */

wimp_i baricon(char *spritename, int spritearea, baricon_clickproc p);

/* -------------------------------- baricon_left --------------------------
 * Description:   Installs the named sprite as an icon on the left of the
 *                icon bar and regsiters a function to be called when Select
 *                is clicked.
 *
 * Parameters:    As for baricon, above.
 * Returns:       As for baricon, above.
 * Other info:    As for baricon, above.
 */

wimp_i baricon_left(char *spritename, int spritearea, baricon_clickproc p);

/* ----------------------------- baricon_textandsprite --------------------
 * Description:   Installs the named sprite as an icon on the right of the
 *                icon bar with some given text below it, and registers a
 *                function to be called when Select is clicked.
 *
 * Parameters:    char *spritename     -- name of sprite to be used
 *                char *text           -- text to appear under sprite
 *                int bufflen          -- length of text buffer
 *                int spritearea       -- area in which sprite is held
 *                baricon_clickproc p  -- pointer to function to be
 *                                        called on left mouse click
 * Returns:       the icon number of the installed icon (of type wimp_i).
 *                This will be passed to function "p" on left mouse click.
 * Other info:    For details of installing a menu handler for this icon
 *                see event_attachmenu().
 *                The width of the icon is taken as the greater of bufflen
 *                system font characters and the width of the sprite used.
 *
 */

wimp_i baricon_textandsprite(char *spritename, char *text,
                      int bufflen, int spritearea, baricon_clickproc p);

/* -------------------------- baricon_textandsprite_left ------------------
 * Description:   Installs the named sprite as an icon on the right of the
 *                icon bar with some given text below it, and registers a
 *                function to be called when Select is clicked.
 *
 * Parameters:    char *spritename     -- name of sprite to be used
 *                char *text           -- text to appear under sprite
 *                int bufflen          -- length of text buffer
 *                int spritearea       -- area in which sprite is held
 *                baricon_clickproc p  -- pointer to function to be
 *                                        called on left mouse click
 * Returns:       the icon number of the installed icon (of type wimp_i).
 *                This will be passed to function "p" on left mouse click.
 * Other info:    For details of installing a menu handler for this icon
 *                see event_attachmenu().
 *                The width of the icon is taken as the greater of bufflen
 *                system font characters and the width of the sprite used.
 *
 */

wimp_i baricon_textandsprite_left(char *spritename, char *text,
                      int bufflen, int spritearea, baricon_clickproc p);


/* ----------------------------- baricon_newsprite -------------------------
 * Description:   Changes the sprite used on the icon bar
 *
 * Parameters:    char *newsprite  -- name of new sprite to be used
 *
 * Returns:       the icon number of the installed icon sprite
 * Other Info:    Newsprite must be held in the same sprite area as
 *                the sprite used in baricon()
 *
 */

wimp_i baricon_newsprite(char *newsprite);

#endif

/* end baricon.h */