FifeGUI 0.2.0
A C++ GUI library designed for games.
fcn::CheckBox Class Reference

#include <checkbox.hpp>

Inheritance diagram for fcn::CheckBox:
fcn::ImageButton fcn::Button fcn::Widget fcn::MouseListener fcn::KeyListener fcn::FocusListener fcn::WidgetListener fcn::RadioButton

Public Types

enum class  MarkerStyle : uint8_t {
  Checkmark = 0 , Cross , Dot , Rhombus ,
  Image
}
Public Types inherited from fcn::ImageButton
enum class  ImageType : uint8_t {
  Up = 0 , Down = 1 , Hover = 2 , Up_Inactive = 3 ,
  Down_Inactive = 4 , Hover_Inactive = 5
}
Public Types inherited from fcn::Widget
enum class  SelectionMode : uint8_t { None = 0 , Border = 1 , Background = 2 }

Public Member Functions

void adjustSize () override
 CheckBox (CheckBox &&)=delete
 CheckBox (CheckBox const &)=delete
 CheckBox (std::string const &caption, bool selected=false)
void draw (Graphics *graphics) override
Image const * getBackgroundImage () const
MarkerStyle getMarkerStyle () const
virtual bool isSelected () const
void keyPressed (KeyEvent &keyEvent) override
void keyReleased (KeyEvent &keyEvent) override
void mouseClicked (MouseEvent &mouseEvent) override
void mousePressed (MouseEvent &mouseEvent) override
void mouseReleased (MouseEvent &mouseEvent) override
CheckBox & operator= (CheckBox &&)=delete
CheckBox & operator= (CheckBox const &)=delete
void setBackgroundImage (Image const *image)
void setBackgroundImage (std::string const &filename)
void setMarkerStyle (MarkerStyle mode)
virtual void setSelected (bool selected)
virtual void toggleSelected ()
Public Member Functions inherited from fcn::ImageButton
void adjustSize () override
void draw (fcn::Graphics *graphics) override
Image const * getDownImage () const
Image const * getHoverImage () const
Image const * getInactiveDownImage () const
Image const * getInactiveHoverImage () const
Image const * getInactiveUpImage () const
Image const * getUpImage () const
 ImageButton (Image const *image)
 ImageButton (ImageButton &&)=delete
 ImageButton (ImageButton const &)=delete
 ImageButton (std::string const &filename)
ImageButton & operator= (ImageButton &&)=delete
ImageButton & operator= (ImageButton const &)=delete
void resizeToContent (bool recursion) override
void setDownImage (Image const *image)
void setDownImage (std::string const &filename)
void setHoverImage (Image const *image)
void setHoverImage (std::string const &filename)
void setInactiveDownImage (Image const *image)
void setInactiveDownImage (std::string const &filename)
void setInactiveHoverImage (Image const *image)
void setInactiveHoverImage (std::string const &filename)
void setInactiveUpImage (Image const *image)
void setInactiveUpImage (std::string const &filename)
void setUpImage (Image const *image)
void setUpImage (std::string const &filename)
Public Member Functions inherited from fcn::Button
void ancestorHidden (Event const &e) override
 Button (Button &&)=delete
 Button (Button const &)=delete
 Button (std::string caption)
