X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=menu%2Fm_item_val.c;h=337dbfcc6808a1724456a3347f360d926268e377;hp=aa3e43ac8d1a0c22d50666b16094588254bedd89;hb=16fea43a5003e094f1f7eee30bdd0ef2f2c51dba;hpb=46722468f47c2b77b3987729b4bcf2321cccfd01 diff --git a/menu/m_item_val.c b/menu/m_item_val.c index aa3e43ac..337dbfcc 100644 --- a/menu/m_item_val.c +++ b/menu/m_item_val.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2010 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 * @@ -28,7 +28,6 @@ /**************************************************************************** * Author: Juergen Pfeifer, 1995,1997 * - * Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en * ****************************************************************************/ /*************************************************************************** @@ -38,13 +37,13 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_val.c,v 1.10 2002/07/06 15:22:16 juergen Exp $") +MODULE_ID("$Id: m_item_val.c,v 1.15 2010/01/23 21:20:10 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 @@ -54,18 +53,19 @@ MODULE_ID("$Id: m_item_val.c,v 1.10 2002/07/06 15:22:16 juergen Exp $") | E_REQUEST_DENIED - not selectable or single valued menu +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_item_value (ITEM *item, bool value) +set_item_value(ITEM * item, bool value) { MENU *menu; - + + T((T_CALLED("set_item_value(%p,%d)"), (void *)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; @@ -73,7 +73,7 @@ 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); } } @@ -81,7 +81,7 @@ set_item_value (ITEM *item, bool value) } else _nc_Default_Item.value = value; - + RETURN(E_OK); } @@ -95,9 +95,10 @@ set_item_value (ITEM *item, bool value) | FALSE - if item is not selected +--------------------------------------------------------------------------*/ NCURSES_EXPORT(bool) -item_value (const ITEM *item) +item_value(const ITEM * item) { - return ((Normalize_Item(item)->value) ? TRUE : FALSE); + T((T_CALLED("item_value(%p)"), (const void *)item)); + returnBool((Normalize_Item(item)->value) ? TRUE : FALSE); } /* m_item_val.c ends here */