appkit  1.5.1
RoadNarrows Robotics Application Kit
rnr::WinButton Class Reference

Window button base class. More...

#include <WinMenu.h>

Inheritance diagram for rnr::WinButton:
rnr::WinGtkButton

Public Member Functions

 WinButton (WinButtonType eType, int nEvent, WidgetState eInitState, AlignOp eAlign, const std::string &strAltText, const std::string &strTagNormal, const std::string &strToolTipNormal="", const std::string &strTagActive="", const std::string &strToolTipActive="")
 WinButton initialization constructor. More...
 
 WinButton (const WinButton &src)
 WinButton copy constructor. More...
 
virtual ~WinButton ()
 Destructor.
 
virtual void * getNormalImageWidget ()
 Get the normal icon image widget. More...
 
virtual void * getActiveImageWidget ()
 Get the active icon image widget. More...
 
void * getCurrentImageWidget ()
 Get the icon image widget associated with the current button state. More...
 
std::string getCurrentLabel ()
 Get the text label associated with the current button state. More...
 
std::string getCurrentToolTip ()
 Get the tooltip associated with the current button state. More...
 

Protected Member Functions

void copy (const WinButton *pSrc)
 Deep copy of source to this. More...
 

Protected Attributes

WinButtonType m_eType
 button type
 
int m_nEvent
 button push "mouse click" event
 
WidgetState m_eInitState
 initial button widget state
 
WidgetState m_eState
 current button widget state
 
AlignOp m_eAlign
 left or right alignment
 
std::string m_strAltText
 alternate text for icon(s)
 
std::string m_strTagNormal
 button icon for normal state
 
std::string m_strToolTipNormal
 button tooltip for normal state
 
std::string m_strTagActive
 button icon for active state
 
std::string m_strToolTipActive
 button tooltip for active state
 

Friends

class WinButtonMenu
 

Detailed Description

Window button base class.

Definition at line 94 of file WinMenu.h.

Constructor & Destructor Documentation

rnr::WinButton::WinButton ( WinButtonType  eType,
int  nEvent,
WidgetState  eInitState,
AlignOp  eAlign,
const std::string &  strAltText,
const std::string &  strTagNormal,
const std::string &  strToolTipNormal = "",
const std::string &  strTagActive = "",
const std::string &  strToolTipActive = "" 
)
inline

WinButton initialization constructor.

Parameters
eTypeButton type.
nEventEvent associated with button press (and id).
eInitStateButton widget initial state. See GUI Widget State.
eAlignButton alignment. See rnmpwin_align.
strAltTextButton alternative text string.
strTagNormalButton visual tag for normal state. Either icon path or text string label.
strToolTipNormalButton tooltip for normal state.
strTagActiveButton visual tag for active state. Either icon path or text string label. Empty for no tag.
strToolTipActiveButton tooltip for active state.

Definition at line 115 of file WinMenu.h.

123  :
124  m_eType(eType),
125  m_nEvent(nEvent),
126  m_eInitState(eInitState),
127  m_eState(eInitState),
128  m_eAlign(eAlign),
129  m_strAltText(strAltText),
130  m_strTagNormal(strTagNormal),
131  m_strToolTipNormal(strToolTipNormal),
132  m_strTagActive(strTagActive),
133  m_strToolTipActive(strToolTipActive)
134  {
135  }
WinButtonType m_eType
button type
Definition: WinMenu.h:201
WidgetState m_eInitState
initial button widget state
Definition: WinMenu.h:203
AlignOp m_eAlign
left or right alignment
Definition: WinMenu.h:205
std::string m_strAltText
alternate text for icon(s)
Definition: WinMenu.h:206
WidgetState m_eState
current button widget state
Definition: WinMenu.h:204
int m_nEvent
button push "mouse click" event
Definition: WinMenu.h:202
std::string m_strTagNormal
button icon for normal state
Definition: WinMenu.h:207
std::string m_strToolTipActive
button tooltip for active state
Definition: WinMenu.h:210
std::string m_strToolTipNormal
button tooltip for normal state
Definition: WinMenu.h:208
std::string m_strTagActive
button icon for active state
Definition: WinMenu.h:209
rnr::WinButton::WinButton ( const WinButton src)
inline

WinButton copy constructor.

Parameters
srcSource window button.

Definition at line 142 of file WinMenu.h.

References copy().

143  {
144  copy(&src);
145  }
void copy(const WinButton *pSrc)
Deep copy of source to this.
Definition: WinMenu.cxx:80

Member Function Documentation

void WinButton::copy ( const WinButton pSrc)
protected

Deep copy of source to this.

Parameters
pSrcPointer to source button.

Definition at line 80 of file WinMenu.cxx.

References m_eAlign, m_eInitState, m_eType, m_nEvent, m_strAltText, m_strTagActive, m_strTagNormal, m_strToolTipActive, and m_strToolTipNormal.

Referenced by WinButton().

