ManaPlus
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
CheckBox Class Reference

#include <checkbox.h>

Inheritance diagram for CheckBox:
Widget ToolTipListener KeyListener WidgetListener Widget2 MouseListener

Public Member Functions

 CheckBox (const Widget2 *const widget, const std::string &caption, const bool selected, ActionListener *const listener, const std::string &eventId)
 
 ~CheckBox ()
 
void draw (Graphics *const graphics)
 
void safeDraw (Graphics *const graphics)
 
void updateAlpha ()
 
void drawBox (Graphics *const graphics)
 
void mouseEntered (MouseEvent &event)
 
void mouseExited (MouseEvent &event)
 
void keyPressed (KeyEvent &event)
 
void adjustSize ()
 
bool isSelected () const
 
void setSelected (const bool selected)
 
const std::string & getCaption () const
 
void setCaption (const std::string &caption)
 
void mouseClicked (MouseEvent &event)
 
void mouseDragged (MouseEvent &event)
 
void setParent (Widget *widget)
 
void widgetHidden (const Event &event)
 
void setWindow (Widget *const widget)
 
- Public Member Functions inherited from Widget
 Widget (const Widget2 *const widget)
 
 ~Widget ()
 
virtual void drawFrame (Graphics *graphics)
 
virtual void safeDrawFrame (Graphics *graphics)
 
void setFrameSize (const unsigned int frameSize)
 
unsigned int getFrameSize () const
 
virtual void logic ()
 
WidgetgetParent () const
 
void setWidth (const int width)
 
int getWidth () const
 
void setHeight (const int height)
 
int getHeight () const
 
void setSize (const int width, const int height)
 
void setX (const int x)
 
int getX () const
 
void setY (const int y)
 
int getY () const
 
void setPosition (const int x, const int y)
 
void setDimension (const Rect &dimension)
 
const RectgetDimension () const
 
void setFocusable (const bool focusable)
 
bool isFocusable () const
 
virtual bool isFocused () const
 
void setEnabled (const bool enabled)
 
bool isEnabled () const
 
void setVisible (Visible visible)
 
bool isVisible () const
 
void setBaseColor (const Color &color)
 
const ColorgetBaseColor () const
 
void setForegroundColor (const Color &color)
 
const ColorgetForegroundColor () const
 
void setBackgroundColor (const Color &color)
 
const ColorgetBackgroundColor () const
 
virtual void requestFocus ()
 
virtual void requestMoveToTop ()
 
virtual void requestMoveToBottom ()
 
virtual void setFocusHandler (FocusHandler *const focusHandler)
 
FocusHandlergetFocusHandler ()
 
void addActionListener (ActionListener *const actionListener)
 
void removeActionListener (ActionListener *const actionListener)
 
void addDeathListener (WidgetDeathListener *const deathListener)
 
void removeDeathListener (WidgetDeathListener *const deathListener)
 
void addMouseListener (MouseListener *const mouseListener)
 
void removeMouseListener (MouseListener *const mouseListener)
 
void addKeyListener (KeyListener *const keyListener)
 
void removeKeyListener (KeyListener *const keyListener)
 
void addFocusListener (FocusListener *const focusListener)
 
void removeFocusListener (FocusListener *const focusListener)
 
void addWidgetListener (WidgetListener *const widgetListener)
 
void removeWidgetListener (WidgetListener *const widgetListener)
 
void setActionEventId (const std::string &actionEventId)
 
const std::string & getActionEventId () const
 
virtual void getAbsolutePosition (int &x, int &y) const
 
FontgetFont () const
 
void setFont (Font *const font)
 
virtual void fontChanged ()
 
bool isTabInEnabled () const
 
void setTabInEnabled (const bool enabled)
 
bool isTabOutEnabled () const
 
void setTabOutEnabled (const bool enabled)
 
void requestModalFocus ()
 
virtual void requestModalMouseInputFocus ()
 
virtual void releaseModalFocus ()
 
virtual void releaseModalMouseInputFocus ()
 
virtual bool isModalFocused () const
 
virtual bool isModalMouseInputFocused () const
 