void focusLost (Event const &event) override
void fontChanged () override
Graphics::Alignment getAlignment () const
std::string const & getCaption () const
int getDownXOffset () const
int getDownYOffset () const
bool isActive () const
void mouseDragged (MouseEvent &mouseEvent) override
void mouseEntered (MouseEvent &mouseEvent) override
void mouseExited (MouseEvent &mouseEvent) override
Button & operator= (Button &&)=delete
Button & operator= (Button const &)=delete
void resizeToContent ()
void setActive (bool state)
void setAlignment (Graphics::Alignment alignment)
void setCaption (std::string const &caption)
void setDownOffset (int x, int y)
void setDownXOffset (int offset)
void setDownYOffset (int offset)
Public Member Functions inherited from fcn::Widget
virtual void _draw (Graphics *graphics)
virtual FocusHandler_getFocusHandler ()
virtual std::list< FocusListener * > const & _getFocusListeners ()
virtual FocusHandler_getInternalFocusHandler ()
virtual std::list< KeyListener * > const & _getKeyListeners ()
virtual std::list< MouseListener * > const & _getMouseListeners ()
virtual void _logic ()
virtual void _setFocusHandler (FocusHandler *focusHandler)
virtual void _setParent (Widget *parent)
void adaptLayout ()
virtual void adaptLayout (bool top)
void addActionListener (ActionListener *actionListener)
void addDeathListener (DeathListener *deathListener)
void addFocusListener (FocusListener *focusListener)
void addKeyListener (KeyListener *keyListener)
void addMouseListener (MouseListener *mouseListener)
void addWidgetListener (WidgetListener *widgetListener)
virtual void drawBorder (Graphics *graphics)
virtual void drawOutline (Graphics *graphics)
virtual void drawSelectionFrame (Graphics *graphics)
void expandContent ()
virtual void expandContent (bool recursion)
virtual void focusNext ()
virtual void focusPrevious ()
virtual void getAbsolutePosition (int &x, int &y) const
std::string const & getActionEventId () const
Color const & getBackgroundColor () const
Color const & getBaseColor () const
Color const & getBorderColor () const
unsigned int getBorderSize () const
virtual Rectangle getChildrenArea ()
unsigned int getChildrenCount () const
Rectangle const & getDimension () const
Size const & getFixedSize () const
FontgetFont () const
Color const & getForegroundColor () const
int getHeight () const
std::string const & getId () const
void getLastPosition (int &x, int &y) const
int getMarginBottom () const
int getMarginLeft () const
int getMarginRight () const
int getMarginTop () const
Size const & getMaxSize () const
Size const & getMinSize () const
Color const & getOutlineColor () const
unsigned int getOutlineSize () const
unsigned int getPaddingBottom () const
unsigned int getPaddingLeft () const
unsigned int getPaddingRight () const
unsigned int getPaddingTop () const
virtual WidgetgetParent () const
Color const & getSelectionColor () const
SelectionMode getSelectionMode () const
virtual WidgetgetTop () const
unsigned int getVisibleChildrenCount () const
WidgetgetWidgetAt (int x, int y)
virtual WidgetgetWidgetAt (int x, int y, Widget *exclude)
std::list< Widget * > getWidgetsIn (Rectangle const &area)
virtual std::list< Widget * > getWidgetsIn (Rectangle const &area, Widget *ignore)
int getWidth () const
int getX () const
int getY () const
bool isEnabled () const
bool isFixedSize () const
bool isFocusable () const
virtual bool isFocused () const
bool isHorizontalExpand () const
bool isLastPositionSet () const
virtual bool isLayouted ()
virtual bool isModalFocusable () const
virtual bool isModalFocused () const
virtual bool isModalMouseInputFocusable () const
virtual bool isModalMouseInputFocused () const
bool isSetVisible () const
bool isTabInEnabled () const
bool isTabOutEnabled () const
bool isVerticalExpand () const
bool isVisible () const
virtual void logic ()
virtual void moveToBottom (Widget *widget)
virtual void moveToTop (Widget *widget)
Widgetoperator= (Widget &&)=delete
Widgetoperator= (Widget const &)=delete
virtual void releaseModalFocus ()
virtual void releaseModalMouseInputFocus ()
void removeActionListener (ActionListener *actionListener)
void removeDeathListener (DeathListener *deathListener)
void removeFocusListener (FocusListener *focusListener)
void removeKeyListener (KeyListener *keyListener)
void removeMouseListener (MouseListener *mouseListener)
void removeWidgetListener (WidgetListener *widgetListener)
virtual void requestFocus ()
virtual void requestModalFocus ()
virtual void requestModalMouseInputFocus ()
virtual void requestMoveToBottom ()
virtual void requestMoveToTop ()
void resizeToContent ()
void setActionEventId (std::string const &actionEventId)
virtual void setBackgroundColor (Color const &color)
virtual void setBaseColor (Color const &color)
virtual void setBorderColor (Color const &color)
void setBorderSize (unsigned int size)
void setDimension (Rectangle const &dimension)
void setEnabled (bool enabled)
void setFixedSize (Size const &size)
void setFocusable (bool focusable)
virtual void setFont (Font *font)
virtual void setForegroundColor (Color const &color)
void setHeight (int height)
void setHorizontalExpand (bool expand)
void setId (std::string const &id)
void setInternalFocusHandler (FocusHandler *internalFocusHandler)
void setLastPosition (int x, int y)
void setMargin (int margin)
void setMarginBottom (int margin)
void setMarginLeft (int margin)
void setMarginRight (int margin)
void setMarginTop (int margin)
void setMaxSize (Size const &size)
void setMinSize (Size const &size)
virtual void setOutlineColor (Color const &color)
void setOutlineSize (unsigned int size)
void setPadding (unsigned int padding)
void setPaddingBottom (unsigned int padding)
void setPaddingLeft (unsigned int padding)
void setPaddingRight (unsigned int padding)
void setPaddingTop (unsigned int padding)
void setPosition (int x, int y)
virtual void setSelectionColor (Color const &color)
virtual void setSelectionMode (SelectionMode mode)
void setSize (int width, int height)
void setTabInEnabled (bool enabled)
void setTabOutEnabled (bool enabled)
void setVerticalExpand (bool expand)
void setVisible (bool visible)
void setWidth (int width)
void setX (int x)
void setY (int y)
virtual void showPart (Rectangle rectangle)
virtual void showWidgetPart (Widget *widget, Rectangle area)
 Widget ()
 Widget (Widget &&)=delete
 Widget (Widget const &)=delete
