m_sub.c revision 166124
150276Speter/****************************************************************************
2166124Srafan * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
350276Speter *                                                                          *
450276Speter * Permission is hereby granted, free of charge, to any person obtaining a  *
550276Speter * copy of this software and associated documentation files (the            *
650276Speter * "Software"), to deal in the Software without restriction, including      *
750276Speter * without limitation the rights to use, copy, modify, merge, publish,      *
850276Speter * distribute, distribute with modifications, sublicense, and/or sell       *
950276Speter * copies of the Software, and to permit persons to whom the Software is    *
1050276Speter * furnished to do so, subject to the following conditions:                 *
1150276Speter *                                                                          *
1250276Speter * The above copyright notice and this permission notice shall be included  *
1350276Speter * in all copies or substantial portions of the Software.                   *
1450276Speter *                                                                          *
1550276Speter * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
1650276Speter * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
1750276Speter * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
1850276Speter * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
1950276Speter * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
2050276Speter * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
2150276Speter * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
2250276Speter *                                                                          *
2350276Speter * Except as contained in this notice, the name(s) of the above copyright   *
2450276Speter * holders shall not be used in advertising or otherwise to promote the     *
2550276Speter * sale, use or other dealings in this Software without prior written       *
2650276Speter * authorization.                                                           *
2750276Speter ****************************************************************************/
2850276Speter
2950276Speter/****************************************************************************
30166124Srafan *   Author:  Juergen Pfeifer, 1995,1997                                    *
3150276Speter ****************************************************************************/
3250276Speter
3350276Speter/***************************************************************************
3450276Speter* Module m_sub                                                             *
3550276Speter* Menus subwindow association routines                                     *
3650276Speter***************************************************************************/
3750276Speter
3850276Speter#include "menu.priv.h"
3950276Speter
40166124SrafanMODULE_ID("$Id: m_sub.c,v 1.10 2004/12/25 21:38:31 tom Exp $")
4150276Speter
4250276Speter/*---------------------------------------------------------------------------
4350276Speter|   Facility      :  libnmenu
4450276Speter|   Function      :  int set_menu_sub(MENU *menu, WINDOW *win)
4550276Speter|
4650276Speter|   Description   :  Sets the subwindow of the menu.
4750276Speter|
4850276Speter|   Return Values :  E_OK           - success
4950276Speter|                    E_POSTED       - menu is already posted
5050276Speter+--------------------------------------------------------------------------*/
5176726SpeterNCURSES_EXPORT(int)
52166124Srafanset_menu_sub(MENU * menu, WINDOW *win)
5350276Speter{
54166124Srafan  T((T_CALLED("set_menu_sub(%p,%p)"), menu, win));
55166124Srafan
5650276Speter  if (menu)
5750276Speter    {
58166124Srafan      if (menu->status & _POSTED)
5950276Speter	RETURN(E_POSTED);
6050276Speter      menu->usersub = win;
6150276Speter      _nc_Calculate_Item_Length_and_Width(menu);
6250276Speter    }
6350276Speter  else
6450276Speter    _nc_Default_Menu.usersub = win;
65166124Srafan
6650276Speter  RETURN(E_OK);
6750276Speter}
6850276Speter
6950276Speter/*---------------------------------------------------------------------------
7050276Speter|   Facility      :  libnmenu
7150276Speter|   Function      :  WINDOW *menu_sub(const MENU *menu)
7250276Speter|
7350276Speter|   Description   :  Returns a pointer to the subwindow of the menu
7450276Speter|
7550276Speter|   Return Values :  NULL on error, otherwise a pointer to the window
7650276Speter+--------------------------------------------------------------------------*/
7776726SpeterNCURSES_EXPORT(WINDOW *)
78166124Srafanmenu_sub(const MENU * menu)
7950276Speter{
80166124Srafan  const MENU *m = Normalize_Menu(menu);
81166124Srafan
82166124Srafan  T((T_CALLED("menu_sub(%p)"), menu));
83166124Srafan  returnWin(Get_Menu_Window(m));
8450276Speter}
8550276Speter
8650276Speter/* m_sub.c ends here */
87