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



#ifndef __gadgets_h
#define __gadgets_h


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

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

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

/****************************************************************************
 * Gadgets (generic)                                                        *
 ****************************************************************************/

#ifndef Window_SWIChunkBase
#define Window_SWIChunkBase    0x82880
#endif

typedef struct
{
  unsigned int    flags;
  int             type;
  BBox            box;
  ComponentId     component_id;
  char            *help_message;
  int             max_help;
} GadgetHeader;


/*-- generic gadget flags --*/

#define Gadget_Faded         (1u<<31)
#define Gadget_AtBack        (1u<<30)


/*-- generic gadget methods --*/

#define Gadget_Base                    64
#define Gadget_GetFlags                (Gadget_Base + 0)           /* 64 */
#define Gadget_SetFlags                (Gadget_Base + 1)           /* 65 */
#define Gadget_SetHelpMessage          (Gadget_Base + 2)           /* 66 */
#define Gadget_GetHelpMessage          (Gadget_Base + 3)           /* 67 */
#define Gadget_GetIconList             (Gadget_Base + 4)           /* 68 */
#define Gadget_SetFocus                (Gadget_Base + 5)           /* 69 */
#define Gadget_GetType                 (Gadget_Base + 6)           /* 70 */
#define Gadget_MoveGadget              (Gadget_Base + 7)           /* 71 */
#define Gadget_GetBBox                 (Gadget_Base + 8)           /* 72 */
#define Gadget_Max                     (Gadget_Base + 63)          /* 127 */


/****************************************************************************
 * 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        : gadget_get_bbox
 * Description : Returns the bounding box of a gadget
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId gadget
 *               BBox *box
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *gadget_get_bbox ( unsigned int flags,
                                           ObjectId window,
                                           ComponentId gadget,
                                           BBox *box
                                         );


/*
 * Name        : gadget_set_focus
 * Description : Sets the focus on a window to a given component
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId component
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *gadget_set_focus ( unsigned int flags,
                                           ObjectId window,
                                           ComponentId component
                                         );


/*
 * Name        : gadget_get_type
 * Description : Gets the type for the specified gadget
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId gadget
 * Out         : int *type
 * Returns     : pointer to error block
 */

extern _kernel_oserror *gadget_get_type ( unsigned int flags,
                                          ObjectId window,
                                          ComponentId gadget,
                                          int *type
                                        );


/*
 * Name        : gadget_move_gadget
 * Description : Moves an already created gadget in the specified window
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId gadget
 *               const BBox *new_bbox
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *gadget_move_gadget ( unsigned int flags,
                                             ObjectId window,
                                             ComponentId gadget,
                                             const BBox *new_bbox
                                           );


/*
 * Name        : gadget_get_icon_list
 * Description : Gets a list of wimp icon numbers (integers) tha are associated with a gadget
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId gadget
 *               int *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *gadget_get_icon_list ( unsigned int flags,
                                               ObjectId window,
                                               ComponentId gadget,
                                               int *buffer,
                                               int buff_size,
                                               int *nbytes
                                             );


/*
 * Name        : gadget_get_help_message
 * Description : Gets the help message that is associated with a particular gadget
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId gadget
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *gadget_get_help_message ( unsigned int flags,
                                                  ObjectId window,
                                                  ComponentId gadget,
                                                  char *buffer,
                                                  int buff_size,
                                                  int *nbytes
                                                );


/*
 * Name        : gadget_set_help_message
 * Description : Sets the help message for a particular gadget
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId gadget
 *               const char *message_text
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *gadget_set_help_message ( unsigned int flags,
                                                  ObjectId window,
                                                  ComponentId gadget,
                                                  const char *message_text
                                                );


/*
 * Name        : gadget_set_flags
 * Description : Sets the flags for a particular gadget
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId gadget
 *               unsigned int new_flags_settings
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *gadget_set_flags ( unsigned int flags,
                                           ObjectId window,
                                           ComponentId gadget,
                                           unsigned int new_flags_settings
                                         );


/*
 * Name        : gadget_get_flags
 * Description : Gets the flags for a particular gadget
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId gadget
 * Out         : unsigned int *flags_settings
 * Returns     : pointer to error block
 */

extern _kernel_oserror *gadget_get_flags ( unsigned int flags,
                                           ObjectId window,
                                           ComponentId gadget,
                                           unsigned int *flags_settings
                                         );


#ifdef __cplusplus
  }
#endif




/****************************************************************************
 * Action button gadget                                                     *
 ****************************************************************************/

/*-- template definition --*/

typedef struct
{
  char          *text;
  int           max_text_len;
  char          *click_show;
  int           event;

} ActionButton;

#define ActionButton_IsDefault          0x00000001
#define ActionButton_IsCancel           0x00000002
#define ActionButton_IsLocal            0x00000004
#define ActionButton_ClickShowTransient 0x00000008
#define ActionButton_ClickShowCentred   0x00000010
#define ActionButton_ClickShowAtPointer 0x00000020


/*-- action button methods --*/

#define ActionButton_Base              (Gadget_Max + 1)             /* 128 */
#define ActionButton_SetText           (ActionButton_Base + 0)      /* 128 */
#define ActionButton_GetText           (ActionButton_Base + 1)      /* 129 */
#define ActionButton_SetEvent          (ActionButton_Base + 2)      /* 130 */
#define ActionButton_GetEvent          (ActionButton_Base + 3)      /* 131 */
#define ActionButton_SetClickShow      (ActionButton_Base + 4)      /* 132 */
#define ActionButton_GetClickShow      (ActionButton_Base + 5)      /* 133 */
#define ActionButton_SetFont           (ActionButton_Base + 6)      /* 134 */
#define ActionButton_Max               (ActionButton_Base + 63)     /* 191 */
#if (ActionButton_Base % 64 != 0)
#error "Gadget codes out of sync"
#endif


/*-- action button events --*/

#define ActionButton_Selected          (Window_SWIChunkBase + 1)

typedef struct
{
  ToolboxEventHeader hdr;
} ActionButtonSelectedEvent;

