home *** CD-ROM | disk | FTP | other *** search
- #ifdef EGSPUSERWINDOW
- #define EXTERN
- #else
- #define EXTERN extern
- #endif
-
- #include <egs/egsintui.h>
- #include <egs/egsgadbox.h>
-
-
- /* If a user window is opened as a NON MODAL, it will run
- together with all other windows, until the winodw is
- closed. A MODAL window, will run, and hold up the
- program until completed.
- */
- #define WINDOW_NONMODAL 0
- #define WINDOW_MODAL 1
-
- #define SIGNAL_CLOSE 0x1
-
- /*************
- Overview of UserInputWindow structure...
-
- Next.
- PRIVATE. Don't touch this...
- Window.
- EI_WindowPtr to your Window.
- GadCon.
- Don't play around with this. This is the GadgetContext for your
- window.
- Create.
- Function Pointer to your gadget creation routine.
- This is REQUIRED.
- Redraw.
- Function Pointer to your routine to Redraw all gadgets.
- Not required, but needed if you want to update int gadgets and
- so forth.
- Close.
- Function Pointer to your close routine. Use this if you have
- allocated any additional memory in Create. You can free it here.
- Not necessary if you don't care when the window closes.
- GadgetDown.
- Function Pointer to your GadgetDown processing routine. This is
- where you do something based on a user's click on any of your
- gadgets.
- Not necessary, but your window won't do much if you don't
- process you gadget events!
- IDCMP.
- Function Pointer to your IDCMP processing routine. Ignore this
- if you only need the messages supplied for UserWindows! This
- is only a last resort. If you need more control of the Event
- Handler than I have written, you can steal away the entire
- Event Handler fro the UserWindow module. Remember, if you do
- this to copy the Event Handler from this module and copy
- it in. (You will need to call the Resize and SizeVerify, and
- CloseWindow stuff the same.) Once again... last resort.
- Set to NULL if not needed.
- Menu.
- Function Pointer to your Menu processing routine. If you have
- no menus, set this to NULL.
- RawKey.
- Function Pointer to your RawKey processing routine if you have
- one. Set to NULL if not.
- VanillaKey.
- Function Pointer to your VanillaKey processing routine if you
- have one. Set to NULL if not.
- MouseMove.
- Function Pointer to your MouseMove processing routine if you have
- one. Set to NULL if none.
- MouseButtons.
- Function Pointer to your MouseButtons processing routine if you
- have one. Set to NULL if none.
- UserData.
- PRIVATE. This is the WindowInfo structure allocated and given
- to your window. I keep a copy around until the final
- Close_UserWindow so we don't have to realloc it all the time.
- Don't touch!!!!
- Data.
- PUBLIC. This is a void * pointer to do with as you will. If you
- wish to alloc something and attach it to this, do so in your
- Create routine, and free it in your Close routine.
- ModeFlags.
- PRIVATE. This is set when you call the Init_UserWindow routine.
- It tells me if you want a MODAL or a NONMODAL window.
- One of the following:
- WINDOW_NONMODAL
- WINDOW_MODAL
- IDCMPFlags.
- PRIVATE. This is set when you call the Init_UserWindow routine.
- It contains the IDCMPFlags for this window. Any of the following,
- OR'd (|) together:
- EI_iMOUSEBUTTONS
- EI_iMOUSEMOVE
- EI_iRAWKEY
- EI_iACTIVEWINDOW
- EI_iREFRESHWINDOW
- EI_iCLOSEWINDOW
- EI_iNEWSIZE
- EI_iMENUPICK
- EI_iGADGETDOWN
- EI_iGADGETUP
- EI_iMENUVERIFY
- EI_iVANILLAKEY
- EI_iSIZEVERIFY
- EI_iINACTIVEWINDOW
- EI_iINTUITICKS
- EI_iDISKINSERT
- EI_iDISKREMOVE
- EI_iNEWPREFS
- EI_iMOVEWINDOW
- EI_iDROP
- EI_iMIGRATEVERIFY
- EI_iMIGRATE
-
- Flags.
- PRIVATE. This is set when you call the Init_UserWindow routine.
- It contains the Flags for this window. Any of the following,
- or'd (|) together:
- EI_GIMMEZEROZERO
- EI_BORDERLESS
- EI_SUPER_BITMAP
- EI_SIMPLE_REFRESH
- EI_WINDOWREFRESH
- EI_WINDOWACTIVE
- EI_WINDOW_MENULOCAL
- EI_OWN_IDCMPPORT
- EI_OWN_COLORPALETTE
- EI_FRONTBACKGADGET
- EI_RMBTRAP
- EI_REPORTMOUSE
- EI_BACKDROP
- EI_SMART_REFRESH
- EI_WINDOW_MENUPOPUP
- EI_SIZEBBOTTOM
- EI_SIZEBRIGHT
- EI_WINDOW_USERSTYLE
- EI_ACTIVETOFRONT
- EI_QUICKSCROLL
- EI_WINDOW_SLEEPING
- EI_FIXWINDOW_RATIO
- EI_FORCE_TO_SCREEN
- EI_WINDOWCENTER
- EI_SEND_OUTSIDEMOVES
- EI_MIGRATEABLE
-
- SysGadgets.
- PRIVATE. This is set when you call the Init_UserWindow routine.
- It contains the Bordef.SysGadgets for this window. Any of the
- following or'd (|) together:
- EI_WINDOWCLOSE
- EI_WINDOWSIZE
- EI_WINDOWFRONT
- EI_WINDOWBACK
- EI_WINDOWFLIP
- EI_WINDOWBIG
- EI_WINDOWSMALL
- EI_WINDOWICON
- EI_WINDOWARROWL
- EI_WINDOWARROWR
- EI_WINDOWARROWU
- EI_WINDOWARROWD
- EI_WINDOWSCROLLH
- EI_WINDOWSCROLLV
- EI_WINDOWDRAG
-
- Signals.
- This is where you can tell me something. Currently this is used
- to tell me you wish to close your window while running a
- MODAL window. (It will close on a close window, but you can signal
- me to close it earlier if you want, say on a return from an int
- gadget.)
- To do this, set UserWindow->Signals |= SIGNAL_CLOSE.
- Title.
- PRIVATE. I keep the title of your window here. It is allocated
- on Init_UserWindow and freed on Close_UserWindow. Therefore,
- regardless of what happens after you call Init_UserWindow,
- you must call Close_UserWindow to clean up.
- *************************/
-
- EXTERN struct UserInputWindow {
- void *Next;
- EI_WindowPtr Window;
- EB_GadContext GadCon;
- EB_GadBoxPtr (*Create) (struct UserInputWindow *UserWindow);
- void (*Redraw) (struct UserInputWindow *UserWindow);
- void (*Close) (struct UserInputWindow *UserWindow);
- void (*GadgetDown) (struct UserInputWindow *UserWindow, EI_GadgetPtr iaddress);
- void (*IDCMP) (struct UserInputWindow *UserWindow,
- struct EI_EIntuiMsg *Msg);
- void (*Menu) (struct UserInputWindow *UserWindow, UWORD code);
- void (*RawKey) (struct UserInputWindow *UserWindow, UWORD code, WORD qual);
- void (*VanillaKey) (struct UserInputWindow *UserWindow,
- UWORD code, WORD qual, WORD x, WORD y);
- void (*MouseMove) (struct UserInputWindow *UserWinodw, WORD x, WORD y);
- void (*MouseButtons)(struct UserInputWindow *UserWinodw,
- ULONG code, WORD x, WORD y);
- void *UserData;
- void *Data;
- ULONG ModeFlags;
- ULONG IDCMPFlags;
- ULONG Flags;
- ULONG SysGadgets;
- ULONG Signals;
- EI_MenuPtr MenuPtr;
- struct MsgPort *Port;
- char *Title;
- };
- typedef struct UserInputWindow *UserInputWindowPtr;
-
- /************************
- Overview of WindowInfo structure.
-
- EventHandler.
- PRIVATE! Read Only. Holds our EventHandler.
- UserWindow.
- PRIVATE! Read Only. Reference back to our UserWindow.
-
- ***********************/
-
- EXTERN struct WindowInfo {
- void (*EventHandler) (struct EI_EIntuiMsg *msg); // Event Handler (pointer 2 func)
- UserInputWindowPtr UserWindow;
- };
- typedef struct WindowInfo *WindowInfoPtr;
-
- /* A note about my Typedefs....
- I got used to this because EGS does it alot.
- It turns out that this makes your code much easier
- to read. Try it, you'll like it!
- */
-
- EXTERN void Initialize_UserWindows (void);
- EXTERN void Init_UserWindow (UserInputWindowPtr UserWindow, char *title, WORD ModeFlags,
- EI_MenuPtr MenuPtr, struct MsgPort *Port);
- EXTERN BYTE Open_UserWindow (UserInputWindowPtr UserWindow, WORD x, WORD y);
- EXTERN void Close_UserWindow (UserInputWindowPtr UserWindow);
- EXTERN void Close_All_UserWindows (void);
- EXTERN EI_WindowPtr Create_UserWindow (UserInputWindowPtr UserWindow,
- EI_WindowPtr win, WORD x, WORD y);
- EXTERN void UserWindow_EventHandler (struct EI_EIntuiMsg *Msg);
- EXTERN void Sleep_All_UserWindows (void);
- EXTERN void Wake_All_UserWindows (void);
-
- // These prototypes should be PRIVATE to UserWindow,
- // but if you use an IDCMP funstion pointer, you'll
- // need them.
- EXTERN void AddUserWindow (UserInputWindowPtr UserWindow);
- EXTERN void RemoveUserWindow (UserInputWindowPtr UserWindow);
- EXTERN void SizeVerify_UserWindow (UserInputWindowPtr UserWindow);
- EXTERN void NewSize_UserWindow (UserInputWindowPtr UserWindow);
- EXTERN EI_GadgetPtr myFindGadget (EB_GadContext gadcon,long id);
- #undef EXTERN