/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2009,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 *
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Juergen Pfeifer 1997-1999,2008 *
****************************************************************************/
/* p_bottom.c
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_bottom.c,v 1.5 1999/09/29 15:22:32 juergen Exp $")
+MODULE_ID("$Id: p_bottom.c,v 1.13 2010/01/23 21:22:16 tom Exp $")
-/*+-------------------------------------------------------------------------
- __panel_link_bottom(pan) - link panel into stack at bottom
---------------------------------------------------------------------------*/
-static void
-panel_link_bottom(PANEL *pan)
+NCURSES_EXPORT(int)
+bottom_panel(PANEL * pan)
{
-#ifdef TRACE
- dStack("<lb%d>",1,pan);
- if(_nc_panel_is_linked(pan))
- return;
-#endif
-
- pan->above = (PANEL *)0;
- pan->below = (PANEL *)0;
-
- assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel);
+ int err = OK;
- pan->below = _nc_bottom_panel;
- pan->above = _nc_bottom_panel->above;
- if (pan->above)
- pan->above->below = pan;
- _nc_bottom_panel->above = pan;
-
- dStack("<lb%d>",9,pan);
-}
+ T((T_CALLED("bottom_panel(%p)"), (void *)pan));
+ if (pan)
+ {
+ GetHook(pan);
+ if (!Is_Bottom(pan))
+ {
-int
-bottom_panel(PANEL *pan)
-{
- if(!pan)
- return(ERR);
- if(Is_Bottom(pan))
- return(OK);
- dBug(("--> bottom_panel %s", USER_PTR(pan->user)));
- if(_nc_panel_is_linked(pan))
- (void)hide_panel(pan);
- panel_link_bottom(pan);
- return(OK);
+ dBug(("--> bottom_panel %s", USER_PTR(pan->user)));
+
+ HIDE_PANEL(pan, err, OK);
+ assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel);
+
+ dStack("<lb%d>", 1, pan);
+
+ pan->below = _nc_bottom_panel;
+ pan->above = _nc_bottom_panel->above;
+ if (pan->above)
+ pan->above->below = pan;
+ _nc_bottom_panel->above = pan;
+
+ dStack("<lb%d>", 9, pan);
+ }
+ }
+ else
+ err = ERR;
+
+ returnCode(err);
}