#define ActionButton_Selected_Adjust      0x00000001
#define ActionButton_Selected_Select      0x00000004
#define ActionButton_Selected_Default     0x00000008
#define ActionButton_Selected_Cancel      0x00000010
#define ActionButton_Selected_Local       0x00000020

/*-- action button SWI method constants --*/

#define ActionButton_SetClickShow_Transient   0x00000001
#define ActionButton_SetClickShow_Centre      0x00000002
#define ActionButton_SetClickShow_AtPointer   0x00000004
#define ActionButton_GetClickShow_Transient   ActionButton_SetClickShow_Transient
#define ActionButton_GetClickShow_Centre      ActionButton_SetClickShow_Centre
#define ActionButton_GetClickShow_AtPointer   ActionButton_SetClickShow_AtPointer

/****************************************************************************
 * 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        : actionbutton_set_text
 * Description : Sets the text that will be displayed in the specified action button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId action_button
 *               const char *text
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *actionbutton_set_text ( unsigned int flags,
                                                ObjectId window,
                                                ComponentId action_button,
                                                const char *text
                                              );


/*
 * Name        : actionbutton_get_text
 * Description : Gets the text that is currently displayed in the specified action button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId action_button
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *actionbutton_get_text ( unsigned int flags,
                                                ObjectId window,
                                                ComponentId action_button,
                                                char *buffer,
                                                int buff_size,
                                                int *nbytes
                                              );


/*
 * Name        : actionbutton_set_event
 * Description : Sets the toolbox event that will be raised when the button is clicked
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId action_button
 *               int event
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *actionbutton_set_event ( unsigned int flags,
                                                 ObjectId window,
                                                 ComponentId action_button,
                                                 int event
                                               );


/*
 * Name        : actionbutton_get_event
 * Description : Gets the toolbox event code that is raised when the button is clicked
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId action_button
 * Out         : int *event
 * Returns     : pointer to error block
 */

extern _kernel_oserror *actionbutton_get_event ( unsigned int flags,
                                                 ObjectId window,
                                                 ComponentId action_button,
                                                 int *event
                                               );


/*
 * Name        : actionbutton_set_click_show
 * Description : Sets the Id of the object to show when the button is clicked
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId action_button
 *               ObjectId object
 *               unsigned int show_flags
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *actionbutton_set_click_show ( unsigned int flags,
                                                      ObjectId window,
                                                      ComponentId action_button,
                                                      ObjectId object,
                                                      unsigned int show_flags
                                                    );


/*
 * Name        : actionbutton_get_click_show
 * Description : Gets the Id of the object that will be shown when button is clicked
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId action_button
 * Out         : ObjectId *object
 *               unsigned int *show_flags
 * Returns     : pointer to error block
 */

extern _kernel_oserror *actionbutton_get_click_show ( unsigned int flags,
                                                      ObjectId window,
                                                      ComponentId action_button,
                                                      ObjectId *object,
                                                      unsigned int *show_flags
                                                    );

/*
 * Name        : actionbutton_set_font
 * Description : Sets the display font for the specified action button (Requires Wimp >= 380)
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId action_button
 *               const char *font_name
 *               unsigned int width
 *               unsigned int height
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *actionbutton_set_font ( unsigned int flags,
                                                ObjectId window,
                                                ComponentId action_button,
                                                const char *font_name,
                                                unsigned int width,
                                                unsigned int height
                                              );

#ifdef __cplusplus
  }
#endif





/****************************************************************************
 * Option Button gadget                                                     *
 ****************************************************************************/

/*-- template definition --*/

typedef struct
{
  char          *label;
  int           max_label_len;
  int           event;
} OptionButton;


#define OptionButton_GenerateUserStateChanged  0x00000001
#define OptionButton_On                        0x00000004


/*-- option button methods --*/

#define OptionButton_Base              (ActionButton_Max + 1)       /* 192 */
#define OptionButton_SetLabel          (OptionButton_Base + 0)      /* 192 */
#define OptionButton_GetLabel          (OptionButton_Base + 1)      /* 193 */
#define OptionButton_SetEvent          (OptionButton_Base + 2)      /* 194 */
#define OptionButton_GetEvent          (OptionButton_Base + 3)      /* 195 */
#define OptionButton_SetState          (OptionButton_Base + 4)      /* 196 */
#define OptionButton_GetState          (OptionButton_Base + 5)      /* 197 */
#define OptionButton_Max               (OptionButton_Base + 63)     /* 255 */
#if (OptionButton_Base % 64 != 0)
#error "Gadget codes out of sync"
#endif


/*-- option button events --*/

#define OptionButton_StateChanged      (Window_SWIChunkBase + 2)

typedef struct
{
  ToolboxEventHeader hdr;
  int                new_state;
} OptionButtonStateChangedEvent;

#define OptionButton_StateChanged_Adjust  0x00000001
#define OptionButton_StateChanged_Select  0x00000004




/****************************************************************************
 * 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        : optionbutton_get_label
 * Description : Gets the label text for the specified option button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId option_button
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *optionbutton_get_label ( unsigned int flags,
                                                 ObjectId window,
                                                 ComponentId option_button,
                                                 char *buffer,
                                                 int buff_size,
                                                 int *nbytes
                                               );


/*
 * Name        : optionbutton_set_label
 * Description : Sets the text of the label for the specified option button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId option_button
 *               const char *label
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *optionbutton_set_label ( unsigned int flags,
                                                 ObjectId window,
                                                 ComponentId option_button,
                                                 const char *label
                                               );


/*
 * Name        : optionbutton_set_event
 * Description : Sets the toolbox event that will be raised when the button is clicked
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId option_button
 *               int event
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *optionbutton_set_event ( unsigned int flags,
                                                 ObjectId window,
                                                 ComponentId option_button,
                                                 int event
                                               );


/*
 * Name        : optionbutton_get_event
 * Description : Gets the toolbox event that is raised when the button is clicked
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId option_button
 * Out         : int *event
 * Returns     : pointer to error block
 */

extern _kernel_oserror *optionbutton_get_event ( unsigned int flags,
                                                 ObjectId window,
                                                 ComponentId option_button,
                                                 int *event
                                               );


