m_item_vis.c revision 76726
155992Swpaul/**************************************************************************** 255992Swpaul * Copyright (c) 1998,2000 Free Software Foundation, Inc. * 355992Swpaul * * 455992Swpaul * Permission is hereby granted, free of charge, to any person obtaining a * 555992Swpaul * copy of this software and associated documentation files (the * 655992Swpaul * "Software"), to deal in the Software without restriction, including * 755992Swpaul * without limitation the rights to use, copy, modify, merge, publish, * 855992Swpaul * distribute, distribute with modifications, sublicense, and/or sell * 955992Swpaul * copies of the Software, and to permit persons to whom the Software is * 1055992Swpaul * furnished to do so, subject to the following conditions: * 1155992Swpaul * * 1255992Swpaul * The above copyright notice and this permission notice shall be included * 1355992Swpaul * in all copies or substantial portions of the Software. * 1455992Swpaul * * 1555992Swpaul * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 1655992Swpaul * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 1755992Swpaul * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 1855992Swpaul * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 1955992Swpaul * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 2055992Swpaul * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 2155992Swpaul * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 2255992Swpaul * * 2355992Swpaul * Except as contained in this notice, the name(s) of the above copyright * 2455992Swpaul * holders shall not be used in advertising or otherwise to promote the * 2555992Swpaul * sale, use or other dealings in this Software without prior written * 2655992Swpaul * authorization. * 2755992Swpaul ****************************************************************************/ 2855992Swpaul 2955992Swpaul/**************************************************************************** 3055992Swpaul * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * 3155992Swpaul ****************************************************************************/ 3255992Swpaul 3355992Swpaul/*************************************************************************** 3455992Swpaul* Module m_item_vis * 3555992Swpaul* Tell if menu item is visible * 3655992Swpaul***************************************************************************/ 3755992Swpaul 3855992Swpaul#include "menu.priv.h" 3955992Swpaul 4055992SwpaulMODULE_ID("$Id: m_item_vis.c,v 1.11 2000/12/10 02:16:48 tom Exp $") 4155992Swpaul 4255992Swpaul/*--------------------------------------------------------------------------- 4355992Swpaul| Facility : libnmenu 4455992Swpaul| Function : bool item_visible(const ITEM *item) 4555992Swpaul| 4655992Swpaul| Description : A item is visible if it currently appears in the 4755992Swpaul| subwindow of a posted menu. 4855992Swpaul| 4955992Swpaul| Return Values : TRUE if visible 5055992Swpaul| FALSE if invisible 5155992Swpaul+--------------------------------------------------------------------------*/ 5255992SwpaulNCURSES_EXPORT(bool) 5355992Swpaulitem_visible (const ITEM * item) 5455992Swpaul{ 5555992Swpaul MENU *menu; 5655992Swpaul 5755992Swpaul if ( item && 5855992Swpaul (menu=item->imenu) && 5955992Swpaul (menu->status & _POSTED) && 6055992Swpaul ( (menu->toprow + menu->arows) > (item->y) ) && 6155992Swpaul ( item->y >= menu->toprow) ) 6255992Swpaul return TRUE; 6355992Swpaul else 6455992Swpaul return FALSE; 6555992Swpaul} 6655992Swpaul 6755992Swpaul/* m_item_vis.c ends here */ 6855992Swpaul