twimp 27.4 KB
Newer Older
Neil Turton's avatar
Neil Turton committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/* Copyright 1996 Acorn Computers Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/* Title:   wimp.h
 * Purpose: C interface to RISC OS Wimp routines.
 * Author:  IDJ
Kevin Bracey's avatar
Kevin Bracey committed
18 19
 * History: 16-Sep-93: IDJ: created
 *          25-Nov-96: EPW: Updated structures for nested window support
Neil Turton's avatar
Neil Turton committed
20 21 22 23 24 25
 */

# ifndef __wimp_h
# define __wimp_h

#ifndef __toolbox_h
26
#include "objects/toolbox.h"
Neil Turton's avatar
Neil Turton committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
#endif

#include "kernel.h"

#define  wimp_ENULL             0
#define  wimp_EREDRAW           1
#define  wimp_EOPEN             2
#define  wimp_ECLOSE            3
#define  wimp_EPTR_LEAVE        4
#define  wimp_EPTR_ENTER        5
#define  wimp_EBUT              6
#define  wimp_EUSER_DRAG        7
#define  wimp_EKEY              8
#define  wimp_EMENU             9
#define  wimp_ESCROLL          10
#define  wimp_ELOSE_CARET      11
#define  wimp_EGAIN_CARET      12
#define  wimp_EPOLL_WORD       13
#define  wimp_ESEND            17
#define  wimp_ESEND_WANT_ACK   18
#define  wimp_EACK             19
#define  wimp_ETOOLBOX_EVENT   0x200


#define  wimp_EMNULL          (1 << wimp_ENULL)
#define  wimp_EMREDRAW        (1 << wimp_EREDRAW)
#define  wimp_EMOPEN          (1 << wimp_EOPEN)
#define  wimp_EMCLOSE         (1 << wimp_ECLOSE)
#define  wimp_EMPTR_LEAVE     (1 << wimp_EPTR_LEAVE)
#define  wimp_EMPTR_ENTER     (1 << wimp_EPTR_ENTER)
#define  wimp_EMBUT           (1 << wimp_EBUT)
#define  wimp_EMUSER_DRAG     (1 << wimp_EUSER_DRAG)
#define  wimp_EMKEY           (1 << wimp_EKEY)
#define  wimp_EMMENU          (1 << wimp_EMENU)
#define  wimp_EMSCROLL        (1 << wimp_ESCROLL)
#define  wimp_EMLOSE_CARET    (1 << wimp_ELOSE_CARET)
#define  wimp_EMGAIN_CARET    (1 << wimp_EGAIN_CARET)
#define  wimp_EMPOLL_WORD     (1 << wimp_EPOLL_WORD)
#define  wimp_EMSEND          (1 << wimp_ESEND)
#define  wimp_EMSEND_WANT_ACK (1 << wimp_ESEND_WANT_ACK)
#define  wimp_EMACK           (1 << wimp_EACK)


/* --- wimp colours --- */

#define wimp_BLACK            7
#define wimp_VERY_LIGHT_GREY  1


/* --- wimp icons --- */

#define wimp_ICONBAR   (-2)

/* button types */

#define wimp_BUTTON_NEVER              0
#define wimp_BUTTON_ALWAYS             1
#define wimp_BUTTON_AUTO_REPEAT        2
#define wimp_BUTTON_CLICK              3
#define wimp_BUTTON_RELEASE            4
#define wimp_BUTTON_DOUBLE_CLICK       5
#define wimp_BUTTON_CLICK_DRAG         6
#define wimp_BUTTON_RELEASE_DRAG       7
#define wimp_BUTTON_DOUBLE_DRAG        8
#define wimp_BUTTON_MENU_ICON          9
#define wimp_BUTTON_DOUBLE_CLICK_DRAG 10
#define wimp_BUTTON_RADIO             11
#define wimp_BUTTON_WRITE_CLICK_DRAG  14
#define wimp_BUTTON_WRITABLE          15


/* icon flags */

