Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Static Private Attributes

YAPET::UI::BaseWindow Class Reference

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

#include <basewindow.h>

Inheritance diagram for YAPET::UI::BaseWindow:
Inheritance graph
[legend]
Collaboration diagram for YAPET::UI::BaseWindow:
Collaboration graph
[legend]

List of all members.

Classes

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

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 ()
static void initCurses () throw (UIException)
 Initializes (n)curses.
static void refreshAll ()
static void resizeAll ()
static void setTimeout (AlarmFunction *af, int sec)
 Sets a timeout.
static void suspendTimeout ()

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*>()

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 66 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 194 of file basewindow.h.


Constructor & Destructor Documentation

BaseWindow::BaseWindow (  ) 

Definition at line 223 of file basewindow.cc.

References registerBaseWindow().

Here is the call graph for this function:

BaseWindow::~BaseWindow (  )  [virtual]

Definition at line 227 of file basewindow.cc.

References unregisterBaseWindow().

Here is the call graph for this function:


Member Function Documentation

void BaseWindow::deleteAll (  )  [static]

Deletes all registered windows by calling delete.

Definition at line 180 of file basewindow.cc.

References basewindow_list.

Referenced by sig_handler().

Here is the caller graph for this function:

void BaseWindow::endCurses (  )  [static]

Ends the curses mode.

Definition at line 159 of file basewindow.cc.

References clear(), and refresh().

Referenced by main(), and sig_handler().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

Definition at line 110 of file basewindow.cc.

Referenced by initCurses().

Here is the caller graph for this function:

void BaseWindow::initCurses (  )  throw (UIException) [static]

Initializes curses and sets up the signal handlers.

Definition at line 137 of file basewindow.cc.

References init_signal(), YAPET::UI::Colors::initColors(), MIN_X, MIN_Y, and refresh().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int YAPET::UI::BaseWindow::maxX (  )  const [inline, protected]
int YAPET::UI::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 156 of file basewindow.h.

Referenced by StatusBar::createWindow(), MainWindow::createWindow(), SearchDialog::getStartY(), PasswordRecord::getStartY(), PasswordDialog::getStartY(), YAPET::UI::MessageBox::getStartY(), MainWindow::resize(), PWGenDialog::startY(), and FileOpen::windowHeight().

Here is the caller graph for this function:

int YAPET::UI::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 169 of file basewindow.h.

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

Here is the caller graph for this function:

int YAPET::UI::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 182 of file basewindow.h.

Referenced by FileOpen::startY().

Here is the caller graph for this function:

virtual void YAPET::UI::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 166 of file basewindow.cc.

References basewindow_list.

Referenced by BaseWindow().

Here is the caller graph for this function:

virtual void YAPET::UI::BaseWindow::resize (  )  [pure virtual]

Implemented in YAPET::UI::DialogBox, YAPET::UI::MessageBox, FileOpen, MainWindow, PasswordDialog, PasswordRecord, PWGenDialog, SearchDialog, and StatusBar.

Referenced by ResizeIt::operator()().

Here is the caller graph for this function:

void BaseWindow::resizeAll (  )  [static]

Calls the resize() method of all registered windows.

Definition at line 187 of file basewindow.cc.

References basewindow_list, MIN_X, MIN_Y, and refreshAll().

Referenced by MainWindow::lockScreen(), SearchDialog::run(), PWGenDialog::run(), PasswordRecord::run(), PasswordDialog::run(), MainWindow::run(), FileOpen::run(), and YAPET::UI::DialogBox::run().

Here is the call graph for this function:

Here is the caller graph for this function:

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 209 of file basewindow.cc.

References alarm_fun.

Referenced by MainWindow::run().

Here is the caller graph for this function:

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 90 of file basewindow.cc.

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

Here is the call graph for this function:

void BaseWindow::suspendTimeout (  )  [static]

Suspends a currently set timeout.

Definition at line 215 of file basewindow.cc.

Referenced by MainWindow::run().

Here is the caller graph for this function:

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 171 of file basewindow.cc.

References basewindow_list.

Referenced by ~BaseWindow().

Here is the caller graph for this function:


Member Data Documentation

Definition at line 91 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: