Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CChart Class Reference

Chart for a data visualization as lines or points. More...

#include <CChart.h>

Inheritance diagram for CChart:
Collaboration diagram for CChart:

Public Member Functions

 CChart (CGUI &pGUI)
 
virtual ~CChart ()
 
- Public Member Functions inherited from IGUIObject
 NONCOPYABLE (IGUIObject)
 
 IGUIObject (CGUI &pGUI)
 
virtual ~IGUIObject ()
 
virtual bool IsMouseOver () const
 This function checks if the mouse is hovering the rectangle that the base setting "size" makes. More...
 
virtual bool IsMouseHovering () const
 This function returns true if the mouse is hovering over this GUI object and if this GUI object is the topmost object in that screen location. More...
 
const CStr & GetName () const
 Get object name, name is unique. More...
 
void SetName (const CStr &Name)
 Get object name. More...
 
CStr GetPresentableName () const
 
const std::vector< IGUIObject * > & GetChildren () const
 Return all child objects of the current object. More...
 
void RegisterSetting (const CStr &Name, IGUISetting *setting)
 Registers the given setting with the GUI object. More...
 
void ReregisterSetting (const CStr &Name, IGUISetting *setting)
 
bool SettingExists (const CStr &Setting) const
 Returns whether there is a setting with the given name registered. More...
 
bool SetSettingFromString (const CStr &Setting, const CStrW &Value, const bool SendMessage)
 Set a setting by string, regardless of what type it is. More...
 
bool IsEnabled () const
 Returns whether this object is set to be hidden or ghost. More...
 
bool IsHidden () const
 Returns whether this is object is set to be hidden. More...
 
void SetHidden (bool hidden)
 
bool IsHiddenOrGhost () const
 Returns whether this object is set to be hidden or ghost. More...
 
void PlaySound (const CStrW &soundPath) const
 Retrieves the configured sound filename from the given setting name and plays that once. More...
 
InReaction SendEvent (EGUIMessageType type, const CStr &eventName)
 Send event to this GUI object (HandleMessage and ScriptEvent) More...
 
InReaction SendMouseEvent (EGUIMessageType type, const CStr &eventName)
 Same as SendEvent, but passes mouse coordinates and button state as an argument. More...
 
CRect GetComputedSize ()
 Updates and returns the size of the object. More...
 
virtual const CStrW & GetTooltipText () const
 
virtual const CStr & GetTooltipStyle () const
 
virtual void ResetStates ()
 Reset internal state of this object. More...
 
void RegisterScriptHandler (const CStr &eventName, const CStr &Code, CGUI &pGUI)
 Set the script handler for a particular object-specific action. More...
 
JSObject * GetJSObject ()
 Retrieves the JSObject representing this GUI object. More...
 
virtual void Tick ()
 Called on every GUI tick unless the object or one of its parent is hidden/ghost. More...
 
template<typename... Args>
void RecurseObject (bool(IGUIObject::*isRestricted)() const, void(IGUIObject::*callbackFunction)(Args... args), Args &&... args)
 Calls an IGUIObject member function recursively on this object and its children. More...
 
CGUIGetGUI ()
 
const CGUIGetGUI () const
 
void SetFocus ()
 Take focus! More...
 
void ReleaseFocus ()
 Release focus. More...
 
- Public Member Functions inherited from IGUITextOwner
 IGUITextOwner (IGUIObject &pObject)
 
virtual ~IGUITextOwner ()
 
CGUITextAddText ()
 Adds a text object. More...
 
CGUITextAddText (const CGUIString &Text, const CStrW &Font, const float &Width, const float &BufferZone)
 Adds a text generated by the given arguments. More...
 
virtual void HandleMessage (SGUIMessage &Message)
 
virtual void UpdateCachedSize ()
 
virtual void DrawText (CCanvas2D &canvas, size_t index, const CGUIColor &color, const CVector2D &pos, const CRect &clipping=CRect())
 Draws the Text. More...
 

Protected Member Functions

void UpdateCachedSize ()
 
virtual void HandleMessage (SGUIMessage &Message)
 
virtual void Draw (CCanvas2D &canvas)
 Draws the Chart. More...
 
virtual CRect GetChartRect () const
 
void UpdateSeries ()
 
void SetupText ()
 Setup texts. More...
 