#define wimp_ICONFLAGS_TEXT            0x00000001
#define wimp_ICONFLAGS_SPRITE          0x00000002
#define wimp_ICONFLAGS_HAS_BORDER      0x00000004
#define wimp_ICONFLAGS_HCENTRE         0x00000008
#define wimp_ICONFLAGS_VCENTRE         0x00000010
#define wimp_ICONFLAGS_FILLED          0x00000020
#define wimp_ICONFLAGS_ANTI_ALIASED    0x00000040
#define wimp_ICONFLAGS_NEEDS_HELP      0x00000080
#define wimp_ICONFLAGS_INDIRECT        0x00000100
#define wimp_ICONFLAGS_RJUSTIFY        0x00000200
#define wimp_ICONFLAGS_NO_CANCEL       0x00000400
#define wimp_ICONFLAGS_HALF_SIZE       0x00000800

#define wimp_ICONFLAGS_BUTTON_TYPE     0x00001000   /* multiply by button type you want */
#define wimp_ICONFLAGS_ESG             0x00010000   /* multiply by ESG you want */

#define wimp_ICONFLAGS_INVERT          0x00200000
#define wimp_ICONFLAGS_FADED           0x00400000
#define wimp_ICONFLAGS_DELETED         0x00800000

#define wimp_ICONFLAGS_FORECOL         0x01000000U   /* multiply by colour you want */
#define wimp_ICONFLAGS_BACKCOL         0x10000000U   /* multiply by colour you want */



typedef struct
{
        int xmin, ymin, xmax, ymax;
} wimp_Bbox;


typedef union
{
        char text[12];          /* up to 12 bytes of text */

        char sprite_name[12];   /* up to 12 bytes of sprite name */

        struct
        {
            union
            {
                char *name;
                void *sprite_ptr;
            } sprite;
            void *sprite_area;    /* 0->use the common sprite area */
                                  /* 1->use the wimp sprite area */
            int name_len;         /* if 0, then use sprite.sprite_ptr */
        } indirect_sprite;

        struct
        {
            char *buffer;         /* pointer to text buffer */
            char *valid_string;   /* pointer to validation string */
            int buff_len;         /* length of text buffer */
        } indirect_text;

        struct
        {
            char *buffer;         /* pointer to text buffer */
            char *valid_string;   /* pointer to validation string */
            int buff_len;         /* length of text buffer */
        } indirect_text_and_sprite;

} wimp_IconData;


typedef struct
{
        wimp_Bbox     bbox;       /* icon's bounding box */
        unsigned int  flags;      /* icon's flags word */
        wimp_IconData data;       /* icon's data (12 bytes) */

} wimp_Icon;

typedef struct
{
        int  window_handle;
        int  icon_handle;
} wimp_IconDelete;

typedef struct
{
        int           window_handle;
        wimp_Icon     icon;
} wimp_IconCreate;

typedef struct
{
        int  window_handle;
        int  icon_handle;
        unsigned int  EOR_word;
        unsigned int  clear_word;
} wimp_SetIconState;

typedef struct
{
        int       window_handle ;
        int       icon_handle ;
        wimp_Icon icon ;
} wimp_GetIconState ;

/* --- Wimp menus --- */

#define wimp_KeepMenu  0x5045454b           /* 'KEEP' (take note, Ian) */

#define wimp_MENUFLAGS_TICKED           0x00000001
#define wimp_MENUFLAGS_DOTTED_LINE      0x00000002
#define wimp_MENUFLAGS_WRITABLE         0x00000004
#define wimp_MENUFLAGS_SUBMENU_MESSAGE  0x00000008
#define wimp_MENUFLAGS_SUBMENU_OPENABLE 0x00000010
#define wimp_MENUFLAGS_LAST_ITEM        0x00000080
#define wimp_MENUFLAGS_TITLE_INDIRECT   0x00000100

typedef struct
{
        wimp_IconData title;
        char          title_fgnd;
        char          title_bgnd;
        char          worka_fgnd;
        char          worka_bgnd;
        int           width;
        int           height;
        int           vert_gap;

} wimp_MenuHeader;

typedef struct
{
        wimp_MenuHeader hdr;
        /* items come here in memory */
} wimp_Menu;


typedef struct
{
        int           flags;
        wimp_Menu    *submenu;
        int           icon_flags;
        wimp_IconData icon_data;

} wimp_MenuEntry;

