home *** CD-ROM | disk | FTP | other *** search
- /*
- Little Smalltalk, version 2
- Written by Tim Budd, Oregon State University, July 1987
-
- Symantec Think Class Library interface code ©Julian Barkway, April 1994
-
- glue.h
- ------
- Structures, #defines and prototypes relating to the Little Smalltalk-TCL
- interface. Currently, this header is largely identifier-compatible with
- StdWin. However, this may change in future.
- */
- #ifndef __GLUE_H__
- #define __GLUE_H__
-
- #define CURSOR Cursor
- #define WINDOW _window // These will be used as a pointer to the memory containing
- #define TEXTEDIT char // the real data and should be casted.
- #define MENU MenuInfo
-
- typedef struct _window {
- char *window;
- char *document;
- int stObject; // The Smalltalk window object - added for v3.2
- } _window;
-
- //
- //====== The following definitions and prototypes have been taken from
- //====== Guido van Rossum's StdWin system for reasons of compatibility.
- //
- /* EVENT struct */
-
- struct _event {
- int type;
- WINDOW *window;
- union {
- int character; /* case WE_CHAR: */
- int command; /* case WE_COMMAND: */
- struct { int id; int item; } m; /* case WE_MENU: */
- struct { int left, top, right, bottom; } area; /* case WE_DRAW: */
- struct { /* case WE_MOUSE_DOWN, WE_MOUSE_MOVE, WE_MOUSE_UP: */
- int h;
- int v;
- int clicks;
- int button;
- int mask;
- } where;
- int sel; /* case WE_LOST_SEL: */
- struct { int code; int mask; } key; /* case WE_KEY: */
- } u;
- };
-
- #define EVENT struct _event
-
-
- /* Event types */
- /* XXX Should be reordered */
-
- #define WE_NULL 0 /* (Used internally) */
- #define WE_ACTIVATE 1 /* Window became active */
- #define WE_CHAR 2 /* Character typed at keyboard */
- #define WE_COMMAND 3 /* Special command, function key etc. */
- #define WE_MOUSE_DOWN 4 /* Mouse button pressed */
- #define WE_MOUSE_MOVE 5 /* Mouse moved with button down */
- #define WE_MOUSE_UP 6 /* Mouse button released */
- #define WE_MENU 7 /* Menu item selected */
- #define WE_SIZE 8 /* Window size changed */
- #define WE_MOVE 9 /* Window moved (reserved) */
- #define WE_DRAW 10 /* Request to redraw part of window */
- #define WE_TIMER 11 /* Window's timer went off */
- #define WE_QUIT 11 // -- Since the use of the timer is not supported
- // by Little Smalltalk, I am using this event to
- // pass the command-Q (quit) notification from
- // TCL to Little Smalltalk. JRB, 5/94
- #define WE_DEACTIVATE 12 /* Window became inactive */
- #define WE_EXTERN 13 /* Externally generated event (Amoeba) */
- #define WE_KEY 14 /* Non-ASCII key event */
- #define WE_LOST_SEL 15 /* Lost selection */
- #define WE_CLOSE 16 /* User wants to close window */
-
-
- /* Special keys reported by WE_COMMAND */
- /* XXX Should become key events */
-
- #define WC_CLOSE 1 /* Obsolete */
- /* The following four are arrow keys */
- #define WC_LEFT 2
- #define WC_RIGHT 3
- #define WC_UP 4
- #define WC_DOWN 5
- /* ASCII keys */
- #define WC_CANCEL 6
- #define WC_BACKSPACE 7
- #define WC_TAB 8
- #define WC_RETURN 9
- /* IBM-PC keys -- not in all implementations */
- /* XXX Should be done differently */
- #define WC_HOME 10
- #define WC_END 11
- #define WC_CLEAR 12
- #define WC_INS 13
- #define WC_DEL 14
- #define WC_PAGE_UP 15
- #define WC_PAGE_DOWN 16
- #define WC_META_LEFT 17
- #define WC_META_RIGHT 18
- #define WC_META_HOME 19
- #define WC_META_END 20
- #define WC_META_PAGE_UP 21
- #define WC_META_PAGE_DOWN 22
- /* XXX Should have entries for Alt-letter and F1-F10 etc. ? */
-
-
- /* Codes for selections (e.u.sel for WE_LOST_SEL) */
-
- #define WS_CLIPBOARD 0
- #define WS_PRIMARY 1
- #define WS_SECONDARY 2
-
-
- /* Masks for EVENT->u.where.mask and EVENT->u.key.mask.
- Some of these happen to be the same as the X11 masks (which are cast
- in stone for eternity); the implementation relies on that.
- (It is merely a convention that Meta is bit 3, and Option/Num aren't
- normally used in X11.) */
-
- #define WM_SHIFT (1 << 0)
- #define WM_LOCK (1 << 1)
- #define WM_CONTROL (1 << 2)
- #define WM_META (1 << 3)
- #define WM_OPTION (1 << 4)
- #define WM_NUM (1 << 5)
-
- #define WM_BUTTON1 (1 << 8)
- #define WM_BUTTON2 (1 << 9)
- #define WM_BUTTON3 (1 << 10)
- #define WM_BUTTON4 (1 << 11)
- #define WM_BUTTON5 (1 << 12)
-
-
- //====================== Function Prototypes =========================
-
- void winit (void);
- void getVersionNumber (char *str);
- void wdone (void);
- void setFont (TEXTEDIT *tp, char *fontName);
- void setFontSize (TEXTEDIT *tp, short fontSize);
- void setTypeFace (TEXTEDIT *tp, short typeFace);
- void tereplace (TEXTEDIT *tp, char *str);
- void replaceAllText (TEXTEDIT *tp, char *str);
- void deleteAllText (TEXTEDIT *tp);
- void getPaneSize (TEXTEDIT *tp, short *width, short *height);
- TEXTEDIT *addScrollPane (WINDOW *win, short left, short top, short right, short bottom,
- short horizOption, short vertOption);
- TEXTEDIT *addSelPane (WINDOW *win, short left, short top, short right, short bottom,
- short horizElastic, short vertElastic, short lineLength);
- TEXTEDIT *addTextPane (WINDOW *win, short left, short top, short right, short bottom,
- short horizElastic, short vertElastic, short lineLength);
- TEXTEDIT *tecreate (WINDOW *win, int left, int top, int right, int bottom);
- TEXTEDIT *addGraphicsPane (WINDOW *win, short left, short top, short right, short bottom,
- short horizElastic, short vertElastic);
- Boolean teevent (TEXTEDIT *tp, EVENT *e);
- void scrollToSelection (TEXTEDIT *tp);
- void setTextSelection (TEXTEDIT *tp, long startPos, long endPos);
- void getTextSelection (TEXTEDIT *tp, long *startPos, long *endPos);
- char *teGetSelectedText (TEXTEDIT *tp);
- char *tegettext (TEXTEDIT *tp);
- void tedraw (register TEXTEDIT *tp);
-
- void wmessage (char *prompt);
- void wperror (char *name);
- Boolean waskstr (char *prompt, char *buf, int len);
- int waskync (char *prompt, int def);
- Boolean waskfile (char *prompt, char *buf, int len, Boolean newFile, short ftype);
- void saveTE (TEXTEDIT *tp, short fileNum);
- void loadTE (TEXTEDIT *tp, short fileNum);
-
- void wmenuenable (MENU *mp, int item, int flag);
- MENU *wmenucreate (int id, char *title);
- MENU *popUpMenuCreate (short menuID);
- void wmenuattach (WINDOW *win, MENU *mp);
- void wmenudetach (WINDOW *win, MENU *mp);
- void wmenucheck (MENU *mp, int item, int flag);
- void wmenusetdeflocal (Boolean local);
- int wmenuadditem (MENU *mp, char *text, int shortcut);
- void selectFromPopUpMenu (MENU *mp, short top, short left, short *menu, short *item);
- void wmenudelete (MENU *mp);
- void removeMenuItem (MENU *mp, short menuItem);
-
- void getMaxScreenArea (short *left, short *top, short *right, short *bottom);
- CURSOR *wfetchcursor (char *name);
- void wsetwincursor (WINDOW *win, CURSOR *cursor);
- void setArrowCursor (void);
-
- Boolean docDirty (WINDOW *win);
- void wsetdocsize (WINDOW *win, int docwidth, int docheight);
- void wsetactive (WINDOW *win);
- WINDOW *wopen (char *title,
- void (*drawproc)(WINDOW *win, int top, int left,
- int bottom, int right) );
- WINDOW *wopentosize (char *title, int left, int top, int width, int height, Boolean noClose);
- void wfleep (void);
- void wclose (WINDOW *win);
- void wgetwinsize (WINDOW *win, int *pwidth, int *pheight);
- void wgetwinpos (WINDOW *win, int *h, int *v);
- void windowToFront (WINDOW *win);
- void wsettitle (WINDOW *win, Str255 title);
- void wsetorigin (WINDOW *win, int orgh, int orgv);
-
- void wbegindrawing (TEXTEDIT *pane);
- void wenddrawing (TEXTEDIT *pane);
- void wshade (int left, int top, int right, int bottom, int perc);
- void werase (int left, int top, int right, int bottom);
- void wdrawcircle (int h, int v, int radius);
- void drawLineTo (int h, int v);
- void moveTo (short h, short v);
- void drawPixel (short h, short v);
- void wdrawbox (int left, int top, int right, int bottom);
- void winvert (int left, int top, int right, int bottom);
- void wpaint (int left, int top, int right, int bottom);
- void wdrawtext (int h, int v, char *str, int len);
- void wdrawchar (int h, int v, int c);
-
- OSErr sendOpenDocEvent (long theAppSig, SFReply *theSFReply);
- Boolean getFileInfo (char *fullPath, long *fType);
-
- Boolean processStartUpEvent (char *buf);
-
- void wgetevent (EVENT *ep);
- void processMouseDown (EventRecord *macEvent, EVENT *ep);
- void wsettimer (WINDOW *win, int deciseconds);
- #endif
-