m_item_vis.c revision 1.1
1 2/*************************************************************************** 3* COPYRIGHT NOTICE * 4**************************************************************************** 5* ncurses is copyright (C) 1992-1995 * 6* Zeyd M. Ben-Halim * 7* zmbenhal@netcom.com * 8* Eric S. Raymond * 9* esr@snark.thyrsus.com * 10* * 11* Permission is hereby granted to reproduce and distribute ncurses * 12* by any means and for any fee, whether alone or as part of a * 13* larger distribution, in source or in binary form, PROVIDED * 14* this notice is included with any such distribution, and is not * 15* removed from any of its header files. Mention of ncurses in any * 16* applications linked with it is highly appreciated. * 17* * 18* ncurses comes AS IS with no warranty, implied or expressed. * 19* * 20***************************************************************************/ 21 22/*************************************************************************** 23* Module menu_item_vis * 24* Tell if menu item is visible * 25***************************************************************************/ 26 27#include "menu.priv.h" 28 29/*--------------------------------------------------------------------------- 30| Facility : libnmenu 31| Function : bool item_visible(const ITEM *item) 32| 33| Description : A item is visible if it currently appears in the 34| subwindow of a posted menu. 35| 36| Return Values : TRUE if visible 37| FALSE if invisible 38+--------------------------------------------------------------------------*/ 39bool item_visible(const ITEM * item) 40{ 41 MENU *menu; 42 43 if ( item && 44 (menu=item->imenu) && 45 (menu->status & _POSTED) && 46 ( (menu->toprow + menu->height - 1) >= (item->y) ) && 47 ( item->y >= menu->toprow) ) 48 return TRUE; 49 else 50 return FALSE; 51} 52 53/* m_item_vis.c ends here */ 54