m_item_vis.c revision 1.3
1/*	$OpenBSD: m_item_vis.c,v 1.3 1997/12/03 05:31:22 millert Exp $	*/
2
3/*-----------------------------------------------------------------------------+
4|           The ncurses menu library is  Copyright (C) 1995-1997               |
5|             by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de>                 |
6|                          All Rights Reserved.                                |
7|                                                                              |
8| Permission to use, copy, modify, and distribute this software and its        |
9| documentation for any purpose and without fee is hereby granted, provided    |
10| that the above copyright notice appear in all copies and that both that      |
11| copyright notice and this permission notice appear in supporting             |
12| documentation, and that the name of the above listed copyright holder(s) not |
13| be used in advertising or publicity pertaining to distribution of the        |
14| software without specific, written prior permission.                         |
15|                                                                              |
16| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO  |
17| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-  |
18| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR   |
19| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- |
20| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
21| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH    |
22| THE USE OR PERFORMANCE OF THIS SOFTWARE.                                     |
23+-----------------------------------------------------------------------------*/
24
25/***************************************************************************
26* Module m_item_vis                                                        *
27* Tell if menu item is visible                                             *
28***************************************************************************/
29
30#include "menu.priv.h"
31
32MODULE_ID("Id: m_item_vis.c,v 1.7 1997/10/21 08:44:31 juergen Exp $")
33
34/*---------------------------------------------------------------------------
35|   Facility      :  libnmenu
36|   Function      :  bool item_visible(const ITEM *item)
37|
38|   Description   :  A item is visible if it currently appears in the
39|                    subwindow of a posted menu.
40|
41|   Return Values :  TRUE  if visible
42|                    FALSE if invisible
43+--------------------------------------------------------------------------*/
44bool item_visible(const ITEM * item)
45{
46  MENU *menu;
47
48  if ( item                                               &&
49      (menu=item->imenu)                                  &&
50      (menu->status & _POSTED)                            &&
51      ( (menu->toprow + menu->arows) > (item->y) )        &&
52      ( item->y >= menu->toprow) )
53    return TRUE;
54  else
55    return FALSE;
56}
57
58/* m_item_vis.c ends here */
59