X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=menu%2Fm_item_top.c;h=68303c7676b5e6b2395d64c27391dc9998d10da7;hp=9417e72bb561c3bd0b7126114f351201c541982a;hb=9f479192e3ca3413d235c66bf058f8cc63764898;hpb=47d2fb4537d9ad5bb14f4810561a327930ca4280 diff --git a/menu/m_item_top.c b/menu/m_item_top.c index 9417e72b..68303c76 100644 --- a/menu/m_item_top.c +++ b/menu/m_item_top.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2021 Thomas E. Dickey * * Copyright 1998-2004,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,30 +38,28 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_top.c,v 1.12 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: m_item_top.c,v 1.16 2021/06/17 21:11:08 tom Exp $") /*--------------------------------------------------------------------------- -| Facility : libnmenu +| Facility : libnmenu | Function : int set_top_row(MENU *menu, int row) -| +| | Description : Makes the specified row the top row in the menu | | Return Values : E_OK - success | E_BAD_ARGUMENT - not a menu pointer or invalid row | E_NOT_CONNECTED - there are no items for the menu +--------------------------------------------------------------------------*/ -NCURSES_EXPORT(int) -set_top_row(MENU * menu, int row) +MENU_EXPORT(int) +set_top_row(MENU *menu, int row) { - ITEM *item; - T((T_CALLED("set_top_row(%p,%d)"), (void *)menu, row)); if (menu) { if (menu->status & _IN_DRIVER) RETURN(E_BAD_STATE); - if (menu->items == (ITEM **) 0) + if (menu->items == (ITEM **)0) RETURN(E_NOT_CONNECTED); if ((row < 0) || (row > (menu->rows - menu->arows))) @@ -72,6 +70,8 @@ set_top_row(MENU * menu, int row) if (row != menu->toprow) { + ITEM *item; + if (menu->status & _LINK_NEEDED) _nc_Link_Items(menu); @@ -85,15 +85,15 @@ set_top_row(MENU * menu, int row) } /*--------------------------------------------------------------------------- -| Facility : libnmenu +| Facility : libnmenu | Function : int top_row(const MENU *) -| +| | Description : Return the top row of the menu | | Return Values : The row number or ERR if there is no row +--------------------------------------------------------------------------*/ -NCURSES_EXPORT(int) -top_row(const MENU * menu) +MENU_EXPORT(int) +top_row(const MENU *menu) { T((T_CALLED("top_row(%p)"), (const void *)menu)); if (menu && menu->items && *(menu->items))