Public Member Functions inherited from fcn::MouseListener
 MouseListener (MouseListener &&)=default
 MouseListener (MouseListener const &)=default
virtual void mouseMoved (MouseEvent &mouseEvent)
virtual void mouseWheelMovedDown (MouseEvent &mouseEvent)
virtual void mouseWheelMovedLeft (MouseEvent &mouseEvent)
virtual void mouseWheelMovedRight (MouseEvent &mouseEvent)
virtual void mouseWheelMovedUp (MouseEvent &mouseEvent)
MouseListener & operator= (MouseListener &&)=default
MouseListener & operator= (MouseListener const &)=default
Public Member Functions inherited from fcn::KeyListener
 KeyListener (KeyListener &&)=default
 KeyListener (KeyListener const &)=default
KeyListener & operator= (KeyListener &&)=default
KeyListener & operator= (KeyListener const &)=default
Public Member Functions inherited from fcn::FocusListener
virtual void focusGained (Event const &event)
 FocusListener (FocusListener &&)=delete
 FocusListener (FocusListener const &)=delete
FocusListener & operator= (FocusListener &&)=delete
FocusListener & operator= (FocusListener const &)=delete
Public Member Functions inherited from fcn::WidgetListener
virtual void ancestorMoved (Event const &event)
virtual void ancestorShown (Event const &event)
WidgetListener & operator= (WidgetListener &&)=default
WidgetListener & operator= (WidgetListener const &)=default
virtual void widgetHidden (Event const &event)
 WidgetListener (WidgetListener &&)=default
 WidgetListener (WidgetListener const &)=default
virtual void widgetMoved (Event const &event)
virtual void widgetResized (Event const &event)
virtual void widgetShown (Event const &event)

Protected Member Functions

