home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / gcc / !GCC / patches / DeskLib / h / Pane < prev    next >
Encoding:
Text File  |  1994-10-03  |  4.6 KB  |  159 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Pane.h
  12.     Author:  Copyright © 1994 Ainsley Pereira. Complete revision by Keith Hall
  13.     Version: 1.11 (30th March 1994)
  14.     Purpose: Handles windows with panes.
  15. */
  16.  
  17. /*
  18.  * Implementation notes
  19.  * --------------------
  20.  * The offset of the pane from the master window is taken from their initial
  21.  * positions, so make sure that they are in the right places relative to each
  22.  * other when you save them from Glazier (or FormEd if you have a pet
  23.  * triceratops ;-)
  24.  * Another point is that the relative positions are kept constant from the top
  25.  * left of the visible area. This only matters if the master window is
  26.  * resizeable. The top left was chosen as most panes are either in fixed size
  27.  * windows (eg. Options windows) or are down the top left of a window (eg.
  28.  * Artworks, Draw etc.)
  29.  * If you want to do something like StrongEd's status bar then you'll have to
  30.  * a) Alter pane_data.offset.y everytime you resize the window, or
  31.  * b) Alter the code to use xxxxx.min.y - yyyyy.min.y (although then you can't
  32.  *    have the Artworks/Draw style panes).
  33.  */
  34.  
  35. #ifndef __dl_pane_h
  36. #define __dl_pane_h
  37.  
  38. #ifndef __dl_wimp_h
  39. #include "Wimp.h"
  40. #endif
  41.  
  42. #ifndef __dl_window_h
  43. #include "Window.h"
  44. #endif
  45.  
  46. #ifndef __dl_wimpswis_h
  47. #include "WimpSWIs.h"
  48. #endif
  49.  
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53.  
  54. typedef struct
  55. {
  56.   window_handle master;
  57.   window_handle pane;
  58.   wimp_point    offset;
  59.   wimp_point    size;
  60.   union
  61.   {
  62.     int value;
  63.     struct
  64.     {
  65.       unsigned int isopen :1;  /* master/pane pair currently displaying */
  66.       unsigned int fixed  :1;  /* pane sticks to position relative to top of master */
  67.       unsigned int resize :1;  /* pane shrinks with relation to size of master */
  68.       unsigned int horiz  :1;  /* pane is horizontal (shrinks to left when resize flag set
  69.                                   and window gets resized (like !StrongEd toolbar) */
  70.       unsigned int vert   :1;  /* pane is horizontal (shrinks to top when resize flag set
  71.                                   and window moves (like !Draw) */
  72.       unsigned int dummy  :27;
  73.     } data;
  74.   } flags;
  75. } pane_data;
  76.  
  77. #define pane_OPEN   0x0001
  78. #define pane_FIXED  0x0002
  79. #define pane_RESIZE 0x0004
  80. #define pane_HORIZ  0x0004
  81. #define pane_VERT   0x0004
  82.  
  83.  
  84. /* Pane_OpenEvent
  85.  * Install as a handler for event_OPEN on the master window.
  86.  * It opens the pane at the correct offset at the correct size.
  87.  */
  88.  
  89. extern BOOL Pane_OpenEventHandler(event_pollblock *event, void *reference);
  90.  
  91.  
  92. /*
  93.  * Pane_GetSysHandle
  94.  * Returns a pointer to the pane_data structure associated with the 'master' window.
  95.  * Returns NULL if the master window isn't linked.
  96.  */
  97.  
  98. extern pane_data *Pane_GetSysHandle(window_handle master);
  99.  
  100.  
  101. /* Pane_SetFlags
  102.  * Sets the flags of the Pane/Master window relationship.
  103.  * Returns the current flags if 'flags' is -1.
  104.  * Returns NULL if the master window isn't linked.
  105.  */
  106.  
  107. extern int Pane_SetFlags(window_handle master, int flags);
  108.  
  109.  
  110. /*
  111.  * Pane_Link
  112.  * Links the pane window handle to the master window handle.
  113.  * if offset or size == NULL then the data is taken from the template
  114.  */
  115.  
  116. extern void Pane_Link(window_handle mast, window_handle pane,
  117.                       wimp_point *offset, wimp_point *size, int flags);
  118.  
  119.  
  120. /*
  121.  * Pane_CreateAndLink
  122.  * Creates the windows using Window_Create and then Pane_Links them together.
  123.  * returns window handle of the master window
  124.  * if offset or size == NULL then the data is taken from the template
  125.  */
  126.  
  127. extern window_handle Pane_CreateAndLink(char *mastname, char *panename,
  128.                                         int mastmaxsize, int panemaxsize,
  129.                                         wimp_point *offset, wimp_point *size, int flags);
  130.  
  131. /*
  132.  * Pane_Show
  133.  * Simply calls Window_Show for the master window and the pane.
  134.  */
  135.  
  136. extern void Pane_Show(window_handle window, window_openpos openpos);
  137.  
  138.  
  139. /*
  140.  * Pane_Delete
  141.  * Calls Window_Delete for the master window and the pane and de-links them
  142.  */
  143.  
  144. extern void Pane_Delete(window_handle window);
  145.  
  146.  
  147. /*
  148.  * Pane_Hide
  149.  * Simply calls Window_Hide for the master window and the pane.
  150.  */
  151.  
  152. extern void Pane_Hide(window_handle window);
  153.  
  154. #ifdef __cplusplus
  155.            }
  156. #endif
  157.  
  158. #endif
  159.