/* 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        : iconbar.h
 * Description : C veneers to the Methods provided by the iconbar class
 */



#ifndef __iconbar_h
#define __iconbar_h


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

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


/****************************************************************************
 * Iconbar templates                                                        *
 ****************************************************************************/

/*-- flags --*/

#define Iconbar_GenerateSelectAboutToBeShown  0x00000001
#define Iconbar_GenerateAdjustAboutToBeShown  0x00000002
#define Iconbar_ShowSelectTransient           0x00000004
#define Iconbar_ShowAdjustTransient           0x00000008
#define Iconbar_GenerateSelectClickedEvent    0x00000020
#define Iconbar_GenerateAdjustClickedEvent    0x00000040
#define Iconbar_ShowSelectCentred             0x00000080
#define Iconbar_ShowAdjustCentred             0x00000100
#define Iconbar_ShowSelectAtPointer           0x00000200
#define Iconbar_ShowAdjustAtPointer           0x00000400



/* template definition */

typedef struct
{
  unsigned int  flags;
  int           position;
  int           priority;
  char          *sprite_name;
  int           max_sprite;
  char          *text;
  int           max_text_len;
  char          *menu;
  int           select_event;
  int           adjust_event;
  char          *select_show;
  char          *adjust_show;
  char          *help_message;
  int           max_help;
} IconbarTemplate;



/****************************************************************************
 * Iconbar SWIs and Toolbox_MiscOp (methods) reason codes                   *
 ****************************************************************************/

#define Iconbar_SWIChunkBase    0x82900
#define Iconbar_ObjectClass     Iconbar_SWIChunkBase
#define Iconbar_ClassSWI        (Iconbar_SWIChunkBase + 0)
#define Iconbar_PostFilter      (Iconbar_SWIChunkBase + 1)
#define Iconbar_PreFilter       (Iconbar_SWIChunkBase + 2)


/*-- miscop reason codes --*/

#define Iconbar_GetIconHandle      0
#define Iconbar_SetMenu            1
#define Iconbar_GetMenu            2
#define Iconbar_SetEvent           3
#define Iconbar_GetEvent           4
#define Iconbar_SetShow            5
#define Iconbar_GetShow            6
#define Iconbar_SetHelpMessage     7
#define Iconbar_GetHelpMessage     8
#define Iconbar_SetText            9
#define Iconbar_GetText           10
#define Iconbar_SetSprite         11
#define Iconbar_GetSprite         12


/*-- flags for Iconbar_SetEvent --*/

#define Iconbar_SetEvent_Select   0x00000001
#define Iconbar_SetEvent_Adjust   0x00000002

/*-- flags for Iconbar_SetShow --*/

#define Iconbar_SetShow_Select    0x00000001
#define Iconbar_SetShow_Adjust    0x00000002



/****************************************************************************
 * Iconbar Toolbox events                                                   *
 ****************************************************************************/


/*-- event codes --*/

#define Iconbar_Clicked              (Iconbar_SWIChunkBase + 0)
#define Iconbar_SelectAboutToBeShown (Iconbar_SWIChunkBase + 1)
#define Iconbar_AdjustAboutToBeShown (Iconbar_SWIChunkBase + 2)



/*-- clicked event block --*/

#define Iconbar_Clicked_Adjust       0x00000001
#define Iconbar_Clicked_Select       0x00000004


typedef struct
{
  ToolboxEventHeader hdr;
} IconbarClickedEvent;



/*-- object about to be shown on SELECT/ADJUST click --*/

typedef struct
{
  ToolboxEventHeader hdr;
  ObjectId           id;
} IconbarAboutToBeShownEvent;


/****************************************************************************
 * 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        : iconbar_get_icon_handle
 * Description : Gets the underlying Wimp icon handler for the iconbar object
 * In          : unsigned int flags
 *               ObjectId iconbar
 * Out         : int *icon_handle
 * Returns     : pointer to error block
 */

extern _kernel_oserror *iconbar_get_icon_handle ( unsigned int flags,
                                                  ObjectId iconbar,
                                                  int *icon_handle
                                                );


/*
 * Name        : iconbar_set_menu
 * Description : Sets the menu which will be displayed when MENU is clicked over iconbar object
 * In          : unsigned int flags
 *               ObjectId iconbar
 *               ObjectId menu_id
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *iconbar_set_menu ( unsigned int flags,
                                           ObjectId iconbar,
                                           ObjectId menu_id
                                         );


/*
 * Name        : iconbar_get_menu
 * Description : Gets the menu which will be displayed when MENU is clicked over iconbar
 * In          : unsigned int flags
 *               ObjectId iconbar
 * Out         : ObjectId *menu_id
 * Returns     : pointer to error block
 */

