home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name MNATR -- Change attributes on item in a menu.
- *
- * Synopsis presult = mnatr (pmenu, pitem, mode);
- *
- * BMENU *presult Pointer to newly-changed BMENU
- * structure, or NIL if failure.
- * const BITEM *pitem
- * Item to change attributes on.
- * int mode MN_UNHIGHLIGHT to unhighlight the
- * item, MN_HIGHLIGHT to highlight it.
- *
- * Description This function changes the attributes on a given item
- * in a given menu. Nothing else in the menu's window
- * is changed.
- *
- * The output is delayed.
- *
- * Returns presult Pointer to newly-changed BWINDOW
- * structure, or NIL if failure.
- * b_wnerr Possible values:
- * (No change) Success.
- * MN_BAD_MENU Pmenu is invalid.
- * MN_BAD_ITEM Pitem is invalid.
- * WN_BAD_WIN Pmenu->pwin is invalid.
- * WN_NOT_SHOWN Internal error.
- * WN_BAD_DEV Internal error.
- * WN_NULL_PTR Internal error.
- *
- * Version 6.00 (C)Copyright Blaise Computing Inc. 1987,1989
- *
- **/
-
- #include <bmenu.h>
-
- BMENU *mnatr (pmenu, pitem, mode)
- BMENU *pmenu;
- const BITEM *pitem;
- int mode;
- {
-
- /* Validate menu data structures. */
- mnvalidm (pmenu)
-
- /* Check validity of item. */
- if (pitem == NIL)
- wnreterr (WN_ILL_VALUE);
- if (pitem->signature != MN_ITEM_SIGN)
- wnreterr (MN_BAD_ITEM);
-
- /* Set attributes on the menu item. */
- if (mode == MN_HIGHLIGHT)
- {
- if (wnatrblk (pmenu->pwin,
- pitem->row, pitem->col,
- pitem->row,
- (pitem->col + pitem->len) - 1,
- utlonyb (pmenu->hilattr),
- uthinyb (pmenu->hilattr), WN_NO_UPDATE) == NIL)
- return (NIL);
- }
- else
- /* Un-highlight item */
- if (pitem->pcharattr)
- {
- if (NIL == wnwrrect(pmenu->pwin,
- pitem->row,pitem->col,
- pitem->row,pitem->col + pitem->len - 1,
- pitem->pcharattr,
- -1,-1,CHAR_ATTR | WN_NO_UPDATE))
- return(NIL);
- }
- else
- if (wnatrblk (pmenu->pwin,
- pitem->row, pitem->col,
- pitem->row,
- (pitem->col + pitem->len) - 1,
- utlonyb (pitem->attr),
- uthinyb (pitem->attr), WN_NO_UPDATE) == NIL)
- return (NIL);
- return (pmenu);
- }