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

#include <bargraph.hpp>

Inheritance diagram for fcn::BarGraph:
fcn::Widget

Public Member Functions

 BarGraph (BarGraph &&)=delete
 BarGraph (BarGraph const &)=delete
 BarGraph (int x, int y, int w, int h)
void draw (Graphics *graphics) override
int getBarHeight () const
int getBarWidth () const
int getBarX () const
int getBarY () const
bool isOpaque () const
BarGraph & operator= (BarGraph &&)=delete
BarGraph & operator= (BarGraph const &)=delete
void setBarHeight (int h)
void setBarPosition (int x, int y)
void setBarPosition (Point const &pos)
void setBarSize (int w, int h)
void setBarWidth (int w)
void setBarX (int x)
void setBarY (int y)
void setOpaque (bool opaque)
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 adjustSize ()
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 fontChanged ()
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 ()
virtual void resizeToContent (bool recursion)
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

Protected Attributes

bool m_opaque {false}
Rectangle m_rec
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

Public Types inherited from fcn::Widget
enum class  SelectionMode : uint8_t { None = 0 , Border = 1 , Background = 2 }
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)
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 ()
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

Displays data as a rectangular bar graph.

The graph can be set to be opaque or not with setOpaque. If the graph is opaque, it will be drawn with a solid color, otherwise it will be drawn with a transparent color.

Definition at line 24 of file bargraph.hpp.

Constructor & Destructor Documentation

◆ BarGraph()

fcn::BarGraph::BarGraph ( int x,
int y,
int w,
int h )

Constructor.

Definition at line 15 of file bargraph.cpp.

References m_rec.

Member Function Documentation

◆ draw()

◆ getBarHeight()

int fcn::BarGraph::getBarHeight ( ) const
Returns
The height of the bar.

Definition at line 64 of file bargraph.cpp.

References m_rec.

◆ getBarWidth()

int fcn::BarGraph::getBarWidth ( ) const
Returns
The width of the bar.

Definition at line 54 of file bargraph.cpp.

References m_rec.

◆ getBarX()

int fcn::BarGraph::getBarX ( ) const
Returns
The x position of the bar.

Definition at line 22 of file bargraph.cpp.

References m_rec.

◆ getBarY()

int fcn::BarGraph::getBarY ( ) const
Returns
The y position of the bar.

Definition at line 32 of file bargraph.cpp.

References m_rec.

◆ isOpaque()

bool fcn::BarGraph::isOpaque ( ) const
Returns
Whether this graph is opaque or not.

Definition at line 80 of file bargraph.cpp.

References m_opaque.

Referenced by draw().

◆ setBarHeight()

void fcn::BarGraph::setBarHeight ( int h)

Sets the height of the bar.

Definition at line 59 of file bargraph.cpp.

References m_rec.

◆ setBarPosition() [1/2]

void fcn::BarGraph::setBarPosition ( int x,
int y )

Sets the position of the bar.

Definition at line 37 of file bargraph.cpp.

References m_rec.

◆ setBarPosition() [2/2]

void fcn::BarGraph::setBarPosition ( Point const & pos)

Sets the position of the bar.

Parameters
posThe position of the bar.

Definition at line 43 of file bargraph.cpp.

References m_rec.

◆ setBarSize()

void fcn::BarGraph::setBarSize ( int w,
int h )

Sets the size of the bar.

Definition at line 69 of file bargraph.cpp.

References m_rec.

◆ setBarWidth()

void fcn::BarGraph::setBarWidth ( int w)

Sets the width of the bar.

Definition at line 49 of file bargraph.cpp.

References m_rec.

◆ setBarX()

void fcn::BarGraph::setBarX ( int x)

Sets the x position of the bar.

Definition at line 17 of file bargraph.cpp.

References m_rec.

◆ setBarY()

void fcn::BarGraph::setBarY ( int y)

Sets the y position of the bar.

Definition at line 27 of file bargraph.cpp.

References m_rec.

◆ setOpaque()

void fcn::BarGraph::setOpaque ( bool opaque)

Sets the opacity of the graph.

Parameters
opaqueTrue if opaque, false otherwise.

Definition at line 75 of file bargraph.cpp.

References m_opaque.

Member Data Documentation

◆ m_opaque

bool fcn::BarGraph::m_opaque {false}
protected

m_opaque is true if the graph is opaque, false otherwise.

Definition at line 119 of file bargraph.hpp.

Referenced by isOpaque(), and setOpaque().

◆ m_rec

Rectangle fcn::BarGraph::m_rec
protected

m_rec is the rectangle that represents the bar.

Definition at line 124 of file bargraph.hpp.

Referenced by BarGraph(), draw(), getBarHeight(), getBarWidth(), getBarX(), getBarY(), setBarHeight(), setBarPosition(), setBarPosition(), setBarSize(), setBarWidth(), setBarX(), and setBarY().


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