home *** CD-ROM | disk | FTP | other *** search
-
- Tachnical description of the 'window' data type
- -----------------------------------------------
-
- To make life easier a standard window structure has been defined to allow
- library routines to work with a range of different windows, whilst being
- able to locate data local to that window.
-
- As a consequence wimp window handles are not generally used as parameters in
- the procedures/functions, rather pointers to these defined structures. This
- file sets out the format of these structures so that you can create your own
- specific window types.
-
- The window library allows for upto 65536 different window 'types'. By
- default all created windows are given a null window type (number 0) which
- does nothing to describe the window. Simple Text Windows (STW library) are
- given a window type 1, thus you can easily work out that upon a redraw
- event, say, for any window of type 1 you need to call FNstw_redraw.
-
- Useful routines to keep in mind with windows are :
-
- PROCwin_settype - Sets a window's type
-
- FNwin_findtype - Gets a window's type (or -1 for a bad window structure)
-
- FNwin_findwin - Returns a 'window' given the window handle
- (useful for when the WIMP simply gives you a handle)
-
-
- If you want to create your own window type you should initially give it a
- number between &F000 and &FFFF. This will allow future officially released
- libraries to fit in with your own libraries without a clash as only
- officially released window types should be numbered from &1 to &EFFF. This
- does leave you to define upto 4096 types of your own and so should not be
- too much of a limitation.
-
-
- A 'window' is a pointer to a data block which is as follows :
-
- Address Contents Extra description
-
- ________________
- | |
- window - 16 | Identifier | &076Cxxxx where xxxx is the type
- |________________|
- | |
- window - 12 | Local pointer | to data associated with window
- |________________|
- | |
- window - 8 | Wimp Handle |
- |________________|
- | |
- window - 4 | Indirect Data | pointer to indirected icons' data
- |________________|
- | |
- window | Definition Ptr | Pointer to window definition
- |________________|
-
-
- Thus a 'window' is basically a pointer to the last word in a 20 word block.
- However with windows created by copying templates (using the templates
- library) the window definition follows directly on from this block (ie.
- !window = window + 4).
-
- The &076C part of the 'window' identifier is used by the window library for
- checking that a given 'window' is valid, and thus all window structures must
- contain this value.
-
- The local pointer ( !(window-12) ) is free for the use of a particular
- window type, and is not used by the window library at all. For example the
- STW library uses this pointer to point to the text contained within the
- window.
-
- When a window is destroyed (using PROCtemp_delcopy) the complete structure
- is deallocted, and it's contents become undefined. Thus before destroying a
- window you should make sure that any data pointed to by the local pointer is
- deallocted.
-
- When you create a 'window' using FNwin_fakewin (ie. it was not created
- from a copy of a template, but instead from a template itself, etc.) you can
- still pass this window to PROCtemp_delcopy, but care must be taken with this.
- A call to PROCtemp_delcopy on such a window will cause the 'window' block
- to be deallocated, as well as the block pointed to by !(window-4) (ie. the
- indirect data block). Thus for this to work the pointer at window-4 must point
- either to NULL (zero) or to the start of a block allocated by malloc.
-
- I know the window 'block' may seem a bit odd, particularly as the pointer
- points to the final word, but this is for historical reasons which are best
- not entered into.
-