/*
 * Name        : optionbutton_set_state
 * Description : Sets the on/off state of the specified option button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId option_button
 *               int state
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *optionbutton_set_state ( unsigned int flags,
                                                 ObjectId window,
                                                 ComponentId option_button,
                                                 int state
                                               );


/*
 * Name        : optionbutton_get_state
 * Description : Gets the on/off state of the specified option button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId option_button
 * Out         : int *state
 * Returns     : pointer to error block
 */

extern _kernel_oserror *optionbutton_get_state ( unsigned int flags,
                                                 ObjectId window,
                                                 ComponentId option_button,
                                                 int *state
                                               );


#ifdef __cplusplus
  }
#endif





/****************************************************************************
 * Labelled box Gadget                                                      *
 ****************************************************************************/

/*-- template definition --*/

typedef struct
{
  char        *label;
} LabelledBox;

#define LabelledBox_Sprite          0x00000001
#define LabelledBox_SpriteIsFilled  0x00000002


/*-- labelled box methods --*/

#define LabelledBox_Base               (OptionButton_Max + 1)       /* 256 */
/* none defined yet */
#define LabelledBox_Max                (LabelledBox_Base + 63)      /* 319 */
#if (LabelledBox_Base % 64 != 0)
#error "Gadget codes out of sync"
#endif



/****************************************************************************
 * Label Gadget                                                             *
 ****************************************************************************/

/*-- template definition --*/

typedef struct
{
  char        *label;
} Label;

/*-- Flags --*/

#define Label_NoBox         0x00000001
#define Label_LeftJustify   0x00000000
#define Label_RightJustify  0x00000002
#define Label_Centred       0x00000004

/*-- Flags mask --*/

#define Label_Justification 0x00000006 /* Bits 1-2 */


/*-- label methods --*/

#define Label_Base                     (LabelledBox_Max + 1)       /* 320 */
/* none defined yet */
#define Label_Max                      (Label_Base + 63)           /* 383 */
#if (Label_Base % 64 != 0)
#error "Gadget codes out of sync"
#endif



/****************************************************************************
 * Radio button gadget                                                      *
 ****************************************************************************/

/*-- template definition --*/

typedef struct
{
  int         group_number;
  char        *label;
  int         max_label_len;
  int         event;
} RadioButton;


#define RadioButton_GenerateUserStateChanged  0x00000001
#define RadioButton_GenerateSetStateChanged   0x00000002
#define RadioButton_On                        0x00000004


/*-- radio button methods --*/

#define RadioButton_Base               (Label_Max + 1)              /* 384 */
#define RadioButton_SetLabel           (RadioButton_Base + 0)       /* 384 */
#define RadioButton_GetLabel           (RadioButton_Base + 1)       /* 385 */
#define RadioButton_SetEvent           (RadioButton_Base + 2)       /* 386 */
#define RadioButton_GetEvent           (RadioButton_Base + 3)       /* 387 */
#define RadioButton_SetState           (RadioButton_Base + 4)       /* 388 */
#define RadioButton_GetState           (RadioButton_Base + 5)       /* 389 */
#define RadioButton_SetFont            (RadioButton_Base + 6)       /* 390 */
#define RadioButton_Max                (RadioButton_Base + 63)      /* 447 */
#if (RadioButton_Base % 64 != 0)
#error "Gadget codes out of sync"
#endif


/*-- radio button events --*/

#define RadioButton_StateChanged        (Window_SWIChunkBase + 3)

typedef struct
{
  ToolboxEventHeader hdr;
  int                state;
  ComponentId        old_on_button;
} RadioButtonStateChangedEvent;

#define RadioButton_StateChanged_Adjust    0x00000001
#define RadioButton_StateChanged_Select    0x00000004




/****************************************************************************
 * 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        : radiobutton_get_label
 * Description : Gets the label text for the specified radio button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId radio_button
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *radiobutton_get_label ( unsigned int flags,
                                                ObjectId window,
                                                ComponentId radio_button,
                                                char *buffer,
                                                int buff_size,
                                                int *nbytes
                                              );


/*
 * Name        : radiobutton_get_state
 * Description : Gets the on/off state of the specified radio button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId radio_button
 * Out         : int *state
                 ComponentId *selected
 * Returns     : pointer to error block
 */

extern _kernel_oserror *radiobutton_get_state ( unsigned int flags,
                                                ObjectId window,
                                                ComponentId radio_button,
                                                int *state,
                                                ComponentId *selected
                                              );


/*
 * Name        : radiobutton_set_state
 * Description : Sets the on/off state of the specified radio button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId radio_button
 *               int state
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *radiobutton_set_state ( unsigned int flags,
                                                ObjectId window,
                                                ComponentId radio_button,
                                                int state
                                              );


/*
 * Name        : radiobutton_get_event
 * Description : Gets the toolbox event that is raised when the button is clicked
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId radio_button
 * Out         : int *event
 * Returns     : pointer to error block
 */

extern _kernel_oserror *radiobutton_get_event ( unsigned int flags,
                                                ObjectId window,
                                                ComponentId radio_button,
                                                int *event
                                              );


/*
 * Name        : radiobutton_set_event
 * Description : Sets the toolbox event that will be raised when the button is clicked
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId radio_button
 *               int event
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *radiobutton_set_event ( unsigned int flags,
                                                ObjectId window,
                                                ComponentId radio_button,
                                                int event
                                              );


/*
 * Name        : radiobutton_set_label
 * Description : Sets the text of the label for the specified radio button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId radio_button
 *               const char *label
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *radiobutton_set_label ( unsigned int flags,
                                                ObjectId window,
                                                ComponentId radio_button,
                                                const char *label
                                              );


/*
 * Name        : radiobutton_set_font
 * Description : Sets the display font for the specified radio button (Requires Wimp >= 380)
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId radio_button
 *               const char *font_name
 *               unsigned int width
 *               unsigned int height
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *radiobutton_set_font ( unsigned int flags,
                                                ObjectId window,
                                                ComponentId radio_button,
                                                const char *font_name,
                                                unsigned int width,
                                                unsigned int height
                                              );

#ifdef __cplusplus
  }
#endif




/****************************************************************************
 * Display field gadget                                                     *
 ****************************************************************************/