#define wimp_menu_entry(m, i)  (((wimp_MenuEntry*)(&m->hdr + 1)) + i)



/* --- wimp Windows --- */

typedef struct
{
        wimp_Bbox     box;                    /* screen coords of work area */
        int           scx,
                      scy;                   /* scroll bar positions */
        int           behind;                /* handle to open window behind, or -1 if top */
        int           flags;                 /* word of flag bits */
        char          colours[8];            /* colours */
        wimp_Bbox     ex;                    /* maximum extent of work area */
        int           title_flags;           /* icon flags for title bar */
        int           work_area_flags;       /* just button type relevant */
        void         *sprite_area;           /* sprite area pointer for window */
        int           min_size;              /* two 16-bit OS-unit fields, giving min size of window. 0->use title. */
        wimp_IconData title;                 /* title icon data */
        int           nicons;                /* no. of icons in window */
                                             /* icon defs follow here in memory */
} wimp_Window;


/* window flags */

#define wimp_WINDOWFLAGS_OLD_HAS_TITLE             0x00000001   /* deprecated */
#define wimp_WINDOWFLAGS_MOVEABLE                  0x00000002
#define wimp_WINDOWFLAGS_OLD_VSCROLLBAR            0x00000004   /* deprecated */
#define wimp_WINDOWFLAGS_OLD_HSCROLLBAR            0x00000008   /* deprecated */
#define wimp_WINDOWFLAGS_AUTOREDRAW                0x00000010
#define wimp_WINDOWFLAGS_PANE                      0x00000020
#define wimp_WINDOWFLAGS_ALLOW_OFF_SCREEN          0x00000040
#define wimp_WINDOWFLAGS_OLD_NO_BACK_NO_CLOSE      0x00000080   /* deprecated */
#define wimp_WINDOWFLAGS_CLICK_SCROLL_REQUEST      0x00000100
#define wimp_WINDOWFLAGS_AUTOREPEAT_SCROLL_REQUEST 0x00000200
#define wimp_WINDOWFLAGS_GCOL                      0x00000400
#define wimp_WINDOWFLAGS_BACKDROP                  0x00000800
#define wimp_WINDOWFLAGS_HOT_KEYS                  0x00001000
#define wimp_WINDOWFLAGS_FORCE_ON_SCREEN           0x00002000
#define wimp_WINDOWFLAGS_IGNORE_RIGHT_EXTENT       0x00004000
#define wimp_WINDOWFLAGS_IGNORE_LOWER_EXTENT       0x00008000

#define wimp_WINDOWFLAGS_OPEN                      0x00010000
#define wimp_WINDOWFLAGS_FULLY_VISIBLE             0x00020000
#define wimp_WINDOWFLAGS_FULL_SIZE                 0x00040000
#define wimp_WINDOWFLAGS_TOGGLE_REQUEST            0x00080000
#define wimp_WINDOWFLAGS_INPUT_FOCUS               0x00100000
#define wimp_WINDOWFLAGS_FORCE_ONCE_ON_SCREEN      0x00200000
#define wimp_WINDOWFLAGS_RESERVED1                 0x00400000
#define wimp_WINDOWFLAGS_RESERVED2                 0x00800000

#define wimp_WINDOWFLAGS_HAS_BACK_ICON             0x01000000
#define wimp_WINDOWFLAGS_HAS_CLOSE_ICON            0x02000000
#define wimp_WINDOWFLAGS_HAS_TITLE_BAR             0x04000000
#define wimp_WINDOWFLAGS_HAS_TOGGLE_ICON           0x08000000
#define wimp_WINDOWFLAGS_HAS_VSCROLLBAR            0x10000000
#define wimp_WINDOWFLAGS_HAS_ADJUST_SIZE_ICON      0x20000000
#define wimp_WINDOWFLAGS_HAS_HSCROLLBAR            0x40000000
#define wimp_WINDOWFLAGS_USE_NEW_FLAGS             0x80000000


typedef struct
{
        int           window_handle;         /* handle of window to open */
        wimp_Bbox     visible_area;          /* visible area coords */
        int           scx,
                      scy;                   /* scroll offsets */
        int           behind;                /* handle to open window behind */
} wimp_OpenWindow;

