|
FifeGUI 0.2.0
A C++ GUI library designed for games.
|
#include <curvegraph.hpp>
Public Member Functions | |
| CurveGraph () | |
| CurveGraph (CurveGraph &&)=delete | |
| CurveGraph (CurveGraph const &)=delete | |
| CurveGraph (PointVector data) | |
| void | draw (Graphics *graphics) override |
| PointVector const & | getPointVector () const |
| unsigned int | getThickness () const |
| bool | isAutomaticControlPoints () const |
| bool | isOpaque () const |
| CurveGraph & | operator= (CurveGraph &&)=delete |
| CurveGraph & | operator= (CurveGraph const &)=delete |
| void | resetPointVector () |
| void | setAutomaticControlPoints (bool acp) |
| void | setOpaque (bool opaque) |
| void | setPointVector (PointVector const &data) |
| void | setThickness (unsigned int thickness) |
| 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 |
| 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 | 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) |
| Widget & | operator= (Widget &&)=delete |
| Widget & | operator= (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 Member Functions | |
| void | addControlPoints (PointVector const &points, PointVector &newPoints) |
| Point | getBezierPoint (PointVector const &points, int elements, float t) |
| void | update () |
| 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 Widget * | findWidgetById (std::string const &id) |
| std::list< Widget * > const & | getChildren () const |
| virtual void | remove (Widget *widget) |
| virtual void | removeAllChildren () |
| void | resizeToChildren () |
Protected Attributes | |
| bool | m_acp {true} |
| PointVector | m_curveData |
| PointVector | m_data |
| bool | m_needUpdate {false} |
| bool | m_opaque {false} |
| unsigned int | m_thickness {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 |
| Font * | mCurrentFont {nullptr} |
| std::list< DeathListener * > | mDeathListeners |
| Rectangle | mDimension |
| bool | mEnabled {true} |
| Size | mFixedSize {-1, -1} |
| bool | mFixedSizeUsed {false} |
| bool | mFocusable {false} |
| FocusHandler * | mFocusHandler {nullptr} |
| std::list< FocusListener * > | mFocusListeners |
| Color | mForegroundColor {0x1f2933} |
| bool | mHExpand {false} |
| std::string | mId |
| FocusHandler * | mInternalFocusHandler {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} |
| Widget * | mParent {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) |
| 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 |
Displays data as a smooth curve based on a vector of points.
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 curvegraph.hpp.
|
explicit |
Construct with initial data points.
Definition at line 20 of file curvegraph.cpp.
References m_data.
|
protected |
Helper that adds the control points for bezier curves.
Definition at line 204 of file curvegraph.cpp.
Referenced by CurveGraph(), and update().
|
overridevirtual |
Draws this widget.
Implements fcn::Widget.
Definition at line 71 of file curvegraph.cpp.
References fcn::Widget::drawBorder(), fcn::Graphics::drawPolyLine(), fcn::Graphics::drawRoundStroke(), fcn::Widget::drawSelectionFrame(), fcn::Graphics::fillRectangle(), fcn::Widget::getBackgroundColor(), fcn::Widget::getBaseColor(), fcn::Widget::getBorderSize(), fcn::Widget::getHeight(), fcn::Widget::getSelectionColor(), fcn::Widget::getSelectionMode(), fcn::Widget::getWidth(), fcn::Widget::isFocused(), isOpaque(), m_curveData, m_needUpdate, m_thickness, fcn::Graphics::setColor(), and update().
Referenced by CurveGraph().
|
protected |
Helper that returns an interpolated Point.
Definition at line 160 of file curvegraph.cpp.
References fcn::Math< double >::Pow().
Referenced by CurveGraph(), and update().
| PointVector const & fcn::CurveGraph::getPointVector | ( | ) | const |
Get the current point vector.
Definition at line 28 of file curvegraph.cpp.
References m_data.
Referenced by CurveGraph().
| unsigned int fcn::CurveGraph::getThickness | ( | ) | const |
Get stroke thickness in pixels.
Definition at line 45 of file curvegraph.cpp.
References m_thickness.
Referenced by CurveGraph().
| bool fcn::CurveGraph::isAutomaticControlPoints | ( | ) | const |
Return whether automatic control points are enabled.
Definition at line 56 of file curvegraph.cpp.
References m_acp.
Referenced by CurveGraph().
| bool fcn::CurveGraph::isOpaque | ( | ) | const |
Definition at line 66 of file curvegraph.cpp.
References m_opaque.
Referenced by CurveGraph(), and draw().
| void fcn::CurveGraph::resetPointVector | ( | ) |
Reset the stored data to an empty vector.
Definition at line 33 of file curvegraph.cpp.
References m_data, and m_needUpdate.
Referenced by CurveGraph().
| void fcn::CurveGraph::setAutomaticControlPoints | ( | bool | acp | ) |
Enable/disable automatic computation of bezier control points.
Definition at line 50 of file curvegraph.cpp.
References m_acp, and m_needUpdate.
Referenced by CurveGraph().
| void fcn::CurveGraph::setOpaque | ( | bool | opaque | ) |
Sets the opacity of the graph.
| opaque | True if opaque, false otherwise. |
Definition at line 61 of file curvegraph.cpp.
References m_opaque.
Referenced by CurveGraph().
| void fcn::CurveGraph::setPointVector | ( | PointVector const & | data | ) |
Set the raw point vector used to draw the curve.
Definition at line 22 of file curvegraph.cpp.
References m_data, and m_needUpdate.
Referenced by CurveGraph().
| void fcn::CurveGraph::setThickness | ( | unsigned int | thickness | ) |
Set stroke thickness in pixels.
Definition at line 39 of file curvegraph.cpp.
References m_needUpdate, and m_thickness.
Referenced by CurveGraph().
|
protected |
Precalculate bezier curve.
Definition at line 119 of file curvegraph.cpp.
References addControlPoints(), getBezierPoint(), m_acp, m_curveData, m_data, m_needUpdate, m_thickness, and fcn::Math< float >::Sqrt().
Referenced by CurveGraph(), and draw().
|
protected |
Whether automatic control points are enabled.
Definition at line 95 of file curvegraph.hpp.
Referenced by isAutomaticControlPoints(), setAutomaticControlPoints(), and update().
|
protected |
Precalculated curve points (bezier/interpolated).
Definition at line 107 of file curvegraph.hpp.
|
protected |
Raw input point data.
Definition at line 104 of file curvegraph.hpp.
Referenced by CurveGraph(), getPointVector(), resetPointVector(), setPointVector(), and update().
|
protected |
Internal flag marking that the precalculated curve data needs update.
Definition at line 98 of file curvegraph.hpp.
Referenced by draw(), resetPointVector(), setAutomaticControlPoints(), setPointVector(), setThickness(), and update().
|
protected |
True if the curve is drawn opaque.
Definition at line 92 of file curvegraph.hpp.
Referenced by isOpaque(), and setOpaque().
|
protected |
Stroke thickness in pixels.
Definition at line 101 of file curvegraph.hpp.
Referenced by draw(), getThickness(), setThickness(), and update().