virtual WidgetgetWidgetAt (int x, int y)
 
const std::list< MouseListener * > & getMouseListeners () const A_CONST
 
const std::list< KeyListener * > & getKeyListeners () const A_CONST
 
const std::list< FocusListener * > & getFocusListeners () const A_CONST
 
virtual Rect getChildrenArea ()
 
virtual FocusHandlergetInternalFocusHandler ()
 
void setInternalFocusHandler (FocusHandler *const internalFocusHandler)
 
virtual void moveToTop (Widget *widget)
 
virtual void moveToBottom (Widget *widget)
 
virtual void focusNext ()
 
virtual void focusPrevious ()
 
virtual void showWidgetPart (Widget *const widget, const Rect &area)
 
void setId (const std::string &id)
 
const std::string & getId () const
 
virtual void showPart (const Rect &rectangle)
 
bool isAllowLogic () const
 
void setMouseConsume (const bool b)
 
bool isMouseConsume () const
 
void setRedraw (const bool b)
 
virtual bool isSelectable () const
 
void setSelectable (const bool selectable)
 
void windowResized ()
 
virtual void postInit ()
 
- Public Member Functions inherited from Widget2
virtual ~Widget2 ()
 
const ColorgetThemeColor (const ThemeColorIdT type, const unsigned int alpha) const A_INLINE
 
const ColorgetThemeCharColor (const signed char c, bool &valid) const A_INLINE
 
virtual void setWidget2 (const Widget2 *const widget)
 
void setPalette (int palette)
 
void checkPalette ()
 
void setForegroundColor2 (const Color &color)
 
WidgetgetWindow () const
 
- Public Member Functions inherited from ToolTipListener
 ToolTipListener ()
 
void setToolTip (const std::string &str)
 
std::string getToolTip () const
 
void mouseMoved (MouseEvent &event)
 
void mouseExited (MouseEvent &event)
 
- Public Member Functions inherited from MouseListener
virtual ~MouseListener ()
 
virtual void mousePressed (MouseEvent &event)
 
virtual void mouseReleased (MouseEvent &event)
 
virtual void mouseWheelMovedUp (MouseEvent &event)
 
virtual void mouseWheelMovedDown (MouseEvent &event)
 
- Public Member Functions inherited from KeyListener
virtual ~KeyListener ()
 
virtual void keyReleased (KeyEvent &event)
 
- Public Member Functions inherited from WidgetListener
virtual ~WidgetListener ()
 
virtual void widgetResized (const Event &event)
 
virtual void widgetMoved (const Event &event)
 
virtual void widgetShown (const Event &event)
 

Private Member Functions

void toggleSelected ()
 

Private Attributes

bool mSelected
 
std::string mCaption
 
TextChunk mTextChunk
 
int mPadding
 
int mImagePadding
 
int mImageSize
 
int mSpacing
 
int mTextX
 
bool mHasMouse
 
bool mDrawBox
 
bool mTextChanged
 

Static Private Attributes

static int instances = 0
 
static SkinmSkin = 0
 
static float mAlpha = 1.0
 

Additional Inherited Members

- Static Public Member Functions inherited from Widget
static void setGlobalFont (Font *const font)
 
static FontgetGloablFont ()
 
static void cleanGlobalFont ()
 
static bool widgetExists (const Widget *const widget)
 
static void distributeWindowResizeEvent ()
 
static WidgetcallPostInit (Widget *const widget)
 
- Data Fields inherited from Widget
Visible mVisible
 
- Protected Types inherited from Widget
typedef std::list< MouseListener * > MouseListenerList
 
typedef MouseListenerList::iterator MouseListenerIterator
 
typedef std::list< KeyListener * > KeyListenerList
 
typedef KeyListenerList::iterator KeyListenerIterator
 
typedef std::list< ActionListener * > ActionListenerList
 
typedef ActionListenerList::iterator ActionListenerIterator
 
typedef std::list< WidgetDeathListener * > WidgetDeathListenerList
 
typedef WidgetDeathListenerList::iterator WidgetDeathListenerIterator
 