/*-- template definition --*/

typedef struct
{
  char          *text;
  int           max_text_len;
} DisplayField;

#define DisplayField_GenerateValueChanged 0x00000001
#define DisplayField_LeftJustify          0x00000000
#define DisplayField_RightJustify         0x00000002
#define DisplayField_Centred              0x00000004
#define DisplayField_Justification        0x00000006




/*-- display field methods --*/

#define DisplayField_Base              (RadioButton_Max + 1)        /* 448 */
#define DisplayField_SetValue          (DisplayField_Base + 0)      /* 448 */
#define DisplayField_GetValue          (DisplayField_Base + 1)      /* 449 */
#define DisplayField_SetFont           (DisplayField_Base + 2)      /* 450 */
#define DisplayField_Max               (DisplayField_Base + 63)     /* 511 */
#if (DisplayField_Base % 64 != 0)
#error "Gadget codes out of sync"
#endif


/****************************************************************************
 * 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        : displayfield_set_font
 * Description : Sets the display font for the specified display
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId display_field
 *               const char *font_name
 *               int width
 *               int height
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *displayfield_set_font ( unsigned int flags,
                                                ObjectId window,
                                                ComponentId display_field,
                                                const char *font_name,
                                                int width,
                                                int height
                                              );


/*
 * Name        : displayfield_set_value
 * Description : Sets the text string to be shown in the specified display field
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId display_field
 *               const char *text
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *displayfield_set_value ( unsigned int flags,
                                                 ObjectId window,
                                                 ComponentId display_field,
                                                 const char *text
                                               );


/*
 * Name        : displayfield_get_value
 * Description : Gets the text that is current displayed in the specified display field
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId display_field
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *displayfield_get_value ( unsigned int flags,
                                                 ObjectId window,
                                                 ComponentId display_field,
                                                 char *buffer,
                                                 int buff_size,
                                                 int *nbytes
                                               );


#ifdef __cplusplus
  }
#endif




/****************************************************************************
 * Writable gadget                                                          *
 ****************************************************************************/

/*-- template definition --*/

typedef struct
{
  char            *text;
  int             max_text_len;
  char            *allowable;
  int             max_allowable_len ;
  ComponentId     before;
  ComponentId     after;
} WritableField;

#define WritableField_GenerateUserValueChanged 0x00000001
#define WritableField_GenerateSetValueChanged  0x00000002
#define WritableField_LeftJustify              0x00000000
#define WritableField_RightJustify             0x00000004
#define WritableField_Centred                  0x00000008
#define WritableField_Justification            0x0000000C
#define WritableField_Password                 0x00000010


/*-- writable field methods --*/

#define WritableField_Base             (DisplayField_Max + 1)       /* 512 */
#define WritableField_SetValue         (WritableField_Base + 0)     /* 512 */
#define WritableField_GetValue         (WritableField_Base + 1)     /* 513 */
#define WritableField_SetAllowable     (WritableField_Base + 2)     /* 514 */
#define WritableField_SetFont          (WritableField_Base + 4)     /* 516 */
#define WritableField_Max              (WritableField_Base + 63)    /* 575 */
#if (WritableField_Base % 64 != 0)
#error "Gadget codes out of sync"
#endif


/*-- writable field events --*/

#define WritableField_ValueChanged     (Window_SWIChunkBase + 5)

typedef struct
{
  ToolboxEventHeader hdr;
  char               string[sizeof(ToolboxEvent)-sizeof(ToolboxEventHeader)];
} WritableFieldValueChangedEvent;

#define WritableField_ValueChanged_TooLong  0x00000001




/****************************************************************************
 * 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        : writablefield_set_font
 * Description : Set the font for the specified writable field
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId writable_field
 *               const char *font_name
 *               int width
 *               int height
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *writablefield_set_font ( unsigned int flags,
                                                 ObjectId window,
                                                 ComponentId writable_field,
                                                 const char *font_name,
                                                 int width,
                                                 int height
                                               );


/*
 * Name        : writablefield_set_allowable
 * Description : Sets the allowable characters string for the specified writable
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId writable
 *               const char *allowed
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *writablefield_set_allowable ( unsigned int flags,
                                                      ObjectId window,
                                                      ComponentId writable,
                                                      const char *allowed
                                                    );


/*
 * Name        : writablefield_set_value
 * Description : Sets the text string to be shown in the specified writable
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId writable
 *               const char *text
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *writablefield_set_value ( unsigned int flags,
                                                  ObjectId window,
                                                  ComponentId writable,
                                                  const char *text
                                                );


/*
 * Name        : writablefield_get_value
 * Description : Gets the text that is current displayed in the specified writable
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId writable
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *writablefield_get_value ( unsigned int flags,
                                                  ObjectId window,
                                                  ComponentId writable,
                                                  char *buffer,
                                                  int buff_size,
                                                  int *nbytes
                                                );


#ifdef __cplusplus
  }
#endif




/****************************************************************************
 * Slider gadget                                                            *
 ****************************************************************************/

/*-- template definition --*/

typedef struct
{
  int           lower_bound,
                upper_bound,
                step_size,
                initial_value;
} Slider;

#define Slider_GenerateValueChangedEndOfDrag  0x00000001
#define Slider_GenerateValueChangedDuringDrag 0x00000002
#define Slider_GenerateSetValueChanged        0x00000004
#define Slider_Vertical                       0x00000008
#define Slider_Draggable                      0x00000010
#define Slider_BarColour                      0x0000F000
#define Slider_BarColourShift                 12
#define Slider_BackgroundColour               0x000F0000
#define Slider_BackgroundColourShift          16


/*-- slider methods --*/