void adjustSizeImpl () override
virtual void drawBox (Graphics *graphics)
void drawCheckmark (Graphics *graphics, Rectangle const &rec)
void drawCross (Graphics *graphics, Rectangle const &rec)
void drawDot (Graphics *graphics, Rectangle const &rec)
void drawMarkerImage (Graphics *graphics, Rectangle const &rec)
void drawRhombus (Graphics *graphics)
Protected Member Functions inherited from fcn::ImageButton
void adjustSizeImpl () override
void setImage (Image const *image, ImageType type)
void setImage (std::string const &filename, ImageType type)
Protected Member Functions inherited from fcn::Button
virtual bool isPressed () const
Protected Member Functions inherited from fcn::Widget
void add (Widget *widget)
void calculateSize ()
void distributeActionEvent ()
void distributeAncestorHiddenEvent (Widget *ancestor)
void distributeAncestorMovedEvent (Widget *ancestor)
void distributeAncestorShownEvent (Widget *ancestor)
void distributeHiddenEvent ()
void distributeMovedEvent ()
void distributeResizedEvent ()
void distributeShownEvent ()
virtual WidgetfindWidgetById (std::string const &id)
std::list< Widget * > const & getChildren () const
virtual void remove (Widget *widget)
virtual void removeAllChildren ()
void resizeToChildren ()
Protected Member Functions inherited from fcn::MouseListener
 MouseListener ()=default
Protected Member Functions inherited from fcn::KeyListener
 KeyListener ()=default
Protected Member Functions inherited from fcn::FocusListener
 FocusListener ()=default
Protected Member Functions inherited from fcn::WidgetListener
 WidgetListener ()=default

Protected Attributes

Image const * mBackgroundImage {nullptr}
std::string mCaption
bool mInternalBackgroundImage {false}
MarkerStyle mMode {MarkerStyle::Checkmark}
bool mSelected {false}
Protected Attributes inherited from fcn::ImageButton
std::vector< Image const * > mImages
std::vector< std::unique_ptr< Image const > > mOwnedImages
Protected Attributes inherited from fcn::Button
Graphics::Alignment mAlignment {Graphics::Alignment::Center}
std::string mCaption
bool mHasMouse {false}
bool mKeyPressed {false}
bool mMousePressed {false}
bool mState {true}
int mXOffset {1}
int mYOffset {1}
Protected Attributes inherited from fcn::Widget
std::string mActionEventId
std::list< ActionListener * > mActionListeners
Color mBackgroundColor {0xf9fafb}
Color mBaseColor {0xe5e7eb}
Color mBorderColor {0xd1d5db}
unsigned int mBorderSize {0}
std::list< Widget * > mChildren
FontmCurrentFont {nullptr}
std::list< DeathListener * > mDeathListeners
Rectangle mDimension
bool mEnabled {true}
Size mFixedSize {-1, -1}
bool mFixedSizeUsed {false}
bool mFocusable {false}
FocusHandlermFocusHandler {nullptr}
std::list< FocusListener * > mFocusListeners
Color mForegroundColor {0x1f2933}
bool mHExpand {false}
std::string mId
FocusHandlermInternalFocusHandler {nullptr}
std::list< KeyListener * > mKeyListeners
int mLastX {0}
int mLastY {0}
int mMarginBottom {0}
int mMarginLeft {0}
int mMarginRight {0}
int mMarginTop {0}
Size mMaxSize {std::numeric_limits<int>::max(), std::numeric_limits<int>::max()}
Size mMinSize {0, 0}
std::list< MouseListener * > mMouseListeners
Rectangle mOffsetRect
Color mOutlineColor {0x9ca3af}
unsigned int mOutlineSize {0}
unsigned int mPaddingBottom {0}
unsigned int mPaddingLeft {0}
unsigned int mPaddingRight {0}
unsigned int mPaddingTop {0}
WidgetmParent {nullptr}
Color mSelectionColor {0x3b82f6}
SelectionMode mSelectionMode {SelectionMode::None}
bool mTabIn {true}
bool mTabOut {true}
bool mVExpand {false}
bool mVisible {true}
std::list< WidgetListener * > mWidgetListeners

Additional Inherited Members

