X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=menu%2Fm_item_top.c;h=752e20d9edbb45a0d9428895983e73f737d02c06;hp=0a0fb4815a203c029f61c6d7df37ed84d8f46ae2;hb=808858ace09b9bf60f7154e33cb6572f49347101;hpb=a8987e73ec254703634802b4f7ee30d3a485524d diff --git a/menu/m_item_top.c b/menu/m_item_top.c index 0a0fb481..752e20d9 100644 --- a/menu/m_item_top.c +++ b/menu/m_item_top.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 * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_top.c,v 1.8 2003/11/08 20:51:53 tom Exp $") +MODULE_ID("$Id: m_item_top.c,v 1.11 2010/01/23 21:20:10 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -50,35 +50,37 @@ MODULE_ID("$Id: m_item_top.c,v 1.8 2003/11/08 20:51:53 tom Exp $") | E_NOT_CONNECTED - there are no items for the menu +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_top_row (MENU * menu, int row) +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 ) + 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))) + + if ((row < 0) || (row > (menu->rows - menu->arows))) RETURN(E_BAD_ARGUMENT); } else RETURN(E_BAD_ARGUMENT); - + if (row != menu->toprow) { - if (menu->status & _LINK_NEEDED) + if (menu->status & _LINK_NEEDED) _nc_Link_Items(menu); - - item = menu->items[ (menu->opt&O_ROWMAJOR) ? (row*menu->cols) : row ]; + + item = menu->items[(menu->opt & O_ROWMAJOR) ? (row * menu->cols) : row]; assert(menu->pattern); Reset_Pattern(menu); _nc_New_TopRow_and_CurrentItem(menu, row, item); } - - RETURN(E_OK); + + RETURN(E_OK); } /*--------------------------------------------------------------------------- @@ -90,15 +92,16 @@ set_top_row (MENU * menu, int row) | Return Values : The row number or ERR if there is no row +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -top_row (const MENU * menu) +top_row(const MENU * menu) { + T((T_CALLED("top_row(%p)"), (const void *)menu)); if (menu && menu->items && *(menu->items)) { - assert( (menu->toprow>=0) && (menu->toprow < menu->rows) ); - return menu->toprow; + assert((menu->toprow >= 0) && (menu->toprow < menu->rows)); + returnCode(menu->toprow); } else - return(ERR); + returnCode(ERR); } /* m_item_top.c ends here */