#define Slider_Base                    (WritableField_Max + 1)      /* 576 */
#define Slider_SetValue                (Slider_Base + 0)            /* 576 */
#define Slider_GetValue                (Slider_Base + 1)            /* 577 */
#define Slider_SetBounds               (Slider_Base + 2)            /* 578 */
#define Slider_GetBounds               (Slider_Base + 3)            /* 579 */
#define Slider_SetColour               (Slider_Base + 4)            /* 580 */
#define Slider_GetColour               (Slider_Base + 5)            /* 581 */
#define Slider_Max                     (Slider_Base + 63)           /* 639 */
#if (Slider_Base % 64 != 0)
#error "Gadget codes out of sync"
#endif


/*-- slider events --*/

#define Slider_ValueChanged            (Window_SWIChunkBase + 6)

typedef struct
{
  ToolboxEventHeader  hdr;
  int                 new_value;
} SliderValueChangedEvent;

#define Slider_ValueChanged_EndOfDrag       1
#define Slider_ValueChanged_DuringDrag      2

/*-- slider method constants --*/

#define Slider_LowerBound                   0x00000001
#define Slider_UpperBound                   0x00000002
#define Slider_StepSize                     0x00000004

/****************************************************************************
 * 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        : slider_get_colour
 * Description : Gets the desktop colour that is used for the drabbable part of the slider
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId slider
 * Out         : int *bar_colour
 *               int *back_colour
 * Returns     : pointer to error block
 */

extern _kernel_oserror *slider_get_colour ( unsigned int flags,
                                            ObjectId window,
                                            ComponentId slider,
                                            int *bar_colour,
                                            int *back_colour
                                          );


/*
 * Name        : slider_set_colour
 * Description : Sets the desktop colour for the draggable bar in the specified slider
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId slider
 *               int bar_colour
 *               int back_colour
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *slider_set_colour ( unsigned int flags,
                                            ObjectId window,
                                            ComponentId slider,
                                            int bar_colour,
                                            int back_colour
                                          );


/*
 * Name        : slider_get_bounds
 * Description : Gets the upper/lower and step size for the specified slider
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId slider
 * Out         : int *lower_bound
 *               int *upper_bound
 *               int *step_size
 * Returns     : pointer to error block
 */

extern _kernel_oserror *slider_get_bounds( unsigned int flags,
                                           ObjectId window,
                                           ComponentId slider,
                                           int *lower_bound,
                                           int *upper_bound,
                                           int *step_size
                                         );


/*
 * Name        : slider_set_bounds
 * Description : Sets the lower/upper bounds and step size for the specified slider
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId slider
 *               int lower_bound
 *               int upper_bound
 *               int step_size
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *slider_set_bounds( unsigned int flags,
                                           ObjectId window,
                                           ComponentId slider,
                                           int lower_bound,
                                           int upper_bound,
                                           int step_size
                                         );


/*
 * Name        : slider_get_value
 * Description : Gets the current value for the specified slider
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId slider
 * Out         : int *value
 * Returns     : pointer to error block
 */

extern _kernel_oserror *slider_get_value ( unsigned int flags,
                                           ObjectId window,
                                           ComponentId slider,
                                           int *value
                                         );


/*
 * Name        : slider_set_value
 * Description : Sets the value of the specified slider
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId slider
 *               int value
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *slider_set_value ( unsigned int flags,
                                           ObjectId window,
                                           ComponentId slider,
                                           int value
                                         );


#ifdef __cplusplus
  }
#endif




/****************************************************************************
 * Draggable gadget                                                         *
 ****************************************************************************/

/*-- template definition --*/

typedef struct
{
  char          *text;
  int           max_text_len;
  char          *sprite;
  int           max_sprite_len;
} Draggable;

#define Draggable_GenerateDragStarted         0x00000001
#define Draggable_Sprite                      0x00000002
#define Draggable_Text                        0x00000004
#define Draggable_TypeMask                    0x00000038
#define Draggable_TypeShift                   3
#define Draggable_ToolboxIds                  0x00000040
#define Draggable_HasDropShadow               0x00000080
#define Draggable_NotDithered                 0x00000100

/*-- draggable methods --*/

#define Draggable_Base                 (Slider_Max + 1)             /* 640 */
#define Draggable_SetSprite            (Draggable_Base + 0)         /* 640 */
#define Draggable_GetSprite            (Draggable_Base + 1)         /* 641 */
#define Draggable_SetText              (Draggable_Base + 2)         /* 642 */
#define Draggable_GetText              (Draggable_Base + 3)         /* 643 */
#define Draggable_SetState             (Draggable_Base + 4)         /* 644 */
#define Draggable_GetState             (Draggable_Base + 5)         /* 645 */
#define Draggable_Max                  (Draggable_Base + 63)        /* 703 */
#if (Draggable_Base % 64 != 0)
#error "Gadget codes out of sync"
#endif


/*-- draggable events --*/

#define Draggable_DragStarted          (Window_SWIChunkBase + 7)
#define Draggable_DragEnded            (Window_SWIChunkBase + 8)


typedef struct
{
  ToolboxEventHeader    hdr;
} DraggableDragStartedEvent;

#define Draggable_DragStarted_Adjust  0x00000001
#define Draggable_DragStarted_Select  0x00000004
#define Draggable_DragStarted_Shift   0x00000008
#define Draggable_DragStarted_Ctrl    0x00000010


typedef struct
{
  ToolboxEventHeader  hdr;
  int                 window_handle;
  int                 icon_handle;
  int                 x;
  int                 y;
} DraggableDragEndedEvent;

#define Draggable_DragEndedOnToolboxWindow      0x00000001


/****************************************************************************
 * 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        : draggable_get_state
 * Description : Gets the selection state of the specified draggable
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId draggable
 * Out         : int *state
 * Returns     : pointer to error block
 */

extern _kernel_oserror *draggable_get_state ( unsigned int flags,
                                              ObjectId window,
                                              ComponentId draggable,
                                              int *state
                                            );


