X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=menu%2Fm_item_val.c;h=c62a4e17484f30ea81c9ba6c9f3365ed65e4ddcb;hp=89bd8fb309751efa8c06cae631fd3af74d1777a7;hb=e5d1530ca229aef94a3c84ad33f8ae89f35c4045;hpb=a8987e73ec254703634802b4f7ee30d3a485524d diff --git a/menu/m_item_val.c b/menu/m_item_val.c index 89bd8fb3..c62a4e17 100644 --- a/menu/m_item_val.c +++ b/menu/m_item_val.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 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 * @@ -37,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_val.c,v 1.12 2003/11/08 20:51:29 tom Exp $") +MODULE_ID("$Id: m_item_val.c,v 1.17 2020/05/24 01:40:20 anonymous.maarten Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -52,19 +53,20 @@ MODULE_ID("$Id: m_item_val.c,v 1.12 2003/11/08 20:51:29 tom Exp $") | Return Values : E_OK - success | E_REQUEST_DENIED - not selectable or single valued menu +--------------------------------------------------------------------------*/ -NCURSES_EXPORT(int) -set_item_value (ITEM *item, bool value) +MENU_EXPORT(int) +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; @@ -72,7 +74,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); } } @@ -80,7 +82,7 @@ set_item_value (ITEM *item, bool value) } else _nc_Default_Item.value = value; - + RETURN(E_OK); } @@ -93,10 +95,11 @@ set_item_value (ITEM *item, bool value) | Return Values : TRUE - if item is selected | FALSE - if item is not selected +--------------------------------------------------------------------------*/ -NCURSES_EXPORT(bool) -item_value (const ITEM *item) +MENU_EXPORT(bool) +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 */