Kevin Bracey's avatar
Kevin Bracey committed
314 315 316 317 318 319 320 321 322 323
typedef struct
{
        int           window_handle;         /* handle of window to open */
        wimp_Bbox     visible_area;          /* visible area coords */
        int           scx,
                      scy;                   /* scroll offsets */
        int           behind;                /* handle to open window behind */
	/* The following requires nested window support in the Wimp */
	int           window_flags;
} wimp_NestedOpenWindow;
Neil Turton's avatar
Neil Turton committed
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686

#define wimp_OpenWindow_TopOfStack      (-1)
#define wimp_OpenWindow_BottomOfStack   (-2)
#define wimp_OpenWindow_BehindBackDrop  (-3)


typedef struct
{
        wimp_OpenWindow   open;
        int               flags;             /* as passed to Wimp_CreateWindow */
} wimp_GetWindowState;


typedef struct
{
        int               window_handle;
        wimp_Window       window;
} wimp_GetWindowInfo;


typedef struct
{
        int               window_handle;
        wimp_Bbox         box;
} wimp_GetWindowOutline;


typedef struct
{
        int window_handle;
        int icon_handle;
        int x_caret_offset;
        int y_caret_offset;
        int caret_height;
        int caret_index;
} wimp_SetCaretPosition,
  wimp_GetCaretPosition;

/* --- wimp Pointers --- */

/* for sprite op 36 */

#define wimp_POINTER_SHAPEFLAGS_SHAPE_NUMBER         0x00000001
#define wimp_POINTER_SHAPEFLAGS_NOT_SET_SHAPE        0x00000010
#define wimp_POINTER_SHAPEFLAGS_NOT_SET_PALETTE      0x00000020
#define wimp_POINTER_SHAPEFLAGS_NOT_PROG_SHAPE_NUM   0x00000040

/* --- wimp pointer info --- */

typedef struct
{
        int x;
        int y;
        int button_state;
        int window_handle;
        int icon_handle;
} wimp_PointerInfo;

/* --- wimp RGB word --- */

typedef struct
{
   char reserved;
   char red;
   char green;
   char blue;
} wimp_RGB;

/* --- wimp palette block --- */

typedef struct
{
        wimp_RGB colour[16];
        wimp_RGB border;
        wimp_RGB pointer[3];
} wimp_PaletteBlock;

/* --- wimp message numbers --- */

#define wimp_MQUIT                           0
#define wimp_MDATA_SAVE                      1
#define wimp_MDATA_SAVE_ACK                  2
#define wimp_MDATA_LOAD                      3
#define wimp_MDATA_LOAD_ACK                  4
#define wimp_MDATA_OPEN                      5
#define wimp_MRAM_FETCH                      6
#define wimp_MRAM_TRANSMIT                   7
#define wimp_MPRE_QUIT                       8
#define wimp_MPALETTE_CHANGE                 9
#define wimp_MSAVE_DESKTOP                  10
#define wimp_MSHUT_DOWN                     14

#define wimp_MSET_PRINTER                   0x80147

#define wimp_MFILER_OPEN_DIR                0x400
#define wimp_MFILER_CLOSE_DIR               0x401
#define wimp_MFILER_OPEN_DIR_AT             0x402
#define wimp_MFILER_SELECTION_DIRECTORY     0x403
#define wimp_MFILER_ADD_SELECTION           0x404
#define wimp_MFILER_ACTION                  0x405
#define wimp_MFILER_CONTROL_ACTION          0x406
#define wimp_MFILER_SELECTION               0x407

#define wimp_MNOTIFY                        0x40040

#define wimp_MMENU_WARNING                  0x400c0
#define wimp_MMODE_CHANGE                   0x400c1
#define wimp_MTASK_INITIALISE               0x400c2
#define wimp_MTASK_CLOSE_DOWN               0x400c3
#define wimp_MSLOT_SIZE                     0x400c4
#define wimp_MSET_SLOT                      0x400c5
#define wimp_MTASK_NAME_RQ                  0x400c6
#define wimp_MTASK_NAME_IS                  0x400c7
#define wimp_MTASK_STARTED                  0x400c8
#define wimp_MMENUS_DELETED                 0x400c9