/*
 * Name        : draggable_set_state
 * Description : Sets the selection state of the specified draggable
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId draggable
 *               int state
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *draggable_set_state ( unsigned int flags,
                                              ObjectId window,
                                              ComponentId draggable,
                                              int state
                                            );


/*
 * Name        : draggable_get_sprite
 * Description : Gets the sprite that is currently being used for the draggable
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId draggable
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *draggable_get_sprite ( unsigned int flags,
                                               ObjectId window,
                                               ComponentId draggable,
                                               char *buffer,
                                               int buff_size,
                                               int *nbytes
                                             );


/*
 * Name        : draggable_set_sprite
 * Description : Sets the name of the sprite to be used for specified draggable
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId draggable
 *               const char *sprite_name
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *draggable_set_sprite ( unsigned int flags,
                                               ObjectId window,
                                               ComponentId draggable,
                                               const char *sprite_name
                                             );


/*
 * Name        : draggable_set_text
 * Description : Sets the text to be shown in the specified draggable
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId draggable
 *               const char *text
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *draggable_set_text ( unsigned int flags,
                                             ObjectId window,
                                             ComponentId draggable,
                                             const char *text
                                           );


/*
 * Name        : draggable_get_text
 * Description : Gets the text that is shown in the specified draggable
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId draggable
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *draggable_get_text ( unsigned int flags,
                                             ObjectId window,
                                             ComponentId draggable,
                                             char *buffer,
                                             int buff_size,
                                             int *nbytes
                                           );


#ifdef __cplusplus
  }
#endif







/****************************************************************************
 * PopUp menu gadget                                                        *
 ****************************************************************************/

/*-- template definition --*/

typedef struct
{
  char          *menu;
} PopUp;

#define PopUp_GenerateAboutToBeShown          0x00000001


/*-- popup menu methods --*/

#define PopUp_Base                     (Draggable_Max + 1)          /* 704 */
#define PopUp_SetMenu                  (PopUp_Base + 0)             /* 704 */
#define PopUp_GetMenu                  (PopUp_Base + 1)             /* 705 */
#define PopUp_Max                      (PopUp_Base + 63)            /* 767 */
#if (PopUp_Base % 64 != 0)
#error "Gadget codes out of sync"
#endif


/*-- popup menu events --*/

#define PopUp_AboutToBeShown       (Window_SWIChunkBase + 11)

typedef struct
{
  ToolboxEventHeader  hdr;
  ObjectId            menu_id;
  int                 show_type;
  TopLeft             pos;
}PopUpAboutToBeShownEvent;





/****************************************************************************
 * 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        : popup_get_menu
 * Description : Gets the menu object id that will be shown when the popup is clicked
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId popup
 * Out         : ObjectId *menu
 * Returns     : pointer to error block
 */

extern _kernel_oserror *popup_get_menu ( unsigned int flags,
                                         ObjectId window,
                                         ComponentId popup,
                                         ObjectId *menu
                                       );


/*
 * Name        : popup_set_menu
 * Description : Sets the menu object id that will be shown when the popup is clicked
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId popup
 *               ObjectId menu
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *popup_set_menu ( unsigned int flags,
                                         ObjectId window,
                                         ComponentId popup,
                                         ObjectId menu
                                       );


#ifdef __cplusplus
  }
#endif




/****************************************************************************
 * Adjuster gadget                                                          *
 ****************************************************************************/

/*-- template definition --*/

typedef struct
{
  int                 dummy;
} Adjuster;

#define Adjuster_Increment                    0x00000001
#define Adjuster_Decrement                    0x00000000
#define Adjuster_UpDown                       0x00000002
#define Adjuster_LeftRight                    0x00000000


/*-- adjuster arrow methods --*/

#define AdjusterArrow_Base             (PopUp_Max + 1)              /* 768 */
/* none defined yet */
#define AdjusterArrow_Max              (AdjusterArrow_Base + 63)    /* 831 */
#if (AdjusterArrow_Base % 64 != 0)
#error "Gadget codes out of sync"
#endif


/*-- adjuster arrow events --*/

#define Adjuster_Clicked           (Window_SWIChunkBase + 12)

typedef struct
{
  ToolboxEventHeader  hdr;
  int                 direction;
} AdjusterClickedEvent;

#define Adjuster_Clicked_Down      0x00000000
#define Adjuster_Clicked_Up        0x00000001



/****************************************************************************
 * Number Range gadget                                                      *
 ****************************************************************************/


/*-- template definition --*/

typedef struct
{
  int               lower_bound,
                    upper_bound,
                    step_size,
                    initial_value;
  int               precision;
  ComponentId       before;
  ComponentId       after;
  int               display_length;
} NumberRange;

#define NumberRange_GenerateUserValueChanged  0x00000001
#define NumberRange_GenerateSetValueChanged   0x00000002
#define NumberRange_Writable                  0x00000004
#define NumberRange_HasNumericalDisplay       0x00000008
#define NumberRange_Adjusters                 0x00000010
#define NumberRange_NoSlider                  0x00000000
#define NumberRange_SliderType                0x00000020
#define NumberRange_SliderRight              (NumberRange_SliderType * 1)
#define NumberRange_SliderLeft               (NumberRange_SliderType * 2)
#define NumberRange_SliderColour              0x00000100   /* multiply by desktop colour number */
#define NumberRange_SliderTypeMask            0x000000E0

/*-- number range methods --*/

#define NumberRange_Base               (AdjusterArrow_Max + 1)      /* 832 */
#define NumberRange_SetValue           (NumberRange_Base + 0)       /* 832 */
#define NumberRange_GetValue           (NumberRange_Base + 1)       /* 833 */
#define NumberRange_SetBounds          (NumberRange_Base + 2)       /* 834 */
#define NumberRange_GetBounds          (NumberRange_Base + 3)       /* 835 */
#define NumberRange_GetComponents      (NumberRange_Base + 4)       /* 836 */
#define NumberRange_Max                (NumberRange_Base + 63)      /* 895 */
#if (NumberRange_Base % 64 != 0)
#error "Gadget codes out of sync"
#endif

/*-- flags for number range methods --*/

#define NumberRange_GetComponents_ReturnNumericalField  0x00000001
#define NumberRange_GetComponents_ReturnLeftAdjuster    0x00000002
#define NumberRange_GetComponents_ReturnRightAdjuster   0x00000004
#define NumberRange_GetComponents_ReturnSlider          0x00000008

#define NumberRange_LowerBound                          0x00000001
#define NumberRange_UpperBound                          0x00000002
#define NumberRange_StepSize                            0x00000004
#define NumberRange_Precision                           0x00000008

