RISCOS.com

www.riscos.com Technical Support:
Acorn C/C++

 

The Wimp library


WimpLib provides a set of C veneers onto the Wimp (or Window Manager) SWI interface. For a description of the exact effect of a particular call, you should see the chapter The Window Manager at the start of Volume 3 of the RISC OS 3 Programmer's Reference Manual.

The section below lists in alphabetical order the functions provided by WimpLib. The functions' names are derived directly from the SWIs' names: for example, the veneer to call Wimp_CreateWindow is wimp_create_window. Each function has page references to the RISC OS 3 Programmer's Reference Manual - including ones, where relevant, to Volume 5 (the Supplement for version 3.5).

WimpLib does not provide access to every Wimp SWI: for example, the Filter related SWIs and Wimp_SetWatchDogState are omitted. Such SWIs still have an entry below under their expected function name, just so you can rapidly determine they are not supported. Although functions are provided for adding and removing Wimp messages, you must not use these in Toolbox applications.

Note that when a value is returned as a parameter (e.g. an integer value is returned by function (int input, int *output)), the pointer to the return value may be set to zero rather than provide a dummy variable.


Programmer interface

wimp_add_messages

_kernel_oserror *wimp_add_messages(int *list /* R0 in */);

This calls the SWI Wimp_AddMessages. You must not use this call in Toolbox applications.

wimp_base_of_sprites

_kernel_oserror *wimp_base_of_sprites(void **rom, /* R0 out */
                                      void **ram  /* R1 out */);

This calls the SWI Wimp_BaseOfSprites.

wimp_block_copy

_kernel_oserror *wimp_block_copy (int handle, /* R0 in */
                                  int sxmin,  /* R1 in */
                                  int symin,  /* R2 in */
                                  int sxmax,  /* R3 in */
                                  int symax,  /* R4 in */
                                  int dxmin,  /* R5 in */
                                  int dymin   /* R6 in */);

This calls the SWI Wimp_BlockCopy.

wimp_claim_free_memory

You might expect a function of this name to be provided to call Wimp_ClaimFreeMemory. However, such a function is not implemented by WimpLib.

wimp_close_down

_kernel_oserror *wimp_close_down (int th /* R0 in */);

This sets up R1 to be &4B534154 ('TASK'), and then calls the SWI Wimp_CloseDown.

wimp_close_template

_kernel_oserror *wimp_close_template (void);

This calls the SWI Wimp_CloseTemplate.

wimp_close_window

_kernel_oserror *wimp_close_window (int window_handle /* R1 in */);

This calls the SWI Wimp_CloseWindow.

wimp_command_window

_kernel_oserror *wimp_command_window (int type /* R0 in */);

This calls the SWI Wimp_CommandWindow.

wimp_create_icon

_kernel_oserror *wimp_create_icon (int                  priority, /* R0 in */
                                   WimpCreateIconBlock *defn,     /* R1 in */
                                   int                 *handle    /* R0 out */);

This calls the SWI Wimp_CreateIcon.

wimp_create_menu, CloseMenu

#define CloseMenu ((void *) -1)
_kernel_oserror *wimp_create_menu (void *handle, /* R1 in */
                                   int   x,      /* R2 in */
                                   int   y       /* R3 in */);

This calls the SWI Wimp_CreateMenu.

wimp_create_submenu

_kernel_oserror *wimp_create_submenu (void *handle, /* R1 in */
                                      int   x,      /* R2 in */
                                      int   y       /* R3 in */);

This calls the SWI Wimp_CreateSubmenu.

wimp_create_window

_kernel_oserror *wimp_create_window (WimpWindow *defn,  /* R1 in */
                                     int        *handle /* R0 out */);

This calls the SWI Wimp_CreateWindow.

wimp_decode_menu

_kernel_oserror *wimp_decode_menu (void *data,       /* R1 in */
                                   int  *selections, /* R2 in */
                                   char *buffer      /* R3 in */);

This calls the SWI Wimp_DecodeMenu.

wimp_delete_icon

_kernel_oserror *wimp_delete_icon (WimpDeleteIconBlock *block /* R1 in */);

This calls the SWI Wimp_DeleteIcon.

wimp_delete_window

_kernel_oserror *wimp_delete_window (WimpDeleteWindowBlock *block /* R1 in */);

This calls the SWI Wimp_DeleteWindow.

wimp_drag_box, CancelDrag

#define CancelDrag 0

_kernel_oserror *wimp_drag_box (WimpDragBox *block /* R1 in */);

This calls the SWI Wimp_DragBox.

wimp_extend

You might expect a function of this name to be provided to call Wimp_Extend. However, such a function is not implemented by WimpLib.

wimp_force_redraw

_kernel_oserror *wimp_force_redraw (int window_handle, /* R0 in */
                                    int xmin,          /* R1 in */
                                    int ymin,          /* R2 in */
                                    int xmax,          /* R3 in */
                                    int ymax           /* R4 in */);

This calls the SWI Wimp_ForceRedraw.

wimp_get_caret_position

_kernel_oserror *wimp_get_caret_position (WimpGetCaretPositionBlock *block /* R1 in */);

