home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
372.lha
/
PopUpMenu_3.2
/
Source
/
Highlight.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-05-06
|
2KB
|
77 lines
#include "PopUpMenu.h"
/**************************************************
* HighLightItem(Item, ItemWindow, Mode) *
* *
* Input: *
* Item - Item to highlight. *
* ItemWindow - Data for the window to draw in. *
* Mode - HIGHLIGHTON or HIGHLIGHTOFF. *
* Output: *
* none *
**************************************************/
VOID HighLightItem(Item, ItemWindow, Mode)
struct MenuItem *const Item;
struct WindowData *const ItemWindow;
const UWORD Mode;
{
IMPORT struct RastPort Rp;
/* possible to highlight item ? */
if (Item->Flags & ITEMENABLED) {
const LONG Left = Item->LeftEdge - ItemWindow->LeftValue;
const LONG Right = Left + Item->Width;
const LONG Top = Item->TopEdge - ItemWindow->TopValue;
const LONG Bottom = Top + Item->Height;
SetDrMd(&Rp, COMPLEMENT);
switch (Item->Flags & HIGHFLAGS) {
case HIGHCOMP:
RectFill(&Rp, Left, Top, Right - 1, Bottom - 1);
break;
case HIGHBOX:
Move(&Rp, Left - 1, Top - 2);
Draw(&Rp, Right + 1, Top - 2);
Draw(&Rp, Right + 1, Bottom + 1);
Draw(&Rp, Left - 1, Bottom + 1);
Draw(&Rp, Left - 1, Top - 1);
Draw(&Rp, Right , Top - 1);
Draw(&Rp, Right , Bottom);
Draw(&Rp, Left , Bottom);
Draw(&Rp, Left , Top);
break;
case HIGHIMAGE:
DrawMenuItem(Item, ItemWindow, (UWORD)(!Mode),CLEAROLD);
}
}
}
/*********************************************
* ToggleMenu(Number,Menu) *
* *
* Input: *
* Number - Menu to highlight. *
* Menu - Pointer to the Menu structure. *
* Output: *
* none *
*********************************************/
VOID ToggleMenu(Number,Menu)
const UWORD Number;
struct Menu *const Menu;
{
IMPORT struct WindowData MenuWindow;
IMPORT struct RastPort Rp;
IMPORT const UWORD MenuFontSize;
if (Menu->Flags & MENUENABLED) {
const LONG Bottom = MenuWindow.TopEdge + Number * MenuFontSize;
const LONG Top = Bottom - MenuFontSize + BORDERSIZE;
SetDrMd(&Rp, COMPLEMENT);
RectFill(&Rp, (LONG)MenuWindow.LeftEdge + BORDERSIZE, Top,
(LONG)MenuWindow.RightEdge - BORDERSIZE, Bottom);
}
}