typedef std::list< FocusListener * > FocusListenerList
 
typedef FocusListenerList::iterator FocusListenerIterator
 
typedef std::list< WidgetListener * > WidgetListenerList
 
typedef WidgetListenerList::iterator WidgetListenerIterator
 
- Protected Member Functions inherited from Widget
void distributeActionEvent ()
 
void distributeResizedEvent ()
 
void distributeMovedEvent ()
 
void distributeHiddenEvent ()
 
void distributeShownEvent ()
 
- Protected Member Functions inherited from Widget2
 Widget2 (const Widget2 *const widget)
 
- Protected Member Functions inherited from MouseListener
 MouseListener ()
 
- Protected Member Functions inherited from KeyListener
 KeyListener ()
 
- Protected Member Functions inherited from WidgetListener
 WidgetListener ()
 
- Protected Attributes inherited from Widget
MouseListenerList mMouseListeners
 
KeyListenerList mKeyListeners
 
ActionListenerList mActionListeners
 
WidgetDeathListenerList mDeathListeners
 
FocusListenerList mFocusListeners
 
WidgetListenerList mWidgetListeners
 
Color mForegroundColor
 
Color mBackgroundColor
 
Color mBaseColor
 
Rect mDimension
 
std::string mActionEventId
 
std::string mId
 
FocusHandlermFocusHandler
 
FocusHandlermInternalFocusHandler
 
WidgetmParent
 
FontmCurrentFont
 
unsigned int mFrameSize
 
bool mFocusable
 
bool mTabIn
 
bool mTabOut
 
bool mEnabled
 
bool mAllowLogic
 
bool mMouseConsume
 
bool mRedraw
 
bool mSelectable
 
- Protected Attributes inherited from Widget2
int mPaletteOffset
 
WidgetmWindow
 
Color mForegroundColor2
 
- Protected Attributes inherited from ToolTipListener
std::string mToolTip
 
- Static Protected Attributes inherited from Widget
static FontmGlobalFont = 0
 

Detailed Description

Check box widget. Same as the Guichan check box but with custom look.

Definition at line 88 of file checkbox.h.

Constructor & Destructor Documentation

◆ CheckBox()

CheckBox::CheckBox ( const Widget2 *const  widget,
const std::string &  caption,
const bool  selected,
ActionListener *const  listener,
const std::string &  eventId 
)

Constructor.

Definition at line 88 of file checkbox.cpp.

