home *** CD-ROM | disk | FTP | other *** search
- /*
- bordobj.c 2/87
-
- % Routines for borders.
- Includes the border object super class
-
- OWL 1.1
- Copyright (c) 1986-1989, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 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 added bord_Open and bord_Close
- 9/12/88 jmd Added in and out data to objects
- 10/05/88 jmd Added win_PutUnder
- 10/31/88 Ted Removed linking
- 11/15/88 Ted Fixed GetBox x/y col/row bug
- 11/20/88 jmd Added ID to obj struct
- 12/01/88 jmd Fixed NULL func in bord_Open
-
- 4/21/89 jmd Added GET TITLE msg, intercepted other messages
- 4/24/89 jdc made the GET TITLE msg return the title
- 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/07/89 gam changed NULL to FNULL
- 8/04/89 jmd added BD_TOP feature
- 8/10/89 ted Moved Shadow support to winexpos.
- 8/12/89 jdc renamed from border.c
- 8/12/89 jmd added WHO message
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
- #include "bordobj.h"
- #include "bordod.h"
-
- OGLOBAL objreq_fptr bdreq_mousefptr = objreq_Null;
-
- /* -------------------------------------------------------------------------- */
-
- int border_Class(objdata, msg, indata, outdata)
- VOID *objdata; /* object instance data pointer */
- int msg; /* message */
- VOID *indata; /* message input data */
- VOID *outdata; /* message output data */
- /*
- border object dispatch function
- */
- {
- border_od *bdd;
- unsigned int feature;
-
- bdd = (border_od *) objdata;
-
- switch(msg) {
- case OBJM_GETDATASIZE:
- /* This Class has no ID of its own.
- It is inherited from a specific border type
- */
- ((ogds_struct *) outdata)->odsize = sizeof(border_od);
- ((ogds_struct *) outdata)->xdsize = sizeof(border_xd);
- break;
-
- case OBJM_OPEN:
- /* indata should be the window getting the border */
- bdd->win = (win_type) indata;
- bdd->title = NULL;
-
- bdd->debounced = 0; /* debounced flag */
- bdd->outline = 0; /* outline move flag */
- bdd->resize = 0; /* mouse resize flag */
- bdd->move = 0; /* mouse move flag */
- bdd->top = 0; /* mouse window top flag */
-
- /* Set the initial border attribute */
- bord_setxdattr(bordod_GetSelf(bdd), win_GetAttr(bdd->win));
-
- return(common_DoRaw(&(bdd->cd), msg, indata, outdata));
-
- case OBJM_CLOSE:
- /* free the title if there is one */
- if (bdd->title != NULL) {
- ofree(OA_BDTITLE, (VOID *) bdd->title);
- }
-
- /* reset border sides */
- bord_SetSides(bdd->win, 0, 0, 0, 0);
-
- /* No break; fall through to default */
-
- default:
- /* pass other messages to common superclass */
- return(common_DoRaw(&(bdd->cd), msg, indata, outdata));
-
- case OBJM_WHO:
- /* Identify ourselves */
- return (*((int *) indata) == ID_BORDER);
-
- case BDM_GETTITLE:
- *((char **) outdata) = bdd->title;
- break;
-
- case BDM_SETFEATURE:
- /* indata is an unsigned * containing a bit mask */
- feature = *((unsigned *) indata);
-
- bdd->outline = (feature & BD_OUTLINE) ? 1 : 0; /* outline move flag */
- bdd->resize = (feature & BD_RESIZE) ? 1 : 0; /* mouse resize flag */
- bdd->move = (feature & BD_MOVE) ? 1 : 0; /* mouse move flag */
- bdd->top = (feature & BD_TOP) ? 1 : 0; /* mouse top flag */
- break;
-
- case BDM_GETFEATURE:
- /* outdata is an unsigned * containing a bit mask */
- feature = 0;
-
- feature |= (bdd->outline ? BD_OUTLINE : 0);
- feature |= (bdd->resize ? BD_RESIZE : 0);
- feature |= (bdd->move ? BD_MOVE : 0);
- feature |= (bdd->top ? BD_TOP : 0);
-
- *((unsigned *) outdata) = feature;
- break;
-
- case BDM_STARTMOUSE:
- case BDM_MOUSE:
- case BDM_ENDMOUSE:
- return((*bdreq_mousefptr)(objdata, msg, indata, outdata));
-
- case BDM_SHADOW:
- case BDM_DRAW:
- break;
-
- case BDM_RESIZE:
- case BDM_SCROLL:
- case BDM_SETTITLE:
- case BDM_PROMPT:
- break;
- }
- return(TRUE);
- }
- /* -------------------------------------------------------------------------- */
-
- boolean win_SetBorder(win, func)
- win_type win;
- class_fptr func;
- /*
- Creates a border object and links it to the client window.
- Returns FALSE if unable to create the border.
- If func is NULL, close the current border.
- */
- {
- if (win == NULL) {
- return(FALSE);
- }
-
- bord_Close(win);
-
- if (func == FNULL) {
- return(TRUE);
- }
-
- return(win_setbd(win, obj_Open(func, (VOID *) win)) != NULL);
- }
- /* -------------------------------------------------------------------------- */
-
-