/*-- number range events --*/

#define NumberRange_ValueChanged   (Window_SWIChunkBase + 13)

typedef struct
{
  ToolboxEventHeader  hdr;
  int                 new_value;
} NumberRangeValueChangedEvent;


/****************************************************************************
 * 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        : numberrange_get_components
 * Description : Gets the component id's for the components which make the number range
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId number_range
 * Out         : ComponentId *numeric_field
 *               ComponentId *left_adjuster
 *               ComponentId *right_adjuster
 *               ComponentId *slider
 * Returns     : pointer to error block
 */

extern _kernel_oserror *numberrange_get_components ( unsigned int flags,
                                                     ObjectId window,
                                                     ComponentId number_range,
                                                     ComponentId *numeric_field,
                                                     ComponentId *left_adjuster,
                                                     ComponentId *right_adjuster,
                                                     ComponentId *slider
                                                   );


/*
 * Name        : numberrange_set_value
 * Description : Sets the value in the NumberRanges display area
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId number_range
 *               int value
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *numberrange_set_value ( unsigned int flags,
                                                ObjectId window,
                                                ComponentId number_range,
                                                int value
                                              );


/*
 * Name        : numberrange_get_value
 * Description : Gets the value that is in the NumberRanges display area
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId number_range
 * Out         : int *value
 * Returns     : pointer to error block
 */

extern _kernel_oserror *numberrange_get_value ( unsigned int flags,
                                                ObjectId window,
                                                ComponentId number_range,
                                                int *value
                                              );


/*
 * Name        : numberrange_set_bounds
 * Description : Sets the upper/lower bounds, step size and precision for the number range
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId number_range
 *               int lower_bound
 *               int upper_bound
 *               int step_size
 *               int precision
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *numberrange_set_bounds ( unsigned int flags,
                                                 ObjectId window,
                                                 ComponentId number_range,
                                                 int lower_bound,
                                                 int upper_bound,
                                                 int step_size,
                                                 int precision
                                               );


/*
 * Name        : numberrange_get_bounds
 * Description : Gets the lower/upper bounds, step size and precision for the number range
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId number_range
 * Out         : int *lower_bound
 *               int *upper_bound
 *               int *step_size
 *               int *precision
 * Returns     : pointer to error block
 */

extern _kernel_oserror *numberrange_get_bounds ( unsigned int flags,
                                                 ObjectId window,
                                                 ComponentId number_range,
                                                 int *lower_bound,
                                                 int *upper_bound,
                                                 int *step_size,
                                                 int *precision
                                               );


#ifdef __cplusplus
  }
#endif






/****************************************************************************
 * String set Gadget                                                        *
 ****************************************************************************/


/*-- template definition --*/

typedef struct
{
  char              *string_set;
  char              *title;
  char              *initial_selected_string;
  int               max_selected_string_len;
  char              *allowable;
  int               max_allowable_len;
  ComponentId       before;
  ComponentId       after;
} StringSet;

#define StringSet_GenerateUserValueChanged  0x00000001
#define StringSet_GenerateSetValueChanged   0x00000002
#define StringSet_Writable                  0x00000004
#define StringSet_GenerateAboutToBeShown    0x00000008
#define StringSet_NoDisplay                 0x00000010


/*-- flags for StringSet_GetComponents --*/

#define StringSet_GetComponents_ReturnAlphaNumericField   0x00000001
#define StringSet_GetComponents_ReturnPopUpMenu           0x00000002


/*-- string set methods --*/

#define StringSet_Base                 (NumberRange_Max + 1)        /* 896 */
#define StringSet_SetAvailable         (StringSet_Base + 0)         /* 896 */
#define StringSet_SetSelected          (StringSet_Base + 2)         /* 898 */
#define StringSet_GetSelected          (StringSet_Base + 3)         /* 899 */
#define StringSet_SetAllowable         (StringSet_Base + 4)         /* 900 */
#define StringSet_GetComponents        (StringSet_Base + 6)         /* 902 */
#define StringSet_SetFont              (StringSet_Base + 7)         /* 903 */
#define StringSet_Max                  (StringSet_Base + 63)        /* 959 */
#if (StringSet_Base % 64 != 0)
#error "Gadget codes out of sync"
#endif

/*-- string set method constants --*/

#define StringSet_IndexedSelection                      0x00000001

/*-- string set events --*/

#define StringSet_ValueChanged     (Window_SWIChunkBase + 14)
#define StringSet_AboutToBeShown   (Window_SWIChunkBase + 15)

typedef struct
{
  ToolboxEventHeader  hdr;
  char                string[sizeof(ToolboxEvent)-sizeof(ToolboxEventHeader)];
} StringSetValueChangedEvent;

#define StringSet_ValueChanged_TooLong  0x00000001

typedef struct
{
  ToolboxEventHeader  hdr;
} StringSetAboutToBeShownEvent;



/****************************************************************************
 * 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        : stringset_get_components
 * Description : Gets the components which make up the string set gadget
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId string_set
 * Out         : ComponentId *alphanumeric_field
 *               ComponentId *popup_menu
 * Returns     : pointer to error block
 */

extern _kernel_oserror *stringset_get_components ( unsigned int flags,
                                                   ObjectId window,
                                                   ComponentId string_set,
                                                   ComponentId *alphanumeric_field,
                                                   ComponentId *popup_menu
                                                 );


/*
 * Name        : stringset_set_selected
 * Description : Sets the string that is selected for the specified string set
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId string_set
 *               const char *string_to_select
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *stringset_set_selected ( unsigned int flags,
                                                 ObjectId window,
                                                 ComponentId string_set,
                                                 const char *string_to_select
                                               );


/*
 * Name        : stringset_get_selected
 * Description : Gets the string that is currently select in the specified string set
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId string_set
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 *  OR
 * Out         : int *selection
 * Returns     : pointer to error block
 */

extern _kernel_oserror *stringset_get_selected ( unsigned int flags,
                                                 ObjectId window,
                                                 ComponentId string_set,
                                                 ...
                                               );


