Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

CSButton Class Reference

#include <CSButton.h>

Inheritance diagram for CSButton:

CSGrafikElement CSMessageDispatchable CSMessageListener CSDragButton CSMenu CSMenuItem

Public Member Functions

virtual std::string getType ()
 CSButton (CSIcon *icon)
 CSButton (const std::string &text)
virtual ~CSButton ()
void reactOnMessageButton (CSMessage *message)
virtual void reactOnMessage (CSMessage *message)
 to be overloaded

virtual void layoutSetup ()
virtual int getButtonState ()

Static Public Attributes

const char * CLASS = "CSButton"
 static element, name of this class (introsepection)


Protected Member Functions

void layoutSetupButton ()

Protected Attributes

CSIconmIcon
GuiMessage MESSAGE_BUTTON_PRESSED
GuiMessage MESSAGE_BUTTON_RELEASED

Constructor & Destructor Documentation

CSButton::CSButton CSIcon icon  ) 
 

Definition at line 12 of file CSButton.cpp.

References LOG_ENTER, LOG_EXIT, and mIcon.

00012                                : CSGrafikElement(0, 0)
00013 {
00014     static char *functionName="CSButton";
00015     LOG_ENTER 
00016     mIcon = icon;
00017     initButton();
00018     LOG_EXIT
00019 }

CSButton::CSButton const std::string &  text  ) 
 

Definition at line 21 of file CSButton.cpp.

References CSTextIcon::buildIcon(), LOG_ENTER, LOG_EXIT, and mIcon.

00021                                          : CSGrafikElement(0, 0)
00022 {
00023     static char *functionName="CSButton";
00024     LOG_ENTER 
00025     mIcon = CSTextIcon::buildIcon(text);
00026     initButton();
00027 
00028     LOG_EXIT
00029 }

Here is the call graph for this function:

CSButton::~CSButton  )  [virtual]
 

Definition at line 31 of file CSButton.cpp.

References mIcon.

00032 {
00033     if (mIcon)
00034     {
00035         delete(mIcon);
00036         mIcon = 0;
00037     }
00038 }


Member Function Documentation

void CSButton::layoutSetupButton  )  [protected]
 

Definition at line 135 of file CSButton.cpp.

References CSGrafikElement::getMinHeight(), CSGrafikElement::getMinWidth(), LOG_ENTER, LOG_EXIT, and mIcon.

Referenced by layoutSetup(), and CSMenu::layoutSetupMenu().

00136 {
00137     static char *functionName="layoutSetupButton";
00138     LOG_ENTER 
00139     if (mIcon)
00140     {
00141         mMinHeight = mIcon->getMinHeight();
00142         mMinWidth = mIcon->getMinWidth();
00143     }
00144     else
00145     {
00146         mMinHeight = 0;
00147         mMinWidth = 0;
00148     }
00149     LOG_EXIT
00150 }

Here is the call graph for this function:

virtual std::string CSButton::getType  )  [inline, virtual]
 

Reimplemented from CSGrafikElement.

Reimplemented in CSDragButton, CSMenu, and CSMenuItem.

Definition at line 35 of file CSButton.h.

References CLASS.

00035 {return (std::string) CLASS;}

void CSButton::reactOnMessageButton CSMessage message  ) 
 

Definition at line 78 of file CSButton.cpp.

References GuiMessage::actionId, BUTTON_ENABLED, BUTTON_PRESSED, getButtonState(), CSMessage::getSubtype(), CSMessage::getType(), GUI_MESSAGE, CSGrafikElement::isChild(), MESSAGE_BUTTON_PRESSED, MESSAGE_BUTTON_RELEASED, CSMessage::mIsHandled, MOUSE_BUTTON_PRESSED_MESSAGE, MOUSE_BUTTON_RELEASED_MESSAGE, CSGrafikElement::reactOnMessageGrafikElement(), GuiMessage::receiver, and CSMessageDispatchable::sendMessage().

Referenced by reactOnMessage(), CSDragButton::reactOnMessageDragButton(), and CSMenu::reactOnMessageMenu().

