// * This makes emacs happy -*-Mode: C++;-*-
/****************************************************************************
// * This makes emacs happy -*-Mode: C++;-*-
/****************************************************************************
- * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2012,2014 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 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
/****************************************************************************
* Author: Juergen Pfeifer, 1997 *
/****************************************************************************
* Author: Juergen Pfeifer, 1997 *
****************************************************************************/
#ifndef NCURSES_CURSESP_H_incl
#define NCURSES_CURSESP_H_incl 1
****************************************************************************/
#ifndef NCURSES_CURSESP_H_incl
#define NCURSES_CURSESP_H_incl 1
- void set_user(void *user) {
- UserHook* uptr = (UserHook*)::panel_userptr (p);
- assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==p);
- uptr->m_user = user;
+ void set_user(void *user)
+ {
+ UserHook* uptr = UserPointer();
+ if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p) {
+ uptr->m_user = user;
+ }
-
- void *get_user() {
- UserHook* uptr = (UserHook*)::panel_userptr (p);
- assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==p);
- return uptr->m_user;
- }
-
- void OnError (int err) const THROWS((NCursesPanelException)) {
+
+ void *get_user()
+ {
+ UserHook* uptr = UserPointer();
+ void *result = 0;
+ if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p)
+ result = uptr->m_user;
+ return result;
+ }
+
+ void OnError (int err) const THROW2(NCursesException const, NCursesPanelException)
+ {
- : NCursesWindow(lines,cols,begin_y,begin_x) {
- init();
- }
+ : NCursesWindow(nlines,ncols,begin_y,begin_x), p(0)
+ {
+ init();
+ }
OnError (::show_panel(p));
}
// Show the panel, i.e. make it visible.
OnError (::show_panel(p));
}
// Show the panel, i.e. make it visible.
OnError (::bottom_panel(p));
}
// Make this panel the bottom panel in the stack.
// N.B.: The panel associated with ::stdscr is always on the bottom. So
// actually bottom() makes the panel the first above ::stdscr.
OnError (::bottom_panel(p));
}
// Make this panel the bottom panel in the stack.
// N.B.: The panel associated with ::stdscr is always on the bottom. So
// actually bottom() makes the panel the first above ::stdscr.
return (::panel_hidden (p) ? TRUE : FALSE);
}
// Return TRUE if the panel is hidden, FALSE otherwise.
return (::panel_hidden (p) ? TRUE : FALSE);
}
// Return TRUE if the panel is hidden, FALSE otherwise.
need a reverse mapping from PANEL to NCursesPanel which needs some
redesign of the low level stuff. At the moment, we define them in the
interface but they will always produce an error. */
need a reverse mapping from PANEL to NCursesPanel which needs some
redesign of the low level stuff. At the moment, we define them in the
interface but they will always produce an error. */
const char* btitle=NULL);
// Put a frame around the panel and put the title centered in the top line
// and btitle in the bottom line.
const char* btitle=NULL);
// Put a frame around the panel and put the title centered in the top line
// and btitle in the bottom line.
* associated with some user data of type T.
*/
template<class T> class NCursesUserPanel : public NCursesPanel
{
public:
* associated with some user data of type T.
*/
template<class T> class NCursesUserPanel : public NCursesPanel
{
public:
- const T* p_UserData = (T*)0)
- : NCursesPanel (lines, cols, begin_y, begin_x) {
+ const T* p_UserData = STATIC_CAST(T*)(0))
+ : NCursesPanel (nlines, ncols, begin_y, begin_x)
+ {
};
// This creates an user panel of the requested size with associated
// user data pointed to by p_UserData.
};
// This creates an user panel of the requested size with associated
// user data pointed to by p_UserData.
};
// This creates an user panel associated with the ::stdscr and user data
// pointed to by p_UserData.
virtual ~NCursesUserPanel() {};
};
// This creates an user panel associated with the ::stdscr and user data
// pointed to by p_UserData.
virtual ~NCursesUserPanel() {};