home *** CD-ROM | disk | FTP | other *** search
- /*
- bordobj.h
-
- % "public" header for border objects
-
- OWL 1.2
- Copyright (c) 1986, 1987, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 9/01/87 jmd added NO_PROTO option
- 6/23/88 jmd converted generic pointers to VOID*
- 7/09/88 jmd added windows
- 8/08/88 jmd added bord_FixSides
- 8/09/88 jmd added new object stuff
- 8/13/88 jmd changed bd_ names to bord_
- 9/12/88 jmd Added in and out data to objects
- 10/05/88 jmd Added BD_PROMPTLEN
- 11/02/88 ted Changed to new non-window border scheme
- 12/04/88 jmd moved some routines from bordod.h to here
- 12/16/88 jmd Added bord_SendMsg
-
- 3/31/89 ted split attr into xd struct
- 4/10/89 jmd added NULL test to bord_Attr
- 5/12/89 jmd renamed bord_Open to win_SetBorder
- 5/23/89 jmd added "border features"
- 5/28/89 jmd added Shadow support
- 7/12/89 ted Converted '_func' prototypes from typedef to macro.
- 8/04/89 jmd added BD_TOP feature
- 5/28/89 jmd moved Shadow support out.
-
- 9/27/89 ted Added bord_GetSides funcs and IsCharSize/IsFixedSize dummies.
- 11/10/89 jmd added border scaling strategy, set title and prompt macros
- 11/16/89 jmd fixed IsChar macros
- 11/30/89 ted Fixed IsChar macros again.
- 12/02/89 ted Made bord_GetSides a macro to bord_getfwhsides.
- 12/10/89 jmd made win_GetBorder macro
- 12/20/89 ted Moved features from border od to xd.
- 12/20/89 ted Added hzscroll, vtscroll, maxmin & mousethru feature flags.
- 1/08/89 ted Added BDM_SET & GET MENU msg for border-attached menus.
- 1/17/90 ted Added shademsg args to _Expose functions.
- 3/28/90 jmd ansi-fied
- */
-
- #include "bord.h" /* file of all border object class function names */
- /* winobj.h is already included for all owl files */
-
- extern class_func (border_Class);
-
- #define bd_fptr class_fptr /* make it look like it does in the manual */
-
- #define bord_Do(win, msg, indata, outdata) \
- ((win_GetBorder(win) != NULL) ? obj_Do(win_GetBorder(win), msg, indata, outdata) : 0)
-
- /*** Border Window messages ***/
-
- /* messages used externally */
- #define BDM_SETTITLE (OBJM_LASTMSG+0)
- #define BDM_GETTITLE (OBJM_LASTMSG+1)
- #define BDM_PROMPT (OBJM_LASTMSG+2)
- #define BDM_SETMENU (OBJM_LASTMSG+3)
- #define BDM_GETMENU (OBJM_LASTMSG+4)
-
- /* messages used internally */
- #define BDM_DRAW (OBJM_LASTMSG+10)
- #define BDM_SHADOW (OBJM_LASTMSG+11)
- #define BDM_RESIZE (OBJM_LASTMSG+12)
- #define BDM_SCROLL (OBJM_LASTMSG+13)
- #define BDM_STARTMOUSE (OBJM_LASTMSG+14)
- #define BDM_MOUSE (OBJM_LASTMSG+15)
- #define BDM_ENDMOUSE (OBJM_LASTMSG+16)
-
- #define BDM_LASTMSG (OBJM_LASTMSG+22)
-
- /** border "mouse feature" flags (bit masks) **/
-
- #define BD_MOVE 0x01
- #define BD_RESIZE 0x02
- #define BD_OUTLINE 0x04
- #define BD_TOP 0x08
- #define BD_MAXMIN 0x10
- #define BD_HZSCROLL 0x20
- #define BD_VTSCROLL 0x40
- #define BD_MOUSETHRU 0x80
-
- /** border scaling strategy flags **/
-
- #define BDS_CHARSIZE 0x00
- #define BDS_FIXEDSIZE 0x01
-
- /* -------------------------------------------------------------------------- */
- typedef struct _borderxd {
- common_xd cd; /* common object super class */
- byte attr; /* the border's foreground/background attribute */
- unsigned scale:1; /* border scaling strategy */
- unsigned feature; /* Border's set of features */
-
- } border_xd;
-
- /* Macros-------------------------------------------------------------------- */
- #define bord_GetId(border) obj_GetId(border)
- #define bord_getxd(border) ((border_xd *) obj_getxd(border))
- /* -------------------------------------------------------------------------- */
-
- #define bord_GetAttr(win) \
- ((win_GetBorder(win) != NULL) ? (bord_getxd(win_GetBorder(win))->attr) : 0x00)
-
- #define bord_setxdattr(bord, at) (bord_getxd(bord)->attr = (at))
- #define bord_SetAttr(win, at) \
- ((win_GetBorder(win) != NULL) ? (bord_setxdattr(win_GetBorder(win), at), 1) : 0)
-
- #define bord_GetPixWidth(win) ((opcoord)opbox_GetWidth(win_pixboxp(win)))
- #define bord_GetPixHeight(win) ((opcoord)opbox_GetHeight(win_pixboxp(win)))
-
- #define bord_GetWidth(win) \
- ((int)(bord_GetPixWidth(win)/win_GetFontWidth(win)))
-
- #define bord_GetHeight(win) \
- ((int)(bord_GetPixHeight(win)/win_GetFontHeight(win)))
-
- /* Paints all unobscured parts of win and border. */
- #define bord_Paint(win) bord_Expose(win, WINM_PAINT, NULL, WINM_SHADOW, NULL)
-
- #define bord_xoffs(win) (-win_inboxp(win)->xmin)
- #define bord_yoffs(win) (-win_inboxp(win)->ymin)
-
- #define bord_GetColOff(win) (bord_xoffs(win)/win_GetFontWidth(win))
- #define bord_GetRowOff(win) (bord_yoffs(win)/win_GetFontHeight(win))
-
- #define bord_GetXmin(win) (win_pixboxp(win)->xmin)
- #define bord_GetYmin(win) (win_pixboxp(win)->ymin)
- #define bord_GetXmax(win) (win_pixboxp(win)->xmax)
- #define bord_GetYmax(win) (win_pixboxp(win)->ymax)
-
- #define bord_GetLeftCol(win) \
- opcoord_GetXCol(bord_GetXmin(win), win_GetFont(win))
- #define bord_GetTopRow(win) \
- opcoord_GetYRow(bord_GetYmin(win), win_GetFont(win))
- #define bord_GetRightCol(win) \
- (opcoord_GetXCol(bord_GetXmax(win), win_GetFont(win)) - 1)
- #define bord_GetBotRow(win) \
- (opcoord_GetYRow(bord_GetYmax(win), win_GetFont(win)) - 1)
-
- #define bord_setxdscaling(bord, s) (bord_getxd(bord)->scale = (s))
- #define bord_SetScaling(win, s) \
- ((win_GetBorder(win) != NULL) ? (bord_setxdscaling(win_GetBorder(win), s), 1) : 0)
-
- #define bord_getxdscaling(bord) (bord_getxd(bord)->scale)
- #define bord_GetScaling(win) \
- ((win_GetBorder(win) != NULL) ? bord_getxdscaling(win_GetBorder(win)) : BDS_CHARSIZE)
-
- #define bord_GetSides(win, x1op, y1op, x2op, y2op) \
- bord_getfwhsides(win, win_GetFontWidth(win), win_GetFontHeight(win), x1op, y1op, x2op, y2op)
-
- #define bord_IsCharSize(win) (bord_GetScaling(win) == BDS_CHARSIZE)
- #define bord_IsFixedSize(win) (bord_GetScaling(win) == BDS_FIXEDSIZE)
-
- #define bord_SetPrompt(win, prompt) \
- bord_SendMsg(win, BDM_PROMPT, (VOID *) (prompt), NULL)
- #define bord_SetTitle(win, title) \
- bord_SendMsg(win, BDM_SETTITLE, (VOID *) (title), NULL)
- #define bord_SetMenu(win, mw) \
- bord_SendMsg(win, BDM_SETMENU, (VOID *) (mw), NULL)
-
- #define bord_setxdfeature(bord, f) (bord_getxd(bord)->feature = (f))
- #define bord_SetFeature(win, f) \
- ((win_GetBorder(win) != NULL) ? (bord_setxdfeature(win_GetBorder(win), f), 1) : 0)
-
- #define bord_getxdfeature(bord) (bord_getxd(bord)->feature)
- #define bord_GetFeature(win) \
- ((win_GetBorder(win) != NULL) ? bord_getxdfeature(win_GetBorder(win)) : 0)
-
- /* -------------------------------------------------------------------------- */
- /* function prototypes ***/
-
- /* BORDAUX.C */
- extern void bord_GetPixBox(win_type win, opbox *boxp);
- extern void bord_GetBox(win_type win, ocbox *cboxp);
- extern void bord_Expose(win_type win, int emsg, VOID *emsgdata, int shademsg, VOID *shademsgdata);
-
- /* BORDCLOS.C */
- extern void bord_Close(win_type win);
-
- /* BORDDRWT.C */
- extern void bord_DrawTitle(ptd_struct *ptd, int row, int col, char *title, byte attr, int width);
-
- /* BORDGHZB.C */
- extern void bord_GetHzBar(win_type win, int *lend, int *rend, boolean *left, boolean *right);
-
- /* BORDGLTS.C */
- extern void bord_GetLights(win_type win, boolean *up, boolean *down, boolean *left, boolean *right);
-
- /* BORDGVTB.C */
- extern void bord_GetVtBar(win_type win, int *top, int *bot, boolean *up, boolean *down);
-
- /* BORDIMO.C */
- extern void bord_MouseInit(void);
-
- /* BORDOBJ.C */
- extern boolean win_SetBorder(win_type win, class_fptr func);
-
-
- /* BORDSEND.C */
- extern int bord_SendMsg(win_type win, int msg, VOID *indata, VOID *outdata);
-
- /* BORDSETP.C */
- extern void bord_SetPosition(win_type win, int row, int col);
- extern void bord_SetPixPosition(win_type win, opcoord xpos, opcoord ypos);
-
- /* BORDSSDS.C */
- extern void bord_SetSides(win_type win, int topoffs, int leftoffs, int botoffs, int rightoffs);
- extern void bord_SetPixSides(win_type win, opcoord xminoffs, opcoord yminoffs, opcoord xmaxoffs, opcoord ymaxoffs);
- extern boolean bord_getfwhsides(win_type win, opcoord fw, opcoord fh, int *topoffsp, int *leftoffsp, int *botoffsp, int *rightoffsp);
- extern boolean bord_GetPixSides(win_type win, opcoord *xminoffsp, opcoord *yminoffsp, opcoord *xmaxoffsp, opcoord *ymaxoffsp);
-
- /* bordout.c - see winpriv.h */
- /* -------------------------------------------------------------------------- */
-
-