#define wimp_MHELP_REQUEST                  0x502
#define wimp_MHELP_REPLY                    0x503

#define wimp_MTOOLBOX_EVENT             Toolbox_SWIChunkBase

typedef struct
{
        int size;               /* 20<=size<=256, multiple of 4 */
        int task_handle;        /* task handle of sender (filled in by wimp) */
        int my_ref;             /* unique ref number (filled in by wimp) */
        int your_ref;           /* (0==>none) if non-zero, acknowledge */
        int action;             /* message action code */
} wimp_MsgHdr;


typedef struct
{
        int mouse_x;
        int mouse_y;
        int buttons;
        int window_handle;
        int icon_handle;
} wimp_HelpRequest;

typedef struct
{
        char text[236];
} wimp_HelpReply;

typedef struct
{
        wimp_Menu  *submenu;
        int         x;
        int         y;
        char        data[256-sizeof(wimp_MsgHdr)-sizeof(wimp_Menu*)-sizeof(int)-sizeof(int)];
} wimp_MenuWarning;

typedef struct {
   int     window_handle;
   int     icon_handle;
   int     x;
   int     y;
   int     approx_size;
   int     filetype;
   char    filename [256-sizeof(wimp_MsgHdr)-6*sizeof(int)];
} wimp_DataSave, wimp_DataSaveAck, wimp_DataLoad, wimp_DataLoadAck;

/* The filename is a proposed leafname in Message_DataSave but a full pathname in later life.
   In Risc OS 3 there is some extra information, word aligned, after the end of the full pathname
   for Message_DataLoad block which is not indicated by the above data structure.
*/

typedef struct {
   void   *address;
   int     no_bytes;
} wimp_RAMFetch, wimp_RAMTransmit;

/* In a RAMFetch, no_bytes is the buffer length, for the Transmit it is the number of copied bytes.
*/

#define wimp_MAX_MSG_DATA_SIZE (sizeof(wimp_Message)-sizeof(wimp_MsgHdr))

typedef struct
{
        wimp_MsgHdr hdr;
        union
        {
                char                  chars[236];
                int                   words[59];
                wimp_HelpRequest      help_request;
                wimp_HelpReply        help_reply;
                wimp_MenuWarning      menu_warning;
                ToolboxEventMsg       toolbox_event_msg;
                wimp_DataSave         data_save;
                wimp_DataSaveAck      data_save_ack;
                wimp_DataLoad         data_load;
                wimp_DataLoadAck      data_load_ack;
                wimp_RAMFetch         ram_fetch;
                wimp_RAMTransmit      ram_transmit;
        } data;
} wimp_Message;


/* --- mouse clicks --- */

#define wimp_ADJUST_BUTTON  0x00000001
#define wimp_MENU_BUTTON    0x00000002
#define wimp_SELECT_BUTTON  0x00000004


typedef struct
{
        int window_handle;
} wimp_RedrawWindowRequest;


typedef struct
{
        wimp_OpenWindow  open_block;
} wimp_OpenWindowRequest;


typedef struct
{
        int window_handle;
} wimp_CloseWindowRequest;


typedef struct
{
        int window_handle;
} wimp_PointerLeavingWindow;


typedef struct
{
        int window_handle;
} wimp_PointerEnteringWindow;


typedef struct
{
        int x;
        int y;
        int buttons;
        int window_handle;
        int icon_handle;
} wimp_MouseClick;


typedef struct
{
        wimp_Bbox box;
} wimp_UserDragBox;


typedef struct
{
        wimp_GetCaretPosition caret;
        int                   key_code;
} wimp_KeyPressed;


typedef struct
{
        int items[256];
} wimp_MenuSelection;


typedef struct
{
        wimp_OpenWindow open_block;
        int             x_scroll_direction;
        int             y_scroll_direction;
} wimp_ScrollRequest;


typedef struct
{
        wimp_GetCaretPosition caret;
} wimp_LoseCaret,
  wimp_GainCaret;


typedef struct
{
        int poll_word_address;
        int poll_word_contents;
} wimp_PollWordNonZero;


typedef wimp_Message wimp_UserMessageAcknowledge;


