YAPETUI::Button Class Reference

A button. More...

#include <button.h>

List of all members.

Public Member Functions

 Button (std::string l, int x, int y)
int focus () throw (UIException)
 Shows the button and waits for input.
std::string getLabel ()
int getLength () const
 Returns the width occupied by the button.
void refresh () throw (UIException)
void setLabel (std::string l) throw (UIException)
virtual ~Button ()

Protected Member Functions

void createWindow () throw (UIException)
virtual void onClick ()

Private Types

enum  { BASE_SIZE = 4 }

Private Member Functions

 Button (const Button &)
const Buttonoperator= (const Button &)

Private Attributes

std::string label
int start_x
int start_y
WINDOW * window


Detailed Description

Displays a button.

When the user presses the button, focus() returns \n.

Definition at line 62 of file button.h.


Member Enumeration Documentation

anonymous enum [private]

Enumerator:
BASE_SIZE  The base size of a button.

A button with no label would look like this [ ].

Definition at line 64 of file button.h.


Constructor & Destructor Documentation

YAPETUI::Button::Button ( const Button  )  [inline, private]

Definition at line 75 of file button.h.

Button::Button ( std::string  l,
int  x,
int  y 
)

Definition at line 37 of file button.cc.

References createWindow().

Button::~Button (  )  [virtual]

Definition at line 44 of file button.cc.

References window.


Member Function Documentation

void Button::createWindow (  )  throw (UIException) [protected]

Definition at line 29 of file button.cc.

References BASE_SIZE, label, start_x, start_y, and window.

Referenced by Button().

int Button::focus (  )  throw (UIException)

Shows the button and waits for input. When button is pressed, it returns \n.

Returns:
on press \n.

Definition at line 81 of file button.cc.

References YAPETUI::BUTTON_FOCUS, YAPETUI::BUTTON_NOFOCUS, KEY_REFRESH, label, onClick(), YAPETUI::BaseWindow::refreshAll(), YAPETUI::Colors::setcolor(), and window.

Referenced by SearchDialog::run(), PasswordRecord::run(), PasswordDialog::run(), FileOpen::run(), YAPETUI::MessageBox::run(), and YAPETUI::DialogBox::run().

std::string YAPETUI::Button::getLabel (  )  [inline]

Definition at line 92 of file button.h.

References label.

int YAPETUI::Button::getLength (  )  const [inline]

Returns the width occupied on the screen by the button. It is calculated by adding BASE_SIZE and label.length().

Returns:
the width occupied on the screen by the button.

Definition at line 113 of file button.h.

References BASE_SIZE, and label.

Referenced by SearchDialog::createWindow(), PasswordRecord::createWindow(), PasswordDialog::createWindow(), and YAPETUI::MessageBox::getOkButtonLength().

virtual void YAPETUI::Button::onClick (  )  [inline, protected, virtual]

Definition at line 84 of file button.h.

Referenced by focus().

const Button& YAPETUI::Button::operator= ( const Button  )  [inline, private]

Definition at line 76 of file button.h.

void Button::refresh (  )  throw (UIException)

void Button::setLabel ( std::string  l  )  throw (UIException)

Definition at line 51 of file button.cc.


Member Data Documentation

std::string YAPETUI::Button::label [private]

Definition at line 78 of file button.h.

Referenced by createWindow(), focus(), getLabel(), getLength(), and refresh().

int YAPETUI::Button::start_x [private]

Definition at line 80 of file button.h.

Referenced by createWindow().

int YAPETUI::Button::start_y [private]

Definition at line 81 of file button.h.

Referenced by createWindow().

WINDOW* YAPETUI::Button::window [private]

Definition at line 73 of file button.h.

Referenced by createWindow(), focus(), refresh(), and ~Button().


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

Generated on Thu Jun 11 19:13:07 2009 for YAPET by  doxygen 1.5.8