81 {
82  m_eType = pSrc->m_eType;
83  m_nEvent = pSrc->m_nEvent;
84  m_eInitState = pSrc->m_eInitState;
85  m_eState = pSrc->m_eInitState;
86  m_eAlign = pSrc->m_eAlign;
87  m_strAltText = pSrc->m_strAltText;
92 }
WinButtonType m_eType
button type
Definition: WinMenu.h:201
WidgetState m_eInitState
initial button widget state
Definition: WinMenu.h:203
AlignOp m_eAlign
left or right alignment
Definition: WinMenu.h:205
std::string m_strAltText
alternate text for icon(s)
Definition: WinMenu.h:206
WidgetState m_eState
current button widget state
Definition: WinMenu.h:204
int m_nEvent
button push "mouse click" event
Definition: WinMenu.h:202
std::string m_strTagNormal
button icon for normal state
Definition: WinMenu.h:207
std::string m_strToolTipActive
button tooltip for active state
Definition: WinMenu.h:210
std::string m_strToolTipNormal
button tooltip for normal state
Definition: WinMenu.h:208
std::string m_strTagActive
button icon for active state
Definition: WinMenu.h:209
virtual void* rnr::WinButton::getActiveImageWidget ( )
inlinevirtual

Get the active icon image widget.

Returns
Returns (possibly NULL) pointer to image widget (gui toolkit specific).

Reimplemented in rnr::WinGtkButton.

Definition at line 169 of file WinMenu.h.

References getCurrentImageWidget(), getCurrentLabel(), and getCurrentToolTip().

Referenced by rnr::WinButtonMenu::changeButtonState().

170  {
171  return NULL;
172  }
void * WinButton::getCurrentImageWidget ( )

Get the icon image widget associated with the current button state.

Returns
Returns pointer to image widget (gui toolkit specific) if found.
Otherwise returns NULL.

Definition at line 94 of file WinMenu.cxx.

References rnr::WidgetStateActive, and rnr::WinButtonTypeImage.

Referenced by rnr::WinButtonMenu::bind(), and getActiveImageWidget().

95 {
97  {
98  return NULL;
99  }
100  else if( (m_eState == WidgetStateActive) && (getActiveImageWidget() != NULL) )
101  {
102  return getActiveImageWidget();
103  }
104  else
105  {
106  return getNormalImageWidget();
107  }
108 }
WinButtonType m_eType
button type
Definition: WinMenu.h:201
virtual void * getActiveImageWidget()
Get the active icon image widget.
Definition: WinMenu.h:169
virtual void * getNormalImageWidget()
Get the normal icon image widget.
Definition: WinMenu.h:158
WidgetState m_eState
current button widget state
Definition: WinMenu.h:204
button has image(s)
Definition: WinMenu.h:83
selected
Definition: Win.h:132
string WinButton::getCurrentLabel ( )

Get the text label associated with the current button state.

Returns
Returns (possibly empty) text string.

Definition at line 110 of file WinMenu.cxx.

References rnr::WidgetStateActive, and rnr::WinButtonTypeLabel.

Referenced by rnr::WinButtonMenu::bind(), and getActiveImageWidget().

111 {
112  if( m_eType != WinButtonTypeLabel )
113  {
114  return "";
115  }
116  else if( (m_eState == WidgetStateActive) && !m_strTagActive.empty() )
117  {
118  return m_strTagActive;
119  }
120  else
121  {
122  return m_strTagNormal;
123  }
124 }
WinButtonType m_eType
button type
Definition: WinMenu.h:201
WidgetState m_eState
current button widget state
Definition: WinMenu.h:204
button has text label(s)
Definition: WinMenu.h:84
std::string m_strTagNormal
button icon for normal state
Definition: WinMenu.h:207
selected
Definition: Win.h:132
std::string m_strTagActive
button icon for active state
Definition: WinMenu.h:209
string WinButton::getCurrentToolTip ( )

Get the tooltip associated with the current button state.

Returns
Returns (possibly empty) text string.

Definition at line 126 of file WinMenu.cxx.

References rnr::WidgetStateActive, rnr::WinButtonTypeImage, and rnr::WinButtonTypeLabel.

Referenced by rnr::WinButtonMenu::bind(), and getActiveImageWidget().

127 {
128  if( m_eState == WidgetStateActive )
129  {
130  switch( m_eType )
131  {
132  case WinButtonTypeImage:
133  if( getActiveImageWidget() != NULL )
134  {
135  return m_strToolTipActive;
136  }
137  break;
138  case WinButtonTypeLabel:
139  if( !m_strTagActive.empty() )
140  {
141  return m_strToolTipActive;
142  }
143  break;
144  default:
145  break;
146  }
147  }
148  return m_strToolTipNormal;
149 }
WinButtonType m_eType
button type
Definition: WinMenu.h:201
virtual void * getActiveImageWidget()
Get the active icon image widget.
Definition: WinMenu.h:169
WidgetState m_eState
current button widget state
Definition: WinMenu.h:204
button has text label(s)
Definition: WinMenu.h:84
button has image(s)
Definition: WinMenu.h:83
std::string m_strToolTipActive
button tooltip for active state
Definition: WinMenu.h:210
std::string m_strToolTipNormal
button tooltip for normal state
Definition: WinMenu.h:208
selected
Definition: Win.h:132
std::string m_strTagActive
button icon for active state
Definition: WinMenu.h:209
virtual void* rnr::WinButton::getNormalImageWidget ( )
inlinevirtual

Get the normal icon image widget.

Returns
Returns (possibly NULL) pointer to image widget (gui toolkit specific).

Reimplemented in rnr::WinGtkButton.

Definition at line 158 of file WinMenu.h.

Referenced by rnr::WinButtonMenu::changeButtonState().

159  {
160  return NULL;
161  }

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