This calls the SWI Wimp_GetCaretPosition.

wimp_get_icon_state

_kernel_oserror *wimp_get_icon_state (WimpGetIconStateBlock *block /* R1 in */);

This calls the SWI Wimp_GetIconState.

wimp_get_menu_state

_kernel_oserror *wimp_get_menu_state (int  report, /* R0 in */
                                      int *state,  /* R1 in */
                                      int  window, /* R2 in */
                                      int  icon    /* R3 in */);

This calls the SWI Wimp_GetMenuState.

wimp_get_pointer_info

_kernel_oserror *wimp_get_pointer_info (WimpGetPointerInfoBlock *block /* R1 in */);

This calls the SWI Wimp_GetPointerInfo.

wimp_get_rectangle

_kernel_oserror *wimp_get_rectangle (WimpRedrawWindowBlock *block, /* R1 in */
                                     int                   *more   /* R0 out */);

This calls the SWI Wimp_GetRectangle.

wimp_get_window_info

_kernel_oserror *wimp_get_window_info (WimpGetWindowInfoBlock *block /* R1 in */);

This calls the SWI Wimp_GetWindowInfo.

wimp_get_window_outline

_kernel_oserror *wimp_get_window_outline (WimpGetWindowOutlineBlock *block /* R1 in */);

This calls the SWI Wimp_GetWindowOutline.

wimp_get_window_state

_kernel_oserror *wimp_get_window_state (WimpGetWindowStateBlock *state /* R1 in */);

This calls the SWI Wimp_GetWindowState.

wimp_initialise

_kernel_oserror *wimp_initialise (int   version,  /* R0 in */
                                  char *name,     /* R2 in */
                                  int  *messages, /* R3 in */
                                  int  *cversion, /* R0 out */
                                  int  *task      /* R1 out */);

This sets up R1 to be &4B534154 ('TASK'), and then calls the SWI Wimp_Initialise.

wimp_load_template

_kernel_oserror *wimp_load_template (_kernel_swi_regs *regs /*R1-6 in*/);

This calls the SWI Wimp_LoadTemplate.

wimp_open_template

_kernel_oserror *wimp_open_template (char *name /* R1 in */);

This calls the SWI Wimp_OpenTemplate.

wimp_open_window

_kernel_oserror *wimp_open_window (WimpOpenWindowBlock *show /* R1 in */);

This calls the SWI Wimp_OpenWindow.

wimp_plot_icon

_kernel_oserror *wimp_plot_icon (WimpPlotIconBlock *block /* R1 in */);

This calls the SWI Wimp_PlotIcon.

wimp_poll

_kernel_oserror *wimp_poll (int            mask,      /* R0 in */
                            WimpPollBlock *block,     /* R1 in */
                            int           *pollword,  /* R2 in */
                            int           *event_code /* R0 out */);

This calls the SWI Wimp_Poll.

wimp_poll_idle

_kernel_oserror *wimp_pollidle (int            mask,      /* R0 in */
                                WimpPollBlock *block,     /* R1 in */
                                int            time,      /* R2 in */
                                int           *pollword,  /* R3 in */
                                int           *event_code /* R0 out */);

This calls the SWI Wimp_PollIdle.

wimp_process_key

_kernel_oserror *wimp_process_key (int keycode /* R0 in */);

This calls the SWI Wimp_ProcessKey.

wimp_read_palette

_kernel_oserror *wimp_read_palette (Palette *palette /* R1 in */);

This calls the SWI Wimp_ReadPalette.

wimp_read_pix_trans

You might expect a function of this name to be provided to call Wimp_ReadPixTrans. However, such a function is not implemented by WimpLib.

wimp_read_sys_info, WimpSysInfo

typedef struct
{
  int r0;
  int r1;
}
WimpSysInfo;

_kernel_oserror *wimp_read_sys_info (int          reason, /* R0 in */
                                     WimpSysInfo *results /* R0 out */);

This calls the SWI Wimp_ReadSysInfo.

wimp_redraw_window

_kernel_oserror *wimp_redraw_window (WimpRedrawWindowBlock *block, /* R1 in */
                                     int                   *more   /* R0 out */);

This calls the SWI Wimp_RedrawWindow.

wimp_register_filter

You might expect a function of this name to be provided to call Wimp_RegisterFilter. However, such a function is not implemented by WimpLib.

wimp_remove_messages

_kernel_oserror *wimp_remove_messages (int *list /* R0 in */);

This calls the SWI Wimp_RemoveMessages. You must not use this call in Toolbox applications.

wimp_report_error

int wimp_report_error (_kernel_oserror *er,     /* R0 in */
                       int              flags,  /* R1 in */
                       char            *name,   /* R2 in */
                       char            *sprite, /* R3 in */
                       void            *area,   /* R4 in */
                       char            *buttons /* R5 in */);

This calls the SWI Wimp_ReportError.

wimp_resize_icon

_kernel_oserror *wimp_resize_icon (int window, /* R0 in */
                                   int icon,   /* R1 in */
                                   int xmin,   /* R2 in */
                                   int ymin,   /* R3 in */
                                   int xmax,   /* R4 in */
                                   int ymax    /* R5 in */);

