X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=menu%2Fm_item_val.c;h=cebf693fbd349cff41248b46ee1fa40d428b4623;hp=06e766d5812bf68419b4e55d9642edf174262fb3;hb=f70db18a0c3c6a828d8a5999be37239f01c9d98a;hpb=661078ddbde3ce0f3b06e95642fbb9b5fef7dca1 diff --git a/menu/m_item_val.c b/menu/m_item_val.c index 06e766d5..cebf693f 100644 --- a/menu/m_item_val.c +++ b/menu/m_item_val.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Juergen Pfeifer 1995,1997 * + * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ /*************************************************************************** @@ -37,13 +37,13 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_val.c,v 1.6 1998/02/11 12:13:49 tom Exp $") +MODULE_ID("$Id: m_item_val.c,v 1.14 2004/12/11 23:29:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : int set_item_value(ITEM *item, int value) | -| Description : Programmatically set the items selection value. This is +| Description : Programmatically set the item's selection value. This is | only allowed if the item is selectable at all and if | it is not connected to a single-valued menu. | If the item is connected to a posted menu, the menu @@ -52,18 +52,20 @@ MODULE_ID("$Id: m_item_val.c,v 1.6 1998/02/11 12:13:49 tom Exp $") | Return Values : E_OK - success | E_REQUEST_DENIED - not selectable or single valued menu +--------------------------------------------------------------------------*/ -int set_item_value(ITEM *item, bool value) +NCURSES_EXPORT(int) +set_item_value(ITEM * item, bool value) { MENU *menu; - + + T((T_CALLED("set_item_value(%p,%d)"), item, value)); if (item) { menu = item->imenu; - + if ((!(item->opt & O_SELECTABLE)) || - (menu && (menu->opt & O_ONEVALUE))) + (menu && (menu->opt & O_ONEVALUE))) RETURN(E_REQUEST_DENIED); - + if (item->value ^ value) { item->value = value ? TRUE : FALSE; @@ -71,7 +73,7 @@ int set_item_value(ITEM *item, bool value) { if (menu->status & _POSTED) { - Move_And_Post_Item(menu,item); + Move_And_Post_Item(menu, item); _nc_Show_Menu(menu); } } @@ -79,7 +81,7 @@ int set_item_value(ITEM *item, bool value) } else _nc_Default_Item.value = value; - + RETURN(E_OK); } @@ -92,9 +94,11 @@ int set_item_value(ITEM *item, bool value) | Return Values : TRUE - if item is selected | FALSE - if item is not selected +--------------------------------------------------------------------------*/ -bool item_value(const ITEM *item) +NCURSES_EXPORT(bool) +item_value(const ITEM * item) { - return ((Normalize_Item(item)->value) ? TRUE : FALSE); + T((T_CALLED("item_value(%p)"), item)); + returnBool((Normalize_Item(item)->value) ? TRUE : FALSE); } /* m_item_val.c ends here */