typedef union
{
        wimp_RedrawWindowRequest    redraw_window_request;
        wimp_OpenWindowRequest      open_window_request;
        wimp_CloseWindowRequest     close_window_request;
        wimp_PointerLeavingWindow   pointer_leaving_window;
        wimp_PointerEnteringWindow  pointer_entering_window;
        wimp_MouseClick             mouse_click;
        wimp_UserDragBox            user_drag_box;
        wimp_KeyPressed             key_pressed;
        wimp_MenuSelection          menu_selection;
        wimp_ScrollRequest          scroll_request;
        wimp_LoseCaret              lose_caret;
        wimp_GainCaret              gain_caret;
        wimp_PollWordNonZero        pollword_nonzero;
        wimp_UserMessageAcknowledge user_message_acknowledge;
        wimp_Message                msg;
        ToolboxEvent    toolbox_event;

} wimp_PollBlock;

/* type used to pass information to Wimp_DragBox (see PRM 3-145) */

typedef struct _drag_box {
        int wimp_window;
        int drag_type;
        wimp_Bbox dragging_box;
        wimp_Bbox parent_box;
        int *workspace;
        void (*draw)();
        void (*remove)();
        void (*move)();
    } DragBox;

/* type used to pass/get info for Wimp_GetWindowState */

typedef struct _window_info {
        int window;
        wimp_Bbox visible;
        int scx,scy;
        int infront;
        int flags;
     } WindowState;

typedef struct _redraw_window {
        int window;
        wimp_Bbox visible;
        int scx,scy;
        wimp_Bbox current;
     } WindowRedraw;

_kernel_oserror *wimp_initialise        (int version,
                                        char *name,
                                        int *messages,
                                        int *cversion,
                                        int *task);

_kernel_oserror *wimp_create_window     (wimp_Window *defn, int *handle);

_kernel_oserror *wimp_create_icon       (int priority,
                                        wimp_IconCreate *defn,
                                        int *handle);

typedef struct {
   int handle;
}wimp_DeleteWindow;

_kernel_oserror *wimp_delete_window     (wimp_DeleteWindow *block);

_kernel_oserror *wimp_delete_icon       (wimp_IconDelete *block);

_kernel_oserror *wimp_open_window       (wimp_OpenWindow *show);

Kevin Bracey's avatar
Kevin Bracey committed
687 688 689 690
_kernel_oserror *wimp_open_window2      (wimp_NestedOpenWindow *show,
                                        int parent_handle,
                                        unsigned int alignment_flags);

Neil Turton's avatar
Neil Turton committed
691 692 693 694 695 696 697 698 699 700 701 702 703 704 705
_kernel_oserror *wimp_close_window      (int *window_handle);

_kernel_oserror *wimp_poll              (int mask,
                                        wimp_PollBlock *block,
                                        int *pollword,
                                        int *event_code);

_kernel_oserror *wimp_redraw_window     (WindowRedraw *block, int *more);

_kernel_oserror *wimp_update_window     (WindowRedraw *block, int *more);

_kernel_oserror *wimp_get_rectangle     (WindowRedraw *block, int *more);

_kernel_oserror *wimp_get_window_state  (wimp_GetWindowState *state);

Kevin Bracey's avatar
Kevin Bracey committed
706 707 708 709
_kernel_oserror *wimp_get_window_state2 (wimp_GetWindowState *state,
                                        int *parent_handle,
                                        unsigned int *alignment_flags);

Neil Turton's avatar
Neil Turton committed
710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727
_kernel_oserror *wimp_get_window_info   (wimp_GetWindowInfo *block);

_kernel_oserror *wimp_set_icon_state    (wimp_SetIconState *block);

_kernel_oserror *wimp_get_icon_state    (wimp_GetIconState *block);

_kernel_oserror *wimp_get_pointer_info  (wimp_PointerInfo *block);

#define CancelDrag 0

_kernel_oserror *wimp_drag_box          (DragBox *block);

_kernel_oserror *wimp_force_redraw      (int window_handle,
                                        int xmin,
                                        int ymin,
                                        int xmax,
                                        int ymax);

Kevin Bracey's avatar
Kevin Bracey committed
728 729
_kernel_oserror *wimp_force_title_redraw (int window_handle);

