/* Copyright 1997 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 toolbox library for writing desktop applications in C. It may be     *
 * used freely in the creation of programs for RISC OS.                     *
 *                                                                          *
 * Copyright  Acorn Computers Ltd, 1994                                    *
 *                                                                          *
 ***************************************************************************/



/*
 * Name        : fontmenu.h
 * Description : C veneers to the Methods provided by the fontmenu class
 */



#ifndef __fontmenu_h
#define __fontmenu_h


#ifndef __kernel_h
#include "kernel.h"
#endif

#ifndef __toolbox_h
#include "toolbox.h"
#endif

/****************************************************************************
 * Font Menu Templates                                                      *
 ****************************************************************************/

#define FontMenu_GenerateShowEvent     0x00000001
#define FontMenu_GenerateHideEvent     0x00000002
#define FontMenu_SystemFont            0x00000004

typedef struct
{
  unsigned int flags;
  char        *ticked_font;
} FontMenuTemplate;


/****************************************************************************
 * Font Menu SWI Calls                                                      *
 ****************************************************************************/

#define FontMenu_SWIChunkBase    0x82a40
#define FontMenu_ObjectClass     FontMenu_SWIChunkBase
#define FontMenu_ClassSWI        (FontMenu_SWIChunkBase + 0)
#define FontMenu_PostFilter      (FontMenu_SWIChunkBase + 1)
#define FontMenu_PreFilter       (FontMenu_SWIChunkBase + 2)


/****************************************************************************
 * Font Menu Methods                                                        *
 ****************************************************************************/

#define FontMenu_SetFont 0
#define FontMenu_GetFont 1


/****************************************************************************
 * Font Menu Toolbox Events                                                 *
 ****************************************************************************/

#define FontMenu_AboutToBeShown     FontMenu_SWIChunkBase
#define FontMenu_HasBeenHidden      (FontMenu_SWIChunkBase + 1)
#define FontMenu_Selection          (FontMenu_SWIChunkBase + 2)

typedef struct
{
  ToolboxEventHeader hdr;
  int                show_type;
  TopLeft            pos;
} FontMenuAboutToBeShownEvent;

typedef struct
{
  ToolboxEventHeader hdr;
} FontMenuHasBeenHiddenEvent;

typedef struct
{
  ToolboxEventHeader hdr;
  char               font_id[216];
} FontMenuSelectionEvent;


/****************************************************************************
 * The following functions provide veneers to the methods that are          *
 * associated with this particular class.  Please read the User Interface   *
 * Toolbox manual for more detailed information on their functionality.     *
 ****************************************************************************/


#ifdef __cplusplus
  extern "C" {
#endif


/*
 * Name        : fontmenu_get_font
 * Description : Gets the currently selected (ticked) font id for the specified font menu
 * In          : unsigned int flags
 *               ObjectId fontmenu
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *fontmenu_get_font ( unsigned int flags,
                                            ObjectId fontmenu,
                                            char *buffer,
                                            int buff_size,
                                            int *nbytes
                                          );


/*
 * Name        : fontmenu_set_font
 * Description : Set the font to be selected (ticked) in the specified font menu
 * In          : unsigned int flags
 *               ObjectId fontmenu
 *               const char *font_id
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *fontmenu_set_font ( unsigned int flags,
                                            ObjectId fontmenu,
                                            const char *font_id
                                          );


#ifdef __cplusplus
  }
#endif






#endif