00079 {
00080     static char *functionName="reactOnMessage";
00081     if (message->mIsHandled)
00082     {
00083         reactOnMessageGrafikElement(message);
00084         return;
00085     }
00086     if (message->getType() == GUI_MESSAGE)
00087     {
00088         GuiMessage *gm = (GuiMessage *) message;
00089         
00090         if (isChild(gm->receiver))
00091         {
00092             switch (message->getSubtype())
00093             {
00094                 case MOUSE_BUTTON_RELEASED_MESSAGE:
00095                 {
00096                     mBorderState = getButtonState() & (~BUTTON_PRESSED);
00097                     MESSAGE_BUTTON_RELEASED.actionId = mActionId;
00098                     MESSAGE_BUTTON_RELEASED.receiver = 0;
00099                     MESSAGE_BUTTON_RELEASED.mIsHandled = false;
00100                     sendMessage(MESSAGE_BUTTON_RELEASED);
00101                     gm->mIsHandled = true;
00102                     break;
00103                 }
00104 
00105                 case MOUSE_BUTTON_PRESSED_MESSAGE:
00106                 {
00107                     if (getButtonState() & BUTTON_ENABLED)
00108                     {
00109                         mBorderState = getButtonState() | BUTTON_PRESSED;
00110                         MESSAGE_BUTTON_PRESSED.actionId = mActionId;
00111                         MESSAGE_BUTTON_PRESSED.receiver = 0;
00112                         MESSAGE_BUTTON_PRESSED.mIsHandled = false;
00113                         sendMessage(MESSAGE_BUTTON_PRESSED);
00114                     }
00115                     gm->mIsHandled = true;
00116                     break;
00117                 }
00118             }
00119         }
00120         else
00121         {
00122             // if somewhere else released
00123             // at least reset the state of the button
00124             // (but don't tell anyone about it)
00125             if (message->getSubtype() ==  MOUSE_BUTTON_RELEASED_MESSAGE)
00126             {
00127                 mBorderState = getButtonState() & (~BUTTON_PRESSED);
00128                 gm->mIsHandled = true;
00129             }
00130         }
00131     }
00132     reactOnMessageGrafikElement(message);
00133 }

Here is the call graph for this function:

void CSButton::reactOnMessage CSMessage message  )  [virtual]
 

to be overloaded

Reimplemented from CSGrafikElement.

Reimplemented in CSDragButton, CSMenu, and CSMenuItem.

Definition at line 73 of file CSButton.cpp.

References reactOnMessageButton().

00074 {
00075     reactOnMessageButton(message);
00076 }

Here is the call graph for this function:

virtual void CSButton::layoutSetup  )  [inline, virtual]
 

Reimplemented from CSGrafikElement.

Reimplemented in CSMenu, and CSMenuItem.

Definition at line 42 of file CSButton.h.

References layoutSetupButton().

00042 {layoutSetupButton();}

Here is the call graph for this function:

virtual int CSButton::getButtonState  )  [inline, virtual]
 

Reimplemented in CSMenu.

Definition at line 44 of file CSButton.h.

Referenced by reactOnMessageButton().

00044 {return mBorderState;}


Field Documentation

CSIcon* CSButton::mIcon [protected]
 

Definition at line 28 of file CSButton.h.

Referenced by CSButton(), layoutSetupButton(), and ~CSButton().

GuiMessage CSButton::MESSAGE_BUTTON_PRESSED [protected]
 

Definition at line 29 of file CSButton.h.

Referenced by reactOnMessageButton().

GuiMessage CSButton::MESSAGE_BUTTON_RELEASED [protected]
 

Definition at line 30 of file CSButton.h.

Referenced by reactOnMessageButton().

const char * CSButton::CLASS = "CSButton" [static]
 

static element, name of this class (introsepection)

Reimplemented from CSGrafikElement.

Reimplemented in CSDragButton, CSMenu, and CSMenuItem.

Definition at line 8 of file CSButton.cpp.

Referenced by CSLAF::getAreaInternal(), CSLAF::getBackgroundColorDisabledInternal(), CSLAF::getBackgroundColorEnabledInternal(), CSLAF::getBorderInternal(), CSLAF::getHorizontalElementSpacingInternal(), getType(), and CSLAF::getVerticalElementSpacingInternal().


Generated on Wed Jul 14 00:43:50 2004 for CSLib by doxygen 1.3.6