- Protected Member Functions inherited from IGUIObject
virtual InReaction PreemptEvent (const SDL_Event_ *ev)
 Some objects need to be able to pre-emptively process SDL_Event_. More...
 
virtual InReaction ManuallyHandleKeys (const SDL_Event_ *ev)
 Some objects need to handle the text-related SDL_Event_ manually. More...
 
bool ApplyStyle (const CStr &StyleName)
 Applies the given style to the object. More...
 
virtual float GetBufferedZ () const
 Returns not the Z value, but the actual buffered Z value, i.e. More...
 
void RegisterChild (IGUIObject *child)
 Add an object to the hierarchy. More...
 
void UnregisterChild (IGUIObject *child)
 Remove an object from the hierarchy. More...
 
void SetParent (IGUIObject *pParent)
 Set parent of this object. More...
 
bool IsFocused () const
 Check if object is focused. More...
 
IGUIObjectGetParent () const
 NOTE! This will not just return m_pParent, when that is need use it! There is one exception to it, when the parent is the top-node (the object that isn't a real object), this will return nullptr, so that the top-node's children are seemingly parentless. More...
 
virtual bool HandleAdditionalChildren (const XMBData &file, const XMBElement &child)
 Handle additional children to the <object>-tag. More...
 
virtual void AdditionalChildrenHandled ()
 Allow the GUI object to process after all child items were handled. More...
 
void ScriptEvent (const CStr &eventName)
 Execute the script for a particular action. More...
 
bool ScriptEventWithReturn (const CStr &eventName)
 Execute the script for a particular action. More...
 
void ScriptEvent (const CStr &eventName, const JS::HandleValueArray &paramData)
 Execute the script for a particular action. More...
 
bool ScriptEventWithReturn (const CStr &eventName, const JS::HandleValueArray &paramData)
 Execute the script for a particular action. More...
 
void SetScriptHandler (const CStr &eventName, JS::HandleObject Function)
 Assigns a JS function to the event name. More...
 
void UnsetScriptHandler (const CStr &eventName)
 Deletes an event handler assigned to the given name, if such a handler exists. More...
 
void UpdateMouseOver (IGUIObject *const &pMouseOver)
 Inputes the object that is currently hovered, this function updates this object accordingly (i.e. More...
 
- Protected Member Functions inherited from IGUITextOwner
virtual void SetupText ()=0
 Setup texts. More...
 
virtual void UpdateText ()
 Regenerate the text in case it is invalid. More...
 
void CalculateTextPosition (CRect &ObjSize, CVector2D &TextPos, CGUIText &Text)
 Calculate the position for the text, based on the alignment. More...
 

Protected Attributes

std::vector< CChartDatam_Series
 
CVector2D m_LeftBottom
 
CVector2D m_RightTop
 
std::vector< CVector2Dm_TextPositions
 
bool m_EqualX
 
bool m_EqualY
 
CGUISimpleSetting< CGUIColorm_AxisColor
 
CGUISimpleSetting< float > m_AxisWidth
 
CGUISimpleSetting< float > m_BufferZone
 
CGUISimpleSetting< CStrW > m_Font
 
CGUISimpleSetting< CStrW > m_FormatX
 
CGUISimpleSetting< CStrW > m_FormatY
 
CGUISimpleSetting< CGUIListm_SeriesColor
 
CGUISimpleSetting< CGUISeriesm_SeriesSetting
 
- Protected Attributes inherited from IGUIObject
CRect m_CachedActualSize
 Cached size, real size m_Size is actually dependent on resolution and can have different real outcomes, this is the real outcome cached to avoid slow calculations in real time. More...
 
CStr m_Name
 
std::vector< IGUIObject * > m_Children
 
IGUIObjectm_pParent
 
double m_LastClickTime [6]
 
bool m_MouseHovering
 This variable is true if the mouse is hovering this object and this object is the topmost object shown in this location. More...
 
std::map< CStr, IGUISetting * > m_Settings
 Settings pool, all an object's settings are located here. More...
 
CGUIm_pGUI
 
std::map< CStr, JS::Heap< JSObject * > > m_ScriptHandlers
 
std::unique_ptr< IGUIProxyObjectm_JSObject
 
CGUISimpleSetting< bool > m_Enabled
 
CGUISimpleSetting< bool > m_Hidden
 
CGUISimpleSetting< CGUISizem_Size
 
CGUISimpleSetting< CStr > m_Style
 
CGUIHotkey m_Hotkey
 
CGUISimpleSetting< float > m_Z
 
CGUISimpleSetting< bool > m_Absolute
 
CGUISimpleSetting< bool > m_Ghost
 
CGUISimpleSetting< float > m_AspectRatio
 
CGUISimpleSetting< CStrW > m_Tooltip
 
CGUISimpleSetting< CStr > m_TooltipStyle
 
- Protected Attributes inherited from IGUITextOwner
bool m_GeneratedTextsValid
 Whether the cached text is currently valid (if not then SetupText will be called by Draw) More...
 
std::vector< CGUITextm_GeneratedTexts
 Texts that are generated and ready to be rendered. More...
 
CGUISimpleSetting< EAlignm_TextAlign
 
CGUISimpleSetting< EVAlignm_TextVAlign
 

Private Member Functions

void DrawAxes (CCanvas2D &canvas) const
 
CSize2D AddFormattedValue (const CStrW &format, const float value, const CStrW &font, const float buffer_zone)
 
void UpdateBounds ()
 

Additional Inherited Members

- Static Protected Attributes inherited from IGUIObject
static const CStr EventNameMouseEnter = "MouseEnter"
 
static const CStr EventNameMouseMove = "MouseMove"
 
static const CStr EventNameMouseLeave = "MouseLeave"
 

Detailed Description

Chart for a data visualization as lines or points.

Constructor & Destructor Documentation

◆ CChart()

CChart::CChart ( CGUI pGUI)

◆ ~CChart()

CChart::~CChart ( )
virtual

Member Function Documentation

◆ AddFormattedValue()

CSize2D CChart::AddFormattedValue ( const CStrW &  format,
const float  value,
const CStrW &  font,
const float  buffer_zone 
)
private

◆ Draw()

void CChart::Draw ( CCanvas2D canvas)
protectedvirtual

Draws the Chart.

Implements IGUIObject.

◆ DrawAxes()

void CChart::DrawAxes ( CCanvas2D canvas) const
private

◆ GetChartRect()

CRect CChart::GetChartRect ( ) const
protectedvirtual

◆ HandleMessage()

void CChart::HandleMessage ( SGUIMessage Message)
protectedvirtual
See also
IGUIObject::HandleMessage()

Reimplemented from IGUIObject.

◆ SetupText()

void CChart::SetupText ( )
protectedvirtual

Setup texts.

Functions that sets up all texts when changes have been made.

Implements IGUITextOwner.

◆ UpdateBounds()

void CChart::UpdateBounds ( )
private

◆ UpdateCachedSize()

void CChart::UpdateCachedSize ( )
protectedvirtual
See also
IGUIObject::UpdateCachedSize()

Reimplemented from IGUIObject.

◆ UpdateSeries()

void CChart::UpdateSeries ( )
protected

Member Data Documentation

◆ m_AxisColor

CGUISimpleSetting<CGUIColor> CChart::m_AxisColor
protected

◆ m_AxisWidth

CGUISimpleSetting<float> CChart::m_AxisWidth
protected

◆ m_BufferZone

CGUISimpleSetting<float> CChart::m_BufferZone
protected

◆ m_EqualX

bool CChart::m_EqualX
protected

◆ m_EqualY

bool CChart::m_EqualY
protected

◆ m_Font

CGUISimpleSetting<CStrW> CChart::m_Font
protected

◆ m_FormatX

CGUISimpleSetting<CStrW> CChart::m_FormatX
protected

◆ m_FormatY

CGUISimpleSetting<CStrW> CChart::m_FormatY
protected

◆ m_LeftBottom

CVector2D CChart::m_LeftBottom
protected

◆ m_RightTop

CVector2D CChart::m_RightTop
protected

◆ m_Series

std::vector<CChartData> CChart::m_Series
protected

◆ m_SeriesColor

CGUISimpleSetting<CGUIList> CChart::m_SeriesColor
protected

◆ m_SeriesSetting

CGUISimpleSetting<CGUISeries> CChart::m_SeriesSetting
protected

◆ m_TextPositions

std::vector<CVector2D> CChart::m_TextPositions
protected

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