extern _kernel_oserror *iconbar_get_menu ( unsigned int flags,
                                           ObjectId iconbar,
                                           ObjectId *menu_id
                                         );


/*
 * Name        : iconbar_set_event
 * Description : Sets events that will be raised when SELECT/ADJUST are clicked on iconbar
 * In          : unsigned int flags
 *               ObjectId iconbar
 *               int select_event
 *               int adjust_event
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *iconbar_set_event ( unsigned int flags,
                                            ObjectId iconbar,
                                            int select_event,
                                            int adjust_event
                                          );


/*
 * Name        : iconbar_get_event
 * Description : Gets events which will be raised when SELECT/ADJUST are clicked on iconbar
 * In          : unsigned int flags
 *               ObjectId iconbar
 * Out         : int *select_event
 *               int *adjust_event
 * Returns     : pointer to error block
 */

extern _kernel_oserror *iconbar_get_event ( unsigned int flags,
                                            ObjectId iconbar,
                                            int *select_event,
                                            int *adjust_event
                                          );


/*
 * Name        : iconbar_set_show
 * Description : Sets objects to be shown which SELECT/ADJUST are clicked on iconbar
 * In          : unsigned int flags
 *               ObjectId iconbar
 *               ObjectId select
 *               ObjectId adjust
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *iconbar_set_show ( unsigned int flags,
                                           ObjectId iconbar,
                                           ObjectId select,
                                           ObjectId adjust
                                         );


/*
 * Name        : iconbar_get_show
 * Description : Gets the objects that will be shown when SELECT/ADJUST are clicked on iconbar
 * In          : unsigned int flags
 *               ObjectId iconbar
 * Out         : ObjectId *select
 *               ObjectId *adjust
 * Returns     : pointer to error block
 */

extern _kernel_oserror *iconbar_get_show ( unsigned int flags,
                                           ObjectId iconbar,
                                           ObjectId *select,
                                           ObjectId *adjust
                                         );


/*
 * Name        : iconbar_set_help_message
 * Description : Sets the iconbar objects interactive help message
 * In          : unsigned int flags
 *               ObjectId iconbar
 *               const char *message_text
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *iconbar_set_help_message ( unsigned int flags,
                                                   ObjectId iconbar,
                                                   const char *message_text
                                                 );


/*
 * Name        : iconbar_get_help_message
 * Description : Gets the iconbar objects interactive help message
 * In          : unsigned int flags
 *               ObjectId iconbar
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *iconbar_get_help_message ( unsigned int flags,
                                                   ObjectId iconbar,
                                                   char *buffer,
                                                   int buff_size,
                                                   int *nbytes
                                                 );


/*
 * Name        : iconbar_set_text
 * Description : Sets the text string that will be used for text & sprite iconbar objects
 * In          : unsigned int flags
 *               ObjectId iconbar
 *               const char *text
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *iconbar_set_text ( unsigned int flags,
                                           ObjectId iconbar,
                                           const char *text
                                         );


/*
 * Name        : iconbar_get_text
 * Description : Gets the text string that will be used for text & sprite iconbar objects
 * In          : unsigned int flags
 *               ObjectId iconbar
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *iconbar_get_text ( unsigned int flags,
                                           ObjectId iconbar,
                                           char *buffer,
                                           int buff_size,
                                           int *nbytes
                                         );


/*
 * Name        : iconbar_set_sprite
 * Description : Sets the sprite to be used for the iconbar object
 * In          : unsigned int flags
 *               ObjectId iconbar
 *               const char *sprite_name
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *iconbar_set_sprite ( unsigned int flags,
                                             ObjectId iconbar,
                                             const char *sprite_name
                                           );


/*
 * Name        : iconbar_get_sprite
 * Description : Gets the sprite that is used for the iconbar object
 * In          : unsigned int flags
 *               ObjectId iconbar
 *               char *buffer
 *               int buff_len
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *iconbar_get_sprite ( unsigned int flags,
                                             ObjectId iconbar,
                                             char *buffer,
                                             int buff_len,
                                             int *nbytes
                                           );


#ifdef __cplusplus
  }
#endif




#endif
