home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / desklib / !DeskLib / h / Pane < prev    next >
Encoding:
Text File  |  1994-03-30  |  4.5 KB  |  151 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. typedef struct
  51. {
  52.   window_handle master;
  53.   window_handle pane;
  54.   wimp_point    offset;
  55.   wimp_point    size;
  56.   union
  57.   {
  58.     int value;
  59.     struct
  60.     {
  61.       unsigned int isopen :1;  /* master/pane pair currently displaying */
  62.       unsigned int fixed  :1;  /* pane sticks to position relative to top of master */
  63.       unsigned int resize :1;  /* pane shrinks with relation to size of master */
  64.       unsigned int horiz  :1;  /* pane is horizontal (shrinks to left when resize flag set
  65.                                   and window gets resized (like !StrongEd toolbar) */
  66.       unsigned int vert   :1;  /* pane is horizontal (shrinks to top when resize flag set
  67.                                   and window moves (like !Draw) */
  68.       unsigned int dummy  :27;
  69.     } data;
  70.   } flags;
  71. } pane_data;
  72.  
  73. #define pane_OPEN   0x0001
  74. #define pane_FIXED  0x0002
  75. #define pane_RESIZE 0x0004
  76. #define pane_HORIZ  0x0004
  77. #define pane_VERT   0x0004
  78.  
  79.  
  80. /* Pane_OpenEvent
  81.  * Install as a handler for event_OPEN on the master window.
  82.  * It opens the pane at the correct offset at the correct size.
  83.  */
  84.  
  85. extern BOOL Pane_OpenEventHandler(event_pollblock *event, void *reference);
  86.  
  87.  
  88. /*
  89.  * Pane_GetSysHandle
  90.  * Returns a pointer to the pane_data structure associated with the 'master' window.
  91.  * Returns NULL if the master window isn't linked.
  92.  */
  93.  
  94. extern pane_data *Pane_GetSysHandle(window_handle master);
  95.  
  96.  
  97. /* Pane_SetFlags
  98.  * Sets the flags of the Pane/Master window relationship.
  99.  * Returns the current flags if 'flags' is -1.
  100.  * Returns NULL if the master window isn't linked.
  101.  */
  102.  
  103. extern int Pane_SetFlags(window_handle master, int flags);
  104.  
  105.  
  106. /*
  107.  * Pane_Link
  108.  * Links the pane window handle to the master window handle.
  109.  * if offset or size == NULL then the data is taken from the template
  110.  */
  111.  
  112. extern void Pane_Link(window_handle mast, window_handle pane,
  113.                       wimp_point *offset, wimp_point *size, int flags);
  114.  
  115.  
  116. /*
  117.  * Pane_CreateAndLink
  118.  * Creates the windows using Window_Create and then Pane_Links them together.
  119.  * returns window handle of the master window
  120.  * if offset or size == NULL then the data is taken from the template
  121.  */
  122.  
  123. extern window_handle Pane_CreateAndLink(char *mastname, char *panename,
  124.                                         int mastmaxsize, int panemaxsize,
  125.                                         wimp_point *offset, wimp_point *size, int flags);
  126.  
  127. /*
  128.  * Pane_Show
  129.  * Simply calls Window_Show for the master window and the pane.
  130.  */
  131.  
  132. extern void Pane_Show(window_handle window, window_openpos openpos);
  133.  
  134.  
  135. /*
  136.  * Pane_Delete
  137.  * Calls Window_Delete for the master window and the pane and de-links them
  138.  */
  139.  
  140. extern void Pane_Delete(window_handle window);
  141.  
  142.  
  143. /*
  144.  * Pane_Hide
  145.  * Simply calls Window_Hide for the master window and the pane.
  146.  */
  147.  
  148. extern void Pane_Hide(window_handle window);
  149.  
  150. #endif
  151.