/*
 * Name        : stringset_set_available
 * Description : Sets the list of available strings for the specified string set
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId string_set
 *               const char *strings
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *stringset_set_available ( unsigned int flags,
                                                  ObjectId window,
                                                  ComponentId string_set,
                                                  const char *strings
                                                );


/*
 * Name        : stringset_set_allowable
 * Description : Sets the allowable characters string for the specified string set
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId string_set
 *               const char *allowable
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *stringset_set_allowable ( unsigned int flags,
                                                  ObjectId window,
                                                  ComponentId string_set,
                                                  const char *allowable
                                                );

/*
 * Name        : stringset_set_font
 * Description : Sets the font for the specified string set
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId string_set
 *               const char *font_name
 *               unsigned int width
 *               unsigned int height
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *stringset_set_font ( unsigned int flags,
                                             ObjectId window,
                                             ComponentId string_set,
                                             const char *font_name,
                                             unsigned int width,
                                             unsigned int height
                                           );


#ifdef __cplusplus
  }
#endif




/****************************************************************************
 * Button Gadget                                                            *
 ****************************************************************************/


/*-- template definition --*/

typedef struct
{
        int           button_flags;
        char          *value;
        int           max_value;
        char          *validation;
        int           max_validation;
} Button;

#define Button_TaskSpriteArea               0x00000001
#define Button_AllowMenuClicks              0x00000002


/*-- button methods --*/

#define Button_Base                  (StringSet_Max + 1)          /* 960 */
#define Button_GetFlags              (Button_Base + 0)          /* 960 */
#define Button_SetFlags              (Button_Base + 1)          /* 961 */
#define Button_SetValue              (Button_Base + 2)          /* 962 */
#define Button_GetValue              (Button_Base + 3)          /* 963 */
#define Button_SetValidation         (Button_Base + 4)          /* 964 */
#define Button_GetValidation         (Button_Base + 5)          /* 965 */
#define Button_SetFont               (Button_Base + 6)          /* 966 */
#define Button_Max                   (Button_Base + 63)         /* 1023 */
#if (Button_Base % 64 != 0)
#error "Gadget codes out of sync"
#endif

#if (Button_Base != 960)
#error "Gadgets out of sync"
#endif



/****************************************************************************
 * 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        : button_get_flags
 * Description : Gets the flags for the specified button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId button
 * Out         : int *icon_flags
 * Returns     : pointer to error block
 */

extern _kernel_oserror *button_get_flags ( unsigned int flags,
                                           ObjectId window,
                                           ComponentId button,
                                           int *icon_flags
                                         );


/*
 * Name        : button_set_flags
 * Description : Sets the flags for the specified button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId button
 *               int clear_word
 *               int EOR_word
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *button_set_flags ( unsigned int flags,
                                           ObjectId window,
                                           ComponentId button,
                                           int clear_word,
                                           int EOR_word
                                         );


/*
 * Name        : button_set_value
 * Description : Sets the value (text or sprite name) for the specified button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId button
 *               const char *value
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *button_set_value ( unsigned int flags,
                                           ObjectId window,
                                           ComponentId button,
                                           const char *value
                                         );


/*
 * Name        : button_get_value
 * Description : Gets the current value for the specified button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId button
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *button_get_value ( unsigned int flags,
                                           ObjectId window,
                                           ComponentId button,
                                           char *buffer,
                                           int buff_size,
                                           int *nbytes
                                         );


/*
 * Name        : button_get_validation
 * Description : Gets the current validation string for the specified button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId button
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *button_get_validation ( unsigned int flags,
                                                ObjectId window,
                                                ComponentId button,
                                                char *buffer,
                                                int buff_size,
                                                int *nbytes
                                              );


/*
 * Name        : button_set_validation
 * Description : Sets the validation string for the specified button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId button
 *               const char *value
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *button_set_validation ( unsigned int flags,
                                                ObjectId window,
                                                ComponentId button,
                                                const char *value
                                              );


/*
 * Name        : button_set_font
 * Description : Sets the display font for the specified button
 * In          : unsigned int flags
 *               ObjectId window
 *               ComponentId button
 *               const char *font_name
 *               int width
 *               int height
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *button_set_font ( unsigned int flags,
                                          ObjectId window,
                                          ComponentId button,
                                          const char *font_name,
                                          int width,
                                          int height
                                        );




#ifdef __cplusplus
  }
#endif




/****************************************************************************
 * Gadget types                                                             *
 ****************************************************************************/

#define ActionButton_Type       (sizeof(ActionButton) +sizeof(GadgetHeader)) << 16      | ActionButton_Base
#define OptionButton_Type       (sizeof(OptionButton) +sizeof(GadgetHeader)) << 16      | OptionButton_Base
#define LabelledBox_Type        (sizeof(LabelledBox) +sizeof(GadgetHeader)) << 16       | LabelledBox_Base
#define RadioButton_Type        (sizeof(RadioButton) +sizeof(GadgetHeader)) << 16       | RadioButton_Base
#define DisplayField_Type       (sizeof(DisplayField) +sizeof(GadgetHeader)) << 16      | DisplayField_Base
#define WritableField_Type      (sizeof(WritableField) +sizeof(GadgetHeader)) << 16     | WritableField_Base
#define Slider_Type             (sizeof(Slider) +sizeof(GadgetHeader)) << 16            | Slider_Base
#define Draggable_Type          (sizeof(Draggable) +sizeof(GadgetHeader)) << 16         | Draggable_Base
#define PopUp_Type              (sizeof(PopUp) +sizeof(GadgetHeader)) << 16             | PopUp_Base
#define AdjusterArrow_Type      (sizeof(Adjuster) +sizeof(GadgetHeader)) << 16          | AdjusterArrow_Base
#define NumberRange_Type        (sizeof(NumberRange) +sizeof(GadgetHeader)) << 16       | NumberRange_Base
#define StringSet_Type          (sizeof(StringSet) +sizeof(GadgetHeader)) << 16         | StringSet_Base
#define Button_Type             (sizeof(Button) +sizeof(GadgetHeader)) << 16            | Button_Base






#endif