Static Public Member Functions inherited from fcn::Widget
static DeathListener_getGuiDeathListener ()
static VisibilityEventHandler_getVisibilityEventHandler ()
static void _setGuiDeathListener (DeathListener *deathListener)
static void _setVisibilityEventHandler (VisibilityEventHandler *visibilityEventHandler)
static void setGlobalFont (Font *font)
static bool widgetExists (Widget const *widget)
Static Protected Attributes inherited from fcn::Widget
static DefaultFont mDefaultFont
static FontmGlobalFont = nullptr
static DeathListenermGuiDeathListener = nullptr
static VisibilityEventHandlermVisibilityEventHandler = nullptr
static std::list< Widget * > mWidgetInstances

Detailed Description

An implementation of a check box where a user can select or deselect the check box and where the status of the check box is displayed to the user.

A check box is capable of displaying a caption.

If a check box's state changes an action event will be sent to all action listeners of the check box.

Definition at line 26 of file checkbox.hpp.

Member Enumeration Documentation

◆ MarkerStyle

enum class fcn::CheckBox::MarkerStyle : uint8_t
strong

Marker style.

Definition at line 32 of file checkbox.hpp.

Constructor & Destructor Documentation

◆ CheckBox() [1/2]

fcn::CheckBox::CheckBox ( )

Definition at line 62 of file checkbox.cpp.

◆ CheckBox() [2/2]

fcn::CheckBox::CheckBox ( std::string const & caption,
bool selected = false )
explicit

Constructor.

The check box will be automatically resized to fit the caption.

Parameters
captionThe caption of the check box.
selectedTrue if the check box is selected, false otherwise.

Definition at line 67 of file checkbox.cpp.

References adjustSizeImpl(), mSelected, and fcn::Button::setCaption().

◆ ~CheckBox()

fcn::CheckBox::~CheckBox ( )
override

Definition at line 73 of file checkbox.cpp.

Member Function Documentation

◆ adjustSize()

void fcn::CheckBox::adjustSize ( )
overridevirtual

Resizes the widget's size to fit the content exactly.

Reimplemented from fcn::Button.

Definition at line 421 of file checkbox.cpp.

References adjustSizeImpl().

Referenced by fcn::RadioButton::RadioButton().

◆ adjustSizeImpl()

void fcn::CheckBox::adjustSizeImpl ( )
overrideprotectedvirtual

Adjusts the size of the checkbox to fit the caption.

The public adjustSize() method serves as a virtual entry point for polymorphism, while this adjustSizeImpl() method contains the concrete implementation of the resizing logic.

See also
adjustSize (virtual entry point for polymorphism)

Reimplemented from fcn::Button.

Definition at line 426 of file checkbox.cpp.

References fcn::Widget::getBorderSize(), fcn::Button::getCaption(), fcn::Widget::getFont(), fcn::Font::getHeight(), fcn::Widget::getHeight(), fcn::Widget::getPaddingBottom(), fcn::Widget::getPaddingLeft(), fcn::Widget::getPaddingRight(), fcn::Widget::getPaddingTop(), fcn::ImageButton::getUpImage(), fcn::Font::getWidth(), fcn::Image::getWidth(), mBackgroundImage, and fcn::Widget::setSize().

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

◆ draw()

void fcn::CheckBox::draw ( Graphics * graphics)
overridevirtual

Draws the widget.

The call to draw is initiated by the widget's parent. The graphics object is set up so that all drawing is relative to the widget, i.e coordinate (0,0) is the top left corner of the widget. It is not possible to draw outside of a widget's dimension. If a widget has children, the parent's draw function will always be called before the children's draw functions are called.

NOTE: A widget with children won't draw its children unless the children area given by Widget::getChildrenArea returns a none empty rectangle inside the widgets dimension. The children area is considered relative to the widget's position.

Parameters
Graphics & RenderingA graphics object to draw with.
See also
getChildrenArea, drawOutline, drawBorder

Reimplemented from fcn::Button.

Definition at line 80 of file checkbox.cpp.

References drawBox(), drawRhombus(), fcn::Graphics::drawText(), fcn::Widget::getBorderSize(), fcn::Button::getCaption(), fcn::Widget::getFont(), fcn::Widget::getForegroundColor(), fcn::Font::getHeight(), fcn::Widget::getHeight(), fcn::Widget::getPaddingBottom(), fcn::Widget::getPaddingLeft(), fcn::Widget::getPaddingTop(), mMode, fcn::Graphics::setColor(), and fcn::Graphics::setFont().