92  :
93  Widget(widget),
95  KeyListener(),
97  mSelected(selected),
98  mCaption(),
99  mTextChunk(),
100  mPadding(0),
101  mImagePadding(0),
102  mImageSize(9),
103  mSpacing(2),
104  mTextX(0 + 9 + 2),
105  mHasMouse(false),
106  mDrawBox(true),
107  mTextChanged(true)
108 {
109  setCaption(caption);
110  mAllowLogic = false;
111 
112  setFocusable(true);
113  addMouseListener(this);
114  addKeyListener(this);
115 
116  mForegroundColor2 = getThemeColor(ThemeColorId::CHECKBOX_OUTLINE, 255U);
117  if (instances == 0)
118  {
119  if (theme != nullptr)
120  {
121  mSkin = theme->load("checkbox.xml",
122  "",
123  true,
125  updateAlpha();
126  }
127  }
128 
129  instances++;
130 
131  if (!eventId.empty())
132  setActionEventId(eventId);
133 
134  if (listener != nullptr)
136 
137  mForegroundColor = getThemeColor(ThemeColorId::CHECKBOX, 255U);
138  if (mSkin != nullptr)
139  {
141  mImagePadding = mSkin->getOption("imagePadding");
142  mImageSize = mSkin->getOption("imageSize");
143  mSpacing = mSkin->getOption("spacing");
144  mDrawBox = (mSkin->getOption("drawBox", 1) != 0);
146  }
147  adjustSize();
148 }
int mImageSize
Definition: checkbox.h:205
bool mDrawBox
Definition: checkbox.h:209
int mImagePadding
Definition: checkbox.h:204
void adjustSize()
Definition: checkbox.cpp:284
int mSpacing
Definition: checkbox.h:206
static int instances
Definition: checkbox.h:212
std::string mCaption
Definition: checkbox.h:199
bool mSelected
Definition: checkbox.h:194
bool mHasMouse
Definition: checkbox.h:208
void setCaption(const std::string &caption)
Definition: checkbox.cpp:311
static Skin * mSkin
Definition: checkbox.h:213
bool mTextChanged
Definition: checkbox.h:210
TextChunk mTextChunk
Definition: checkbox.h:201
int mPadding
Definition: checkbox.h:203
void updateAlpha()
Definition: checkbox.cpp:197
int mTextX
Definition: checkbox.h:207
int getOption(const std::string &name) const
Definition: skin.h:106
int getPadding() const
Definition: skin.h:100
static std::string getThemePath()
Definition: theme.h:67
Skin * load(const std::string &filename, const std::string &filename2, const bool full, const std::string &defaultPath)
Definition: theme.cpp:179
Color mForegroundColor2
Definition: widget2.h:113
const Color & getThemeColor(const ThemeColorIdT type, const unsigned int alpha) const A_INLINE
Definition: widget2.h:45
Color mForegroundColor
Definition: widget.h:1086
void setFocusable(const bool focusable)
Definition: widget.cpp:192
Widget(const Widget2 *const widget)
Definition: widget.cpp:85
bool mAllowLogic
Definition: widget.h:1160
void addMouseListener(MouseListener *const mouseListener)
Definition: widget.cpp:292
void setActionEventId(const std::string &actionEventId)
Definition: widget.h:596
void addKeyListener(KeyListener *const keyListener)
Definition: widget.cpp:272
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:252
Theme * theme
Definition: theme.cpp:62

References Widget::addActionListener(), Widget::addKeyListener(), Widget::addMouseListener(), adjustSize(), Skin::getOption(), Skin::getPadding(), Widget2::getThemeColor(), Theme::getThemePath(), instances, anonymous_namespace{itemlinkhandler.cpp}::listener, Theme::load(), Widget::mAllowLogic, mDrawBox, Widget::mForegroundColor, Widget2::mForegroundColor2, mImagePadding, mImageSize, mPadding, mSkin, mSpacing, mTextX, Widget::setActionEventId(), setCaption(), Widget::setFocusable(), theme, and updateAlpha().

◆ ~CheckBox()

CheckBox::~CheckBox ( )

Destructor.

Definition at line 150 of file checkbox.cpp.

151 {
152  if (mWindow != nullptr)
154 
155  if (gui != nullptr)
156  gui->removeDragged(this);
157 
158  instances--;
159 
160  if (instances == 0)
161  {
162  if (theme != nullptr)
163  theme->unload(mSkin);
164  }
165 }
void removeDragged(const Widget *const widget)
Definition: gui.cpp:1162
void unload(Skin *const skin)
Definition: theme.cpp:250
Widget * mWindow
Definition: widget2.h:112
void removeWidgetListener(WidgetListener *const widgetListener)
Definition: widget.cpp:307
Gui * gui
Definition: gui.cpp:111

References gui, instances, mSkin, Widget2::mWindow, Gui::removeDragged(), Widget::removeWidgetListener(), theme, and Theme::unload().

Member Function Documentation

◆ adjustSize()

void CheckBox::adjustSize ( )

Definition at line 284 of file checkbox.cpp.

285 {
286  setHeight(getFont()->getHeight() + 2 * mPadding);
289 }
void setWidth(const int width)
Definition: widget.cpp:133
void setHeight(const int height)
Definition: widget.cpp:140
Font * getFont() const
Definition: widget.cpp:331
int getHeight() const
Definition: widget.h:240
int getWidth() const
Definition: widget.h:221

References Widget::getFont(), Widget::getHeight(), Widget::getWidth(), mCaption, mImagePadding, mImageSize, mPadding, mSpacing, Widget::setHeight(), and Widget::setWidth().

Referenced by CheckBox().

◆ draw()

void CheckBox::draw ( Graphics *const  graphics)
virtual

Draws the caption, then calls drawBox to draw the check box.

Implements Widget.

Definition at line 167 of file checkbox.cpp.

168 {
169  BLOCK_START("CheckBox::draw")
170  drawBox(graphics);
171 
172  Font *const font = getFont();
173 
174  if (mTextChanged)
175  {
176  mTextChunk.textFont = font;
181  font->generate(mTextChunk);
182  mTextChanged = false;
183  }
184 
185  const Image *const image = mTextChunk.img;
186  if (image != nullptr)
187  graphics->drawImage(image, mTextX, mPadding);
188 
189  BLOCK_END("CheckBox::draw")
190 }
void drawBox(Graphics *const graphics)
Definition: checkbox.cpp:218
Definition: font.h:90
void deleteImage()
Definition: textchunk.cpp:193
Font * textFont
Definition: textchunk.h:64
Image * img
Definition: textchunk.h:63
Color color
Definition: textchunk.h:66
Color color2
Definition: textchunk.h:67
std::string text
Definition: textchunk.h:65
if(!vert) return
#define BLOCK_END(name)
Definition: perfomance.h:80
#define BLOCK_START(name)
Definition: perfomance.h:79

References BLOCK_END, BLOCK_START, TextChunk::color, TextChunk::color2, TextChunk::deleteImage(), drawBox(), Graphics::drawImage(), Font::generate(), Widget::getFont(), TextChunk::img, mCaption, Widget::mForegroundColor, Widget2::mForegroundColor2, mPadding, mTextChanged, mTextChunk, mTextX, TextChunk::text, and TextChunk::textFont.

Referenced by safeDraw().

◆ drawBox()

void CheckBox::drawBox ( Graphics *const  graphics)

Draws the check box, not the caption.

Definition at line 218 of file checkbox.cpp.

219 {
220  if ((mSkin == nullptr) || !mDrawBox)
221  return;
222 
223  const ImageRect &rect = mSkin->getBorder();
224  int index = 0;
225 
226  if (mEnabled && mVisible == Visible_true)
227  {
228  if (mSelected)
229  {
230  if (mHasMouse)
231  index = 5;
232  else
233  index = 1;
234  }
235  else
236  {
237  if (mHasMouse)
238  index = 4;
239  else
240  index = 0;
241  }
242  }
243  else
244  {
245  if (mSelected)
246  index = 3;
247  else
248  index = 2;
249  }
250  const Image *const box = rect.grid[index];
251 
252  updateAlpha();
253 
254  if (box != nullptr)
255  {
256  graphics->drawImage(box,
258  (getHeight() - mImageSize) / 2);
259  }
260 }
virtual void drawImage(const Image *const image, int dstX, int dstY)=0
Image * grid[9]
Definition: imagerect.h:42
const ImageRect & getBorder() const
Definition: skin.h:68
bool mEnabled
Definition: widget.h:1158
Visible mVisible
Definition: widget.h:963
const bool Visible_true
Definition: visible.h:30

References Graphics::drawImage(), Skin::getBorder(), Widget::getHeight(), ImageRect::grid, mDrawBox, Widget::mEnabled, mHasMouse, mImagePadding, mImageSize, mSelected, mSkin, Widget::mVisible, updateAlpha(), and Visible_true.

Referenced by draw().

◆ getCaption()

const std::string& CheckBox::getCaption ( ) const
inline

Gets the caption of the check box.

Returns
The caption of the check box.
See also
setCaption

Definition at line 165 of file checkbox.h.

166  { return mCaption; }

References mCaption.

◆ isSelected()

bool CheckBox::isSelected ( ) const
inline

◆ keyPressed()

void CheckBox::keyPressed ( KeyEvent event)
virtual

Called if a key is pressed when the widget has keyboard focus. If a key is held down the widget will generate multiple key presses.

Parameters
eventDiscribes the event.

Reimplemented from KeyListener.

Definition at line 273 of file checkbox.cpp.

274 {
275  const InputActionT action = event.getActionId();
276 
277  if (action == InputAction::GUI_SELECT)
278  {
279  toggleSelected();
280  event.consume();
281  }
282 }
void toggleSelected()
Definition: checkbox.cpp:305
InputAction ::T InputActionT
Definition: inputaction.h:717

References InputAction::GUI_SELECT, and toggleSelected().

◆ mouseClicked()

void CheckBox::mouseClicked ( MouseEvent event)
virtual

Called when a mouse button is pressed and released (clicked) on the widget area.

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 291 of file checkbox.cpp.

292 {
293  if (event.getButton() == MouseButton::LEFT)
294  {
295  toggleSelected();
296  event.consume();
297  }
298 }
MouseButtonT getButton() const
Definition: mouseevent.h:116

References MouseEvent::getButton(), MouseButton::LEFT, and toggleSelected().

◆ mouseDragged()

void CheckBox::mouseDragged ( MouseEvent event)
virtual

Called when the mouse has moved and the mouse has previously been pressed on the widget.

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 300 of file checkbox.cpp.

301 {
302  event.consume();
303 }

◆ mouseEntered()

void CheckBox::mouseEntered ( MouseEvent event)
virtual

Called when the mouse enteres the widget area.

Reimplemented from MouseListener.

Definition at line 262 of file checkbox.cpp.

263 {
264  mHasMouse = true;
265 }

References mHasMouse.

◆ mouseExited()

void CheckBox::mouseExited ( MouseEvent event)
virtual

Called when the mouse leaves the widget area.

Reimplemented from MouseListener.

Definition at line 267 of file checkbox.cpp.

268 {
269  mHasMouse = false;
271 }
void mouseExited(MouseEvent &event)

References mHasMouse, and ToolTipListener::mouseExited().

◆ safeDraw()

void CheckBox::safeDraw ( Graphics *const  graphics)
virtual

Implements Widget.

Definition at line 192 of file checkbox.cpp.

193 {
194  CheckBox::draw(graphics);
195 }
void draw(Graphics *const graphics)
Definition: checkbox.cpp:167

References draw().

◆ setCaption()

void CheckBox::setCaption ( const std::string &  caption)

Sets the caption of the check box. It's advisable to call adjustSize after setting of the caption to adjust the check box's size to fit the caption.

Parameters
captionThe caption of the check box.
See also
getCaption, adjustSize

Definition at line 311 of file checkbox.cpp.

312 {
313  if (caption != mCaption)
314  mTextChanged = true;
315  mCaption = caption;
316 }

References mCaption, and mTextChanged.

Referenced by CheckBox().

◆ setParent()

void CheckBox::setParent ( Widget parent)
virtual

Sets the parent of the widget. A parent must be a BasicContainer.

WARNING: This function is used internally and should not be called or overloaded unless you know what you are doing.

Parameters
parentThe parent of the widget.
See also
getParent

Reimplemented from Widget.

Definition at line 318 of file checkbox.cpp.

319 {
320  if (mWindow != nullptr)
321  mWindow->addWidgetListener(this);
322  Widget::setParent(widget);
323 }
void addWidgetListener(WidgetListener *const widgetListener)
Definition: widget.cpp:302
virtual void setParent(Widget *parent)
Definition: widget.h:626

References Widget::addWidgetListener(), Widget2::mWindow, and Widget::setParent().

◆ setSelected()

void CheckBox::setSelected ( const bool  selected)
inline

◆ setWindow()

void CheckBox::setWindow ( Widget *const  widget)
virtual

Reimplemented from Widget2.

Definition at line 331 of file checkbox.cpp.

332 {
333  if ((widget == nullptr) && (mWindow != nullptr))
334  {
336  mWindow = nullptr;
337  }
338  else
339  {
340  Widget2::setWindow(widget);
341  }
342 }
virtual void setWindow(Widget *const window)
Definition: widget2.h:97

References Widget2::mWindow, Widget::removeWidgetListener(), and Widget2::setWindow().

◆ toggleSelected()

void CheckBox::toggleSelected ( )
private

Definition at line 305 of file checkbox.cpp.

306 {
307  mSelected = !mSelected;
309 }
void distributeActionEvent()
Definition: widget.cpp:493

References Widget::distributeActionEvent(), and mSelected.

Referenced by keyPressed(), and mouseClicked().

◆ updateAlpha()

void CheckBox::updateAlpha ( )

Update the alpha value to the checkbox components.

Definition at line 197 of file checkbox.cpp.

198 {
199  const float alpha = std::max(settings.guiAlpha,
201 
202  if (mAlpha != alpha)
203  {
204  mAlpha = alpha;
205  if (mSkin != nullptr)
206  {
207  const ImageRect &rect = mSkin->getBorder();
208  for (int a = 0; a < 6; a ++)
209  {
210  Image *const image = rect.grid[a];
211  if (image != nullptr)
212  image->setAlpha(mAlpha);
213  }
214  }
215  }
216 }
static float mAlpha
Definition: checkbox.h:214
float guiAlpha
Definition: settings.h:131
float getMinimumOpacity() const
Definition: theme.h:124
Settings settings
Definition: settings.cpp:32

References Skin::getBorder(), Theme::getMinimumOpacity(), ImageRect::grid, Settings::guiAlpha, mAlpha, mSkin, settings, and theme.

Referenced by CheckBox(), and drawBox().

◆ widgetHidden()

void CheckBox::widgetHidden ( const Event event)
virtual

Invoked when a widget is hidden, i.e it's set to be not visible.

Parameters
eventDescribes the event.

Reimplemented from WidgetListener.

Definition at line 325 of file checkbox.cpp.

326 {
327  mTextChanged = true;
329 }

References TextChunk::deleteImage(), mTextChanged, and mTextChunk.

Field Documentation

◆ instances

int CheckBox::instances = 0
staticprivate

Definition at line 212 of file checkbox.h.

Referenced by CheckBox(), and ~CheckBox().

◆ mAlpha

float CheckBox::mAlpha = 1.0
staticprivate

Definition at line 214 of file checkbox.h.

Referenced by updateAlpha().

◆ mCaption

std::string CheckBox::mCaption
private

Holds the caption of the check box.

Definition at line 199 of file checkbox.h.

Referenced by adjustSize(), draw(), getCaption(), and setCaption().

◆ mDrawBox

bool CheckBox::mDrawBox
private

Definition at line 209 of file checkbox.h.

Referenced by CheckBox(), and drawBox().

◆ mHasMouse

bool CheckBox::mHasMouse
private

Definition at line 208 of file checkbox.h.

Referenced by drawBox(), mouseEntered(), and mouseExited().

◆ mImagePadding

int CheckBox::mImagePadding
private

Definition at line 204 of file checkbox.h.

Referenced by adjustSize(), CheckBox(), and drawBox().

◆ mImageSize

int CheckBox::mImageSize
private

Definition at line 205 of file checkbox.h.

Referenced by adjustSize(), CheckBox(), and drawBox().

◆ mPadding

int CheckBox::mPadding
private

Definition at line 203 of file checkbox.h.

Referenced by adjustSize(), CheckBox(), and draw().

◆ mSelected

bool CheckBox::mSelected
private

True if the check box is selected, false otherwise.

Definition at line 194 of file checkbox.h.

Referenced by drawBox(), isSelected(), setSelected(), and toggleSelected().

◆ mSkin

Skin * CheckBox::mSkin = 0
staticprivate

Definition at line 213 of file checkbox.h.

Referenced by CheckBox(), drawBox(), updateAlpha(), and ~CheckBox().

◆ mSpacing

int CheckBox::mSpacing
private

Definition at line 206 of file checkbox.h.

Referenced by adjustSize(), and CheckBox().

◆ mTextChanged

bool CheckBox::mTextChanged
private

Definition at line 210 of file checkbox.h.

Referenced by draw(), setCaption(), and widgetHidden().

◆ mTextChunk

TextChunk CheckBox::mTextChunk
private

Definition at line 201 of file checkbox.h.

Referenced by draw(), and widgetHidden().

◆ mTextX

int CheckBox::mTextX
private

Definition at line 207 of file checkbox.h.

Referenced by CheckBox(), and draw().


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