YAPETUI::BaseWindow Class Reference

Base window class for windows wanting to receive resize events. More...

#include <basewindow.h>

Inheritance diagram for YAPETUI::BaseWindow:

FileOpen MainWindow PasswordDialog PasswordRecord SearchDialog StatusBar YAPETUI::MessageBox YAPETUI::DialogBox

List of all members.

Public Types

enum  MinDimension { MIN_Y = 24, MIN_X = 80 }
 The minimum dimensions supported. More...

Public Member Functions

 BaseWindow ()
virtual void refresh ()=0
virtual void resize ()=0
virtual ~BaseWindow ()

Static Public Member Functions

static void deleteAll ()
 Delete all registered windows.
static void endCurses ()
 Ends the curses mode.
static void initCurses ()
 Initializes (n)curses.
static void refreshAll ()
 Calls the refresh() method of all registered windows.
static void resizeAll ()
 Calls the resize() method of all registered windows.
static void setTimeout (AlarmFunction *af, int sec)
 Sets a timeout.
static void suspendTimeout ()
 Suspends a currently set timeout.

Protected Member Functions

int maxX () const
 The maximum x value of the screen.
int maxY () const
 The maximum y value of the screen.
int minX () const
 The minimum x value of the screen.
int minY () const
 The minimum y value of the screen.

Static Protected Member Functions

static void init_signal ()
 Initializes the signal handlers.
static void registerBaseWindow (BaseWindow *r)
 Register a base window.
static void sig_handler (int signo)
 The signal handler.
static void unregisterBaseWindow (BaseWindow *r)
 un-registers a base window.

Static Private Attributes

static AlarmFunctionalarm_fun = NULL
static std::list< BaseWindow * > basewindow_list = std::list<BaseWindow*>()

Classes

class  AlarmFunction
 Base class for calling a function upon the alarm signal. More...


Detailed Description

Classes responding to window resize events should be derived from this class.

The constructor of this class registers the window to receive the resize event. The destructor un-registers the class from the list of base windows.

There are also static members for dealing with signals and initializing (n)curses.

Definition at line 62 of file basewindow.h.


Member Enumeration Documentation

Resize events below either of the dimensions will not be processed.

Enumerator:
MIN_Y 
MIN_X 

Definition at line 190 of file basewindow.h.


Constructor & Destructor Documentation

BaseWindow::BaseWindow (  ) 

Definition at line 203 of file basewindow.cc.

References registerBaseWindow().

BaseWindow::~BaseWindow (  )  [virtual]

Definition at line 207 of file basewindow.cc.

References unregisterBaseWindow().


Member Function Documentation

void BaseWindow::deleteAll (  )  [static]

Deletes all registered windows by calling delete.

Definition at line 162 of file basewindow.cc.

References basewindow_list.

Referenced by sig_handler().

void BaseWindow::endCurses (  )  [static]

Ends the curses mode.

Definition at line 140 of file basewindow.cc.

References clear(), and refresh().

Referenced by main(), and sig_handler().

void BaseWindow::init_signal (  )  [static, protected]

Initializes the signal handlers. This method will be called by initCurses().

Definition at line 98 of file basewindow.cc.

References sig_handler().

Referenced by initCurses().

void BaseWindow::initCurses (  )  [static]

Initializes curses and sets up the signal handlers.

Definition at line 127 of file basewindow.cc.

References init_signal(), YAPETUI::Colors::initColors(), and refresh().

Referenced by main().

int YAPETUI::BaseWindow::maxX (  )  const [inline, protected]

int YAPETUI::BaseWindow::maxY (  )  const [inline, protected]

Returns the maximum y value of the screen.

Returns:
the maximum y value available to the curses functions.

Definition at line 152 of file basewindow.h.

Referenced by StatusBar::createWindow(), MainWindow::createWindow(), SearchDialog::getStartY(), PasswordRecord::getStartY(), PasswordDialog::getStartY(), YAPETUI::MessageBox::getStartY(), MainWindow::resize(), and FileOpen::windowHeight().

int YAPETUI::BaseWindow::minX (  )  const [inline, protected]

Returns the minimum x value of the screen.

Returns:
the minimum x value available to the curses functions.

Definition at line 165 of file basewindow.h.

Referenced by StatusBar::createWindow(), and FileOpen::startX().

int YAPETUI::BaseWindow::minY (  )  const [inline, protected]

Returns the minimum y value of the screen.

Returns:
the minimum y value available to the curses functions.

Definition at line 178 of file basewindow.h.

Referenced by FileOpen::startY().

virtual void YAPETUI::BaseWindow::refresh (  )  [pure virtual]

void BaseWindow::refreshAll (  )  [static]

void BaseWindow::registerBaseWindow ( BaseWindow r  )  [static, protected]

This method will be called by the constructor of BaseWindow.

Parameters:
r the pointer to the BaseWindow. Usually this.

Definition at line 147 of file basewindow.cc.

References basewindow_list.

Referenced by BaseWindow().

virtual void YAPETUI::BaseWindow::resize (  )  [pure virtual]

void BaseWindow::resizeAll (  )  [static]

void BaseWindow::setTimeout ( AlarmFunction af,
int  sec 
) [static]

Sets a timeout using the system function alarm. Upon the SIGALRM signal, the process() method of the AlarmFunction class is called.

Parameters:
af pointer to the AlarmFunction class.
sec the number of seconds before SIGALRM is raised.

Definition at line 189 of file basewindow.cc.

References alarm_fun.

Referenced by MainWindow::run().

void BaseWindow::sig_handler ( int  signo  )  [static, protected]

This is the signal handler for the signals processed.

Upon SIGALRM (set by setTimeout()) it will call the process method of the AlarmFunction class pointed to be alarm_fun.

Parameters:
signo the number of the signal.

Definition at line 80 of file basewindow.cc.

References alarm_fun, deleteAll(), endCurses(), and YAPETUI::BaseWindow::AlarmFunction::process().

Referenced by init_signal().

void BaseWindow::suspendTimeout (  )  [static]

Suspends a currently set timeout.

Definition at line 195 of file basewindow.cc.

Referenced by MainWindow::run().

void BaseWindow::unregisterBaseWindow ( BaseWindow r  )  [static, protected]

This method will be called by the destructor of BaseWindow.

Parameters:
r the pointer to the BaseWindow to be removed from the list. Usually this.

Definition at line 152 of file basewindow.cc.

References basewindow_list.

Referenced by ~BaseWindow().


Member Data Documentation

Definition at line 87 of file basewindow.h.

Referenced by setTimeout(), and sig_handler().

std::list< BaseWindow * > BaseWindow::basewindow_list = std::list<BaseWindow*>() [static, private]


The documentation for this class was generated from the following files:

Generated on Sun Jul 20 13:01:44 2008 for YAPET by  doxygen 1.5.6