◆ drawBox()

◆ drawCheckmark()

void fcn::CheckBox::drawCheckmark ( Graphics * graphics,
Rectangle const & rec )
protected

Draws the checkmark.

Parameters
Graphics & RenderingA Graphics object to draw with.
recThe rectangle that defines the position and size.

Definition at line 189 of file checkbox.cpp.

References fcn::Rectangle::height, fcn::Rectangle::width, fcn::Rectangle::x, and fcn::Rectangle::y.

Referenced by drawBox().

◆ drawCross()

void fcn::CheckBox::drawCross ( Graphics * graphics,
Rectangle const & rec )
protected

Draws the cross.

Parameters
Graphics & RenderingA Graphics object to draw with.
recThe rectangle that defines the position and size.

Definition at line 201 of file checkbox.cpp.

References fcn::Rectangle::height, fcn::Rectangle::width, fcn::Rectangle::x, and fcn::Rectangle::y.

Referenced by drawBox().

◆ drawDot()

void fcn::CheckBox::drawDot ( Graphics * graphics,
Rectangle const & rec )
protected

Draws the dot.

Parameters
Graphics & RenderingA Graphics object to draw with.
recThe rectangle that defines the position and size.

Definition at line 216 of file checkbox.cpp.

References fcn::Graphics::drawFillCircle(), fcn::Rectangle::height, fcn::Rectangle::width, fcn::Rectangle::x, and fcn::Rectangle::y.

Referenced by drawBox().

◆ drawMarkerImage()

◆ drawRhombus()

◆ getBackgroundImage()

Image const * fcn::CheckBox::getBackgroundImage ( ) const

Gets background image.

Returns
The background image.

Definition at line 363 of file checkbox.cpp.

References mBackgroundImage.

◆ getMarkerStyle()

CheckBox::MarkerStyle fcn::CheckBox::getMarkerStyle ( ) const

Gets the marker mode of the check box.

Returns
The mode of the check box.
See also
setMarkerStyle, MarkerStyle

Definition at line 368 of file checkbox.cpp.

References mMode.

◆ isSelected()

bool fcn::CheckBox::isSelected ( ) const
virtual

Checks if the check box is selected.

Returns
True if the check box is selected, false otherwise.
See also
setSelected

Definition at line 328 of file checkbox.cpp.

References mSelected.

Referenced by drawMarkerImage(), and fcn::RadioButton::toggleSelected().

◆ keyPressed()

void fcn::CheckBox::keyPressed ( KeyEvent & keyEvent)
overridevirtual

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
keyEventDescribes the event.

Reimplemented from fcn::Button.

Definition at line 378 of file checkbox.cpp.

References fcn::InputEvent::consume(), fcn::Widget::distributeActionEvent(), fcn::KeyEvent::getKey(), fcn::Key::getValue(), and toggleSelected().

◆ keyReleased()

void fcn::CheckBox::keyReleased ( KeyEvent & keyEvent)
overridevirtual

Called if a key is released when the widget has keyboard focus.

Parameters
keyEventDescribes the event.

Reimplemented from fcn::Button.

Definition at line 389 of file checkbox.cpp.

References fcn::InputEvent::consume(), fcn::KeyEvent::getKey(), and fcn::Key::getValue().

◆ mouseClicked()

void fcn::CheckBox::mouseClicked ( MouseEvent & mouseEvent)
overridevirtual

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

Parameters
mouseEventDescribes the event.

Reimplemented from fcn::MouseListener.

Definition at line 412 of file checkbox.cpp.

References fcn::InputEvent::consume(), fcn::Widget::distributeActionEvent(), fcn::MouseEvent::getButton(), fcn::Button::mHasMouse, and toggleSelected().

◆ mousePressed()

void fcn::CheckBox::mousePressed ( MouseEvent & mouseEvent)
overridevirtual

