|
FifeGUI 0.3.0
A C++ GUI library designed for games.
|
#include <imageprogressbar.hpp>
Public Types | |
| enum class | Orientation : uint8_t { Horizontal = 0 , Vertical } |
| Public Types inherited from fcn::Widget | |
| enum | BorderSide : uint8_t { BORDER_NONE = 0 , BORDER_LEFT = 1 << 0 , BORDER_TOP = 1 << 1 , BORDER_RIGHT = 1 << 2 , BORDER_BOTTOM = 1 << 3 , BORDER_ALL = BORDER_LEFT | BORDER_TOP | BORDER_RIGHT | BORDER_BOTTOM } |
| enum | BorderStyle : uint8_t { BORDER_STYLE_BEVEL = 0 , BORDER_STYLE_FLAT = 1 } |
| enum class | SelectionMode : uint8_t { None = 0 , Border = 1 , Background = 2 } |
Public Member Functions | |
| void | adjustSize () override |
| void | draw (Graphics *graphics) override |
| Image const * | getBarImage () const |
| Image const * | getForegroundImage () const |
| int | getMaxValue () const |
| Orientation | getOrientation () const |
| int | getValue () const |
| ImageProgressBar (Image *image, int maxValue) | |
| ImageProgressBar (ImageProgressBar &&)=delete | |
| ImageProgressBar (ImageProgressBar const &)=delete | |
| ImageProgressBar (std::string const &filename, int maxValue) | |
| bool | isOpaque () const |
| ImageProgressBar & | operator= (ImageProgressBar &&)=delete |
| ImageProgressBar & | operator= (ImageProgressBar const &)=delete |
| void | resizeToContent (bool recursion=true) override |
| void | setBarImage (Image *image) |
| void | setForegroundImage (Image *image) |
| void | setMaxValue (int value) |
| void | setOpaque (bool opaque) |
| void | setOrientation (Orientation orientation) |
| void | setValue (int value) |
| 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 | addDropTargetListener (DropTargetListener *listener) |
| void | addFocusListener (FocusListener *focusListener) |
| void | addKeyListener (KeyListener *keyListener) |
| void | addMouseListener (MouseListener *mouseListener) |
| void | addWidgetListener (WidgetListener *widgetListener) |
| bool | captureMouse () |
| bool | contains (int x, int y) const |
| virtual void | drawBorder (Graphics *graphics) |
| void | drawBorder (Graphics *graphics, unsigned int sides) const |
| 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 | getBorderSides () const |
| unsigned int | getBorderSize () const |
| unsigned int | getBorderStyle () const |
| virtual Rectangle | getChildrenArea () |
| unsigned int | getChildrenCount () const |
| Rectangle const & | getDimension () const |
| Size const & | getFixedSize () const |
| Font * | getFont () 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 Widget * | getParent () const |
| Color const & | getSelectionColor () const |
| SelectionMode | getSelectionMode () const |
| virtual Widget * | getTop () const |
| unsigned int | getVisibleChildrenCount () const |
| Widget * | getWidgetAt (int x, int y) |
| virtual Widget * | getWidgetAt (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 | hasMouseCapture () const |
| bool | isDescendantOf (Widget const *ancestor) const noexcept |
| bool | isEnabled () const |
| bool | isFixedSize () const |
| bool | isFocusable () const |
| virtual bool | isFocused () const |
| bool | isHorizontalExpand () const |
| bool | isInsideActiveMouseModal () const noexcept |
| bool | isLastPositionSet () const |
| virtual bool | isLayouted () |
| virtual bool | isModalFocusable () const |
| virtual bool | isModalFocused () const |
| virtual bool | isModalMouseInputFocusable () const |
| bool | isMouseInside (MouseEvent const &mouseEvent) const |
| bool | isSetVisible () const |
| bool | isTabInEnabled () const |
| bool | isTabOutEnabled () const |
| virtual bool | isUnderMouseModal () const |
| bool | isVerticalExpand () const |
| bool | isVisible () const |
| virtual void | logic () |
| virtual void | moveToBottom (Widget *widget) |
| virtual void | moveToTop (Widget *widget) |
| virtual void | onFocusChanged () |
| virtual void | onFocusGained () |
| virtual void | onFocusLost () |
| Widget & | operator= (Widget &&)=delete |
| Widget & | operator= (Widget const &)=delete |
| void | releaseMouse () |
| void | removeActionListener (ActionListener *actionListener) |
| void | removeDeathListener (DeathListener *deathListener) |
| void | removeDropTargetListener (DropTargetListener *listener) |
| void | removeFocusListener (FocusListener *focusListener) |
| void | removeKeyListener (KeyListener *keyListener) |
| void | removeMouseListener (MouseListener *mouseListener) |
| void | removeWidgetListener (WidgetListener *widgetListener) |
| virtual void | requestFocus () |
| virtual void | requestMoveToBottom () |
| virtual void | requestMoveToTop () |
| void | setActionEventId (std::string const &actionEventId) |
| virtual void | setBackgroundColor (Color const &color) |
| virtual void | setBaseColor (Color const &color) |
| void | setBorderBottom (unsigned int size, unsigned int style) |
| virtual void | setBorderColor (Color const &color) |
| void | setBorderSides (unsigned int sides) |
| void | setBorderSize (unsigned int size) |
| void | setBorderStyle (unsigned int style) |
| void | setBorderTop (unsigned int size, unsigned int style) |
| virtual void | setDimension (Rectangle const &dimension) |
| void | setEnabled (bool enabled) |
| void | setFixedSize (Size const &size) |
| void | setFocusable (bool focusable) |
| virtual void | setFocused (bool focused) |
| virtual void | setFont (Font *font) |
| virtual void | setForegroundColor (Color const &color) |
| virtual 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) |
| virtual void | setSize (int width, int height) |
| void | setTabInEnabled (bool enabled) |
| void | setTabOutEnabled (bool enabled) |
| void | setVerticalExpand (bool expand) |
| void | setVisible (bool visible) |
| virtual void | setWidth (int width) |
| void | setX (int x) |
| void | setY (int y) |
| virtual void | showPart (Rectangle rectangle) |
| virtual void | showWidgetPart (Widget *widget, Rectangle area) |
| virtual void | textInput (TextInputEvent &event) |
| Widget () | |
| Widget (Widget &&)=delete | |
| Widget (Widget const &)=delete | |
Protected Member Functions | |
| void | adjustSizeImpl () |
| 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 | distributeDragDrop (DragEvent &event) |
| bool | distributeDragEnter (DragEvent &event) |
| void | distributeDragHover (DragEvent &event) |
| void | distributeDragLeave (DragEvent &event) |
| void | distributeHiddenEvent () |
| void | distributeMovedEvent () |
| void | distributeResizedEvent () |
| void | distributeShownEvent () |
| virtual Widget * | findWidgetById (std::string const &id) |
| std::list< Widget * > const & | getChildren () const |
| virtual void | remove (Widget *widget) |
| virtual void | removeAllChildren () |
| void | resizeToChildren () |
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 Widget * | getMouseCapture () |
| static void | resetGlobalFont () |
| static void | setGlobalFont (Font *font) |
| static bool | widgetExists (Widget const *widget) |
| Static Protected Attributes inherited from fcn::Widget | |
| static DefaultFont | mDefaultFont |
| static Font * | mGlobalFont = nullptr |
| static DeathListener * | mGuiDeathListener = nullptr |
| static VisibilityEventHandler * | mVisibilityEventHandler = nullptr |
| static std::list< Widget * > | mWidgetInstances |
| static Widget * | sMouseCapture = nullptr |
Displays progress using images.
Definition at line 25 of file imageprogressbar.hpp.
|
strong |
Orientation of the progress bar (horizontal or vertical).
Definition at line 29 of file imageprogressbar.hpp.
| fcn::ImageProgressBar::ImageProgressBar | ( | ) |
Definition at line 20 of file imageprogressbar.cpp.
| fcn::ImageProgressBar::ImageProgressBar | ( | Image * | image, |
| int | maxValue ) |
Constructor.
The image passed is not owned by this object.
| image | Image used by the progress bar. |
| maxValue | Value when the progress bar is full. |
Definition at line 31 of file imageprogressbar.cpp.
References adjustSizeImpl(), mBarImage, mForegroundImage, mInternalImage, mMaxValue, mOpaque, mOrientation, and mValue.
| fcn::ImageProgressBar::ImageProgressBar | ( | std::string const & | filename, |
| int | maxValue ) |
Constructor.
The image indicated by filename is opened and it's owned by this object.
| filename | Filename of the image to be used by the progress bar. |
| maxValue | Value when the progress bar is full. |
Definition at line 44 of file imageprogressbar.cpp.
References adjustSizeImpl(), mBarImage, mForegroundImage, mInternalImage, mMaxValue, mOpaque, mOrientation, and mValue.
|
override |
Definition at line 57 of file imageprogressbar.cpp.
|
overridevirtual |
Resizes the widget's size to fit the content exactly.
Reimplemented from fcn::Widget.
Definition at line 209 of file imageprogressbar.cpp.
References adjustSizeImpl().
|
protected |
Adjusts the size of the progress bar to fit the content.
The public adjustSize() method serves as a virtual entry point for polymorphism, while this adjustSizeImpl() method contains the concrete implementation of the resizing logic.
Definition at line 214 of file imageprogressbar.cpp.
References fcn::Widget::getBorderSize(), fcn::Widget::getPaddingBottom(), fcn::Widget::getPaddingLeft(), fcn::Widget::getPaddingRight(), fcn::Widget::getPaddingTop(), mBarImage, and fcn::Widget::setSize().
Referenced by adjustSize(), ImageProgressBar(), ImageProgressBar(), resizeToContent(), setBarImage(), and setForegroundImage().
|
overridevirtual |
Draws this ImageProgressBar.
Implements fcn::Widget.
Definition at line 64 of file imageprogressbar.cpp.
References fcn::Widget::drawBorder(), fcn::Graphics::drawImage(), fcn::Widget::drawSelectionFrame(), fcn::Graphics::fillRectangle(), fcn::Widget::getBackgroundColor(), fcn::Widget::getBorderSize(), fcn::Widget::getHeight(), getOrientation(), fcn::Widget::getPaddingLeft(), fcn::Widget::getPaddingTop(), fcn::Widget::getSelectionColor(), fcn::Widget::getSelectionMode(), fcn::Widget::getWidth(), fcn::Widget::isFocused(), isOpaque(), mBarImage, mForegroundImage, mMaxValue, mValue, fcn::Graphics::popClipArea(), fcn::Graphics::pushClipArea(), and fcn::Graphics::setColor().
| Image const * fcn::ImageProgressBar::getBarImage | ( | ) | const |
Definition at line 144 of file imageprogressbar.cpp.
References mBarImage.
| Image const * fcn::ImageProgressBar::getForegroundImage | ( | ) | const |
Definition at line 155 of file imageprogressbar.cpp.
References mForegroundImage.
| int fcn::ImageProgressBar::getMaxValue | ( | ) | const |
Gets the max value of the bar.
Definition at line 182 of file imageprogressbar.cpp.
References mMaxValue.
| ImageProgressBar::Orientation fcn::ImageProgressBar::getOrientation | ( | ) | const |
Definition at line 171 of file imageprogressbar.cpp.
References mOrientation.
Referenced by draw().
| int fcn::ImageProgressBar::getValue | ( | ) | const |
Gets the value of the bar.
Definition at line 198 of file imageprogressbar.cpp.
References mValue.
| bool fcn::ImageProgressBar::isOpaque | ( | ) | const |
Definition at line 127 of file imageprogressbar.cpp.
References mOpaque.
Referenced by draw().
|
overridevirtual |
Resizes the widget's size to fit the content exactly, calls recursively all childs.
The default value true allows callers to use resizeToContent() without argument.
| recursion | If true, perform the resize operation recursively on children. |
Reimplemented from fcn::Widget.
Definition at line 203 of file imageprogressbar.cpp.
References adjustSizeImpl().
| void fcn::ImageProgressBar::setBarImage | ( | Image * | image | ) |
Sets the Bar image.
The image passed is not owned by this object.
| image | Image used by the progress bar. |
Definition at line 132 of file imageprogressbar.cpp.
References adjustSizeImpl(), mBarImage, and mInternalImage.
| void fcn::ImageProgressBar::setForegroundImage | ( | Image * | image | ) |
Sets the foreground image.
The image passed is not owned by this object.
| image | Image used as overlay by the progress bar. |
Definition at line 149 of file imageprogressbar.cpp.
References adjustSizeImpl(), and mForegroundImage.
| void fcn::ImageProgressBar::setMaxValue | ( | int | value | ) |
Sets the max value of the bar.
| value | The max value of the bar. |
Definition at line 176 of file imageprogressbar.cpp.
References mMaxValue.
| void fcn::ImageProgressBar::setOpaque | ( | bool | opaque | ) |
Sets the opacity of the ImageProgressBar.
| opaque | True if opaque, false otherwise. |
Definition at line 122 of file imageprogressbar.cpp.
References mOpaque.
| void fcn::ImageProgressBar::setOrientation | ( | Orientation | orientation | ) |
Sets the ImageProgressBar's orientation.
| orientation | Desired orientation. |
Definition at line 160 of file imageprogressbar.cpp.
References mOrientation, and fcn::throwException().
| void fcn::ImageProgressBar::setValue | ( | int | value | ) |
Sets the value of the bar.
| value | In the range of 0-max. |
Definition at line 187 of file imageprogressbar.cpp.
|
protected |
Bar image.
Definition at line 168 of file imageprogressbar.hpp.
Referenced by adjustSizeImpl(), draw(), getBarImage(), ImageProgressBar(), ImageProgressBar(), and setBarImage().
|
protected |
Foreground image.
Definition at line 173 of file imageprogressbar.hpp.
Referenced by draw(), getForegroundImage(), ImageProgressBar(), ImageProgressBar(), and setForegroundImage().
|
protected |
True if the image has been loaded internally, false otherwise.
An image not loaded internally should not be deleted in the destructor.
Definition at line 180 of file imageprogressbar.hpp.
Referenced by ImageProgressBar(), ImageProgressBar(), and setBarImage().
|
protected |
Value when progress bar is full.
Definition at line 185 of file imageprogressbar.hpp.
Referenced by draw(), getMaxValue(), ImageProgressBar(), ImageProgressBar(), setMaxValue(), and setValue().
|
protected |
True if the widget is opaque, false otherwise.
Definition at line 200 of file imageprogressbar.hpp.
Referenced by ImageProgressBar(), ImageProgressBar(), isOpaque(), and setOpaque().
|
protected |
ImageProgressBar's orientation.
Definition at line 195 of file imageprogressbar.hpp.
Referenced by getOrientation(), ImageProgressBar(), ImageProgressBar(), and setOrientation().
|
protected |
Holds the current progress bar value.
Definition at line 190 of file imageprogressbar.hpp.
Referenced by draw(), getValue(), ImageProgressBar(), ImageProgressBar(), and setValue().