Neil Turton's avatar
Neil Turton committed
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895
_kernel_oserror *wimp_set_caret_position (int window_handle,
                                        int icon_handle,
                                        int xoffset,
                                        int yoffset,
                                        int height,
                                        int index);

_kernel_oserror *wimp_get_caret_position (wimp_GetCaretPosition *block);

#define CloseMenu ((void *) -1)
_kernel_oserror *wimp_create_menu       (void * handle,
                                        int x,int y);

_kernel_oserror *wimp_decode_menu       (void *data,
                                        int *selections,
                                        char *buffer);

_kernel_oserror *wimp_which_icon        (int window_handle,
                                        int *icons,
                                        unsigned int mask,
                                        unsigned int match);

_kernel_oserror *wimp_set_extent        (int window_handle, wimp_Bbox *area);

_kernel_oserror *wimp_set_pointer_shape (int shape,
                                        void *data,
                                        int width,
                                        int height,
                                        int activex,
                                        int activey);

_kernel_oserror *wimp_open_template     (char *name);

_kernel_oserror *wimp_close_template    (void);

_kernel_oserror *wimp_load_template     (_kernel_swi_regs *regs);

_kernel_oserror *wimp_process_key       (int keycode);

_kernel_oserror *wimp_close_down        (int th);

_kernel_oserror *wimp_start_task        (char *cl, int *handle);

int             wimp_report_error       (_kernel_oserror *er,
                                        int flags,
                                        char *name,
                                        char *sprite,
                                        void *area,
                                        char *buttons);

_kernel_oserror *wimp_get_window_outline (wimp_GetWindowOutline *block);

_kernel_oserror *wimp_pollidle          (int mask,
                                        wimp_PollBlock *block,
                                        int time,
                                        int *pollword,
                                        int *event_code);

_kernel_oserror *wimp_plot_icon         (wimp_Icon *block);

_kernel_oserror *wimp_set_mode          (int mode);

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);

_kernel_oserror *wimp_read_palette      (Palette *palette);

_kernel_oserror *wimp_set_colour        (int colour);

_kernel_oserror *wimp_send_message      (int code,
                                        void *block,
                                        int handle,
                                        int icon,
                                        int *th);

_kernel_oserror *wimp_create_submenu    (void * handle,
                                        int x,int y);

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

_kernel_oserror *wimp_sprite_op         (int code,
                                        char *name,
                                        SpriteParams *p);

_kernel_oserror *wimp_base_of_sprites   (void **rom,
                                        void **ram);

_kernel_oserror *wimp_block_copy        (int handle,
                                        int sxmin,
                                        int symin,
                                        int sxmax,
                                        int symax,
                                        int dxmin,
                                        int dymin);

_kernel_oserror *wimp_slot_size         (int current,
                                        int next,
                                        int *current,
                                        int *next,
                                        int *free);

/* readpixtrans and claimfreememory not supported */

_kernel_oserror *wimp_command_window    (int type);

_kernel_oserror *wimp_text_colour       (int colour);

_kernel_oserror *wimp_transfer_block    (int sh,
                                        void *sbuf,
                                        int dh,
                                        void *dbuf,
                                        int size);

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

_kernel_oserror *wimp_read_sys_info     (int reason,
                                        WimpSysInfo *results);

_kernel_oserror *wimp_set_font_colours  (int fore,
                                        int back);

_kernel_oserror *wimp_get_menu_state    (int report,
                                        int *state,
                                        int window,
                                        int icon);

/* no filter manager interface */

/* do not use these in toolbox applications */
_kernel_oserror *wimp_add_messages      (int *list);

_kernel_oserror *wimp_remove_messages   (int *list);

_kernel_oserror *wimp_set_colour_mapping (int which_palette,
                                        int *bpp1,
                                        int *bpp2,
                                        int *bpp4);

_kernel_oserror *wimp_text_op           (_kernel_swi_regs *regs);

/* no extend or set watchdog state */

_kernel_oserror *wimp_resize_icon       (int window,
                                        int icon,
                                        int xmin,
                                        int ymin,
                                        int xmax,
                                        int ymax);

#endif