Called when a mouse button has been pressed on the widget area.

NOTE: A mouse press is NOT equal to a mouse click. Use mouseClickMessage to check for mouse clicks.

Parameters
mouseEventDescribes the event.

Reimplemented from fcn::Button.

Definition at line 398 of file checkbox.cpp.

References fcn::InputEvent::consume(), and fcn::Button::mHasMouse.

◆ mouseReleased()

void fcn::CheckBox::mouseReleased ( MouseEvent & mouseEvent)
overridevirtual

Called when a mouse button has been released on the widget area.

Parameters
mouseEventDescribes the event.

Reimplemented from fcn::Button.

Definition at line 405 of file checkbox.cpp.

References fcn::InputEvent::consume(), and fcn::Button::mHasMouse.

◆ setBackgroundImage() [1/2]

void fcn::CheckBox::setBackgroundImage ( Image const * image)

Sets the background image to display, that includes the caption region.

Existing Image is freed automatically, if it was loaded internally.

Parameters
imageThe up image to display.

Definition at line 353 of file checkbox.cpp.

References adjustSizeImpl(), mBackgroundImage, and mInternalBackgroundImage.

◆ setBackgroundImage() [2/2]

void fcn::CheckBox::setBackgroundImage ( std::string const & filename)

Sets the background image to display, that includes the caption region.

Existing Image is freed automatically, if it was loaded internally.

Parameters
filenameThe filename of the up image to display.

Definition at line 343 of file checkbox.cpp.

References adjustSizeImpl(), fcn::Image::load(), mBackgroundImage, and mInternalBackgroundImage.

◆ setMarkerStyle()

void fcn::CheckBox::setMarkerStyle ( CheckBox::MarkerStyle mode)

Set the marker style of the check box.

Parameters
modeThe style of the check box.
See also
getMarkerStyle, MarkerStyle

Definition at line 373 of file checkbox.cpp.

References mMode.

Referenced by fcn::RadioButton::RadioButton().

◆ setSelected()

void fcn::CheckBox::setSelected ( bool selected)
virtual

Sets the check box to be selected or not.

Parameters
selectedTrue if the check box should be set as selected.
See also
isSelected

Reimplemented in fcn::RadioButton.

Definition at line 333 of file checkbox.cpp.

References mSelected.

◆ toggleSelected()

void fcn::CheckBox::toggleSelected ( )
virtual

Toggles the check box between being selected and not being selected.

It distribute a ActionEvent.

Reimplemented in fcn::RadioButton.

Definition at line 338 of file checkbox.cpp.

References mSelected.

Referenced by keyPressed(), and mouseClicked().

Member Data Documentation

◆ mBackgroundImage

Image const* fcn::CheckBox::mBackgroundImage {nullptr}
protected

Holds the background image, that includes the caption region.

Definition at line 195 of file checkbox.hpp.

Referenced by adjustSizeImpl(), drawBox(), getBackgroundImage(), setBackgroundImage(), and setBackgroundImage().

◆ mCaption

std::string fcn::CheckBox::mCaption
protected

Holds the caption of the button.

Definition at line 201 of file checkbox.hpp.

◆ mInternalBackgroundImage

bool fcn::CheckBox::mInternalBackgroundImage {false}
protected

True if the background image was loaded internally, false otherwise.

Definition at line 206 of file checkbox.hpp.

Referenced by setBackgroundImage(), and setBackgroundImage().

◆ mMode

MarkerStyle fcn::CheckBox::mMode {MarkerStyle::Checkmark}
protected

Holds the marker style of the check box.

Definition at line 216 of file checkbox.hpp.

Referenced by draw(), drawBox(), getMarkerStyle(), and setMarkerStyle().

◆ mSelected

bool fcn::CheckBox::mSelected {false}
protected

True if the check box is selected, false otherwise.

Definition at line 211 of file checkbox.hpp.

Referenced by CheckBox(), drawBox(), drawRhombus(), isSelected(), setSelected(), fcn::RadioButton::setSelected(), and toggleSelected().


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