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

YAPET::UI::Button Class Reference

A button. More...

#include <button.h>

Collaboration diagram for YAPET::UI::Button:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Button (std::string l, int x, int y, bool ro=false)
int focus () throw (UIException)
 Shows the button and waits for input.
std::string getLabel ()
int getLength () const
 Returns the width occupied by the button.
bool getReadonly () const
void refresh () throw (UIException)
void setLabel (std::string l) throw (UIException)
void setReadonly (bool ro)
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
bool readonly
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

YAPET::UI::Button::Button ( const Button  )  [inline, private]

Definition at line 75 of file button.h.

Button::Button ( std::string  l,
int  x,
int  y,
bool  ro = false 
)

Definition at line 38 of file button.cc.

References createWindow().

Here is the call graph for this function:

Button::~Button (  )  [virtual]

Definition at line 46 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().

Here is the caller graph for this function:

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 87 of file button.cc.

References YAPET::UI::BUTTON_FOCUS, YAPET::UI::BUTTON_NOFOCUS, KEY_ESC, KEY_REFRESH, KEY_TAB, label, onClick(), readonly, YAPET::UI::BaseWindow::refreshAll(), YAPET::UI::Colors::setcolor(), and window.

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

Here is the call graph for this function:

Here is the caller graph for this function:

std::string YAPET::UI::Button::getLabel (  )  [inline]

Definition at line 95 of file button.h.

References label.

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

References BASE_SIZE, and label.

Referenced by SearchDialog::createWindow(), PWGenDialog::createWindow(), PasswordRecord::createWindow(), PasswordDialog::createWindow(), and YAPET::UI::MessageBox::getOkButtonLength().

Here is the caller graph for this function:

bool YAPET::UI::Button::getReadonly (  )  const [inline]

Definition at line 123 of file button.h.

References readonly.

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

Definition at line 87 of file button.h.

Referenced by focus().

Here is the caller graph for this function:

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

Definition at line 76 of file button.h.

void Button::refresh (  )  throw (UIException)

Definition at line 72 of file button.cc.

References YAPET::UI::BUTTON_NOFOCUS, label, YAPET::UI::Colors::setcolor(), and window.

Referenced by SearchDialog::refresh(), PWGenDialog::refresh(), PasswordRecord::refresh(), PasswordDialog::refresh(), FileOpen::refresh(), YAPET::UI::MessageBox::refresh(), and YAPET::UI::DialogBox::refresh().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 53 of file button.cc.

void YAPET::UI::Button::setReadonly ( bool  ro  )  [inline]

Definition at line 122 of file button.h.

References readonly.

Referenced by PasswordRecord::setReadonly().

Here is the caller graph for this function:


Member Data Documentation

std::string YAPET::UI::Button::label [private]

Definition at line 80 of file button.h.

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

Definition at line 84 of file button.h.

Referenced by focus(), getReadonly(), and setReadonly().

Definition at line 82 of file button.h.

Referenced by createWindow().

Definition at line 83 of file button.h.

Referenced by createWindow().

WINDOW* YAPET::UI::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: