m_item_vis.c revision 76726
1142425Snectar/**************************************************************************** 2160814Ssimon * Copyright (c) 1998,2000 Free Software Foundation, Inc. * 3142425Snectar * * 4142425Snectar * Permission is hereby granted, free of charge, to any person obtaining a * 5142425Snectar * copy of this software and associated documentation files (the * 6142425Snectar * "Software"), to deal in the Software without restriction, including * 7142425Snectar * without limitation the rights to use, copy, modify, merge, publish, * 8142425Snectar * distribute, distribute with modifications, sublicense, and/or sell * 9142425Snectar * copies of the Software, and to permit persons to whom the Software is * 10142425Snectar * furnished to do so, subject to the following conditions: * 11142425Snectar * * 12142425Snectar * The above copyright notice and this permission notice shall be included * 13142425Snectar * in all copies or substantial portions of the Software. * 14142425Snectar * * 15142425Snectar * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 16142425Snectar * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 17142425Snectar * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 18142425Snectar * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 19142425Snectar * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 20160814Ssimon * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 21142425Snectar * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 22142425Snectar * * 23142425Snectar * Except as contained in this notice, the name(s) of the above copyright * 24142425Snectar * holders shall not be used in advertising or otherwise to promote the * 25142425Snectar * sale, use or other dealings in this Software without prior written * 26142425Snectar * authorization. * 27142425Snectar ****************************************************************************/ 28142425Snectar 29142425Snectar/**************************************************************************** 30160814Ssimon * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * 31194206Ssimon ****************************************************************************/ 32142425Snectar 33142425Snectar/*************************************************************************** 34142425Snectar* Module m_item_vis * 35142425Snectar* Tell if menu item is visible * 36160814Ssimon***************************************************************************/ 37194206Ssimon 38142425Snectar#include "menu.priv.h" 39142425Snectar 40142425SnectarMODULE_ID("$Id: m_item_vis.c,v 1.11 2000/12/10 02:16:48 tom Exp $") 41142425Snectar 42142425Snectar/*--------------------------------------------------------------------------- 43142425Snectar| Facility : libnmenu 44142425Snectar| Function : bool item_visible(const ITEM *item) 45142425Snectar| 46142425Snectar| Description : A item is visible if it currently appears in the 47142425Snectar| subwindow of a posted menu. 48142425Snectar| 49142425Snectar| Return Values : TRUE if visible 50142425Snectar| FALSE if invisible 51142425Snectar+--------------------------------------------------------------------------*/ 52142425SnectarNCURSES_EXPORT(bool) 53142425Snectaritem_visible (const ITEM * item) 54142425Snectar{ 55142425Snectar MENU *menu; 56142425Snectar 57142425Snectar if ( item && 58142425Snectar (menu=item->imenu) && 59142425Snectar (menu->status & _POSTED) && 60142425Snectar ( (menu->toprow + menu->arows) > (item->y) ) && 61194206Ssimon ( item->y >= menu->toprow) ) 62142425Snectar return TRUE; 63142425Snectar else 64142425Snectar return FALSE; 65160814Ssimon} 66160814Ssimon 67160814Ssimon/* m_item_vis.c ends here */ 68160814Ssimon