This calls the SWI Wimp_ResizeIcon.

wimp_send_message

_kernel_oserror *wimp_send_message (int   code,   /* R0 in */
                                    void *block,  /* R1 in */
                                    int   handle, /* R2 in */
                                    int   icon,   /* R3 in */
                                    int  *th      /* R2 out */);

This calls the SWI Wimp_SendMessage.

wimp_set_caret_position

_kernel_oserror *wimp_set_caret_position (int window_handle, /* R0 in */
                                          int icon_handle,   /* R1 in */
                                          int xoffset,       /* R2 in */
                                          int yoffset,       /* R3 in */
                                          int height,        /* R4 in */
                                          int index          /* R5 in */);

This calls the SWI Wimp_SetCaretPosition.

wimp_set_colour, Wimp_BackgroundColour

#define Wimp_BackgroundColour (128)

_kernel_oserror *wimp_set_colour (int colour /* R0 in */);

This calls the SWI Wimp_SetColour.

wimp_set_colour_mapping

_kernel_oserror *wimp_set_colour_mapping (int  which_palette, /* R1 in */
                                          int *bpp1,          /* R2 in */
                                          int *bpp2,          /* R3 in */
                                          int *bpp4           /* R4 in */);

This calls sets R5, R6 and R7 to zero and then calls the SWI Wimp_SetColourMapping.

wimp_set_extent

_kernel_oserror *wimp_set_extent (int   window_handle, /* R0 in */
                                  BBox *area           /* R1 in */);

This calls the SWI Wimp_SetExtent.

wimp_set_font_colours

_kernel_oserror *wimp_set_font_colours (int fore /* R1 in */
                                        int back /* R2 in */);

This calls the SWI Wimp_SetFontColours.

wimp_set_icon_state

_kernel_oserror *wimp_set_icon_state (WimpSetIconStateBlock *block) /* R1 in */;

This calls the SWI Wimp_SetIconState.

wimp_set_mode

_kernel_oserror *wimp_set_mode (int mode /* R0 in */);

This calls the SWI Wimp_SetMode.

wimp_set_palette, Palette

typedef struct
{
  unsigned int colours[16];
  unsigned int border;
  unsigned int pointer1;
  unsigned int pointer2;
  unsigned int pointer3;
}
Palette;

_kernel_oserror *wimp_set_palette (Palette *palette /* R1 in */);

This calls the SWI Wimp_SetPalette.

wimp_set_pointer_shape

_kernel_oserror *wimp_set_pointer_shape (int   shape,   /* R0 in */
                                         void *data,    /* R1 in */
                                         int   width,   /* R2 in */
                                         int   height,  /* R3 in */
                                         int   activex, /* R4 in */
                                         int   activey  /* R5 in */);

This calls the SWI Wimp_SetPointerShape.

wimp_set_watchdog_state

You might expect a function of this name to be provided to call Wimp_SetWatchdogState. However, such a function is not implemented by WimpLib.

wimp_slot_size

_kernel_oserror *wimp_slot_size (int  current, /* R0 in */
                                 int  next,    /* R1 in */
                                 int *current, /* R0 out */
                                 int *next,    /* R1 out */
                                 int *free     /* R2 out */);

This calls the SWI Wimp_SlotSize.

wimp_sprite_op, SpriteParams

typedef struct
{
  int r3;
  int r4;
  int r5;
  int r6;
  int r7;
}
SpriteParams;

_kernel_oserror *wimp_sprite_op (int           code, /* R0 in */
                                 char         *name, /* R2 in */
                                 SpriteParams *p     /* R3... in */);

This calls the SWI Wimp_SpriteOp.

wimp_start_task

_kernel_oserror *wimp_start_task (char *cl,    /* R0 in */
                                  int  *handle /* R0 out */);

This calls the SWI Wimp_StartTask.

wimp_text_colour

_kernel_oserror *wimp_text_colour (int colour /* R0 in */);

This calls the SWI Wimp_TextColour.

wimp_text_op

_kernel_oserror *wimp_text_op (_kernel_swi_regs *regs /* R0... in */);

This calls the SWI Wimp_TextOp.

wimp_transfer_block

_kernel_oserror *wimp_transfer_block (int   sh,   /* R0 in */
                                      void *sbuf, /* R1 in */
                                      int   dh,   /* R2 in */
                                      void *dbuf, /* R3 in */
                                      int   size  /* R4 in */);

This calls the SWI Wimp_TransferBlock.

wimp_update_window

_kernel_oserror *wimp_update_window (WimpRedrawWindowBlock *block, /* R1 in */
                                     int                   *more   /* R0 out */);

This calls the SWI Wimp_UpdateWindow.

wimp_which_icon

_kernel_oserror *wimp_which_icon (int           window_handle, /* R0 in */
                                  int          *icons,         /* R1 in */
                                  unsigned int  mask,          /* R2 in */
                                  unsigned int  match          /* R3 in */);

This calls the SWI Wimp_WhichIcon.

© 3QD Developments Ltd 2013