Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CScrollPanel Class Reference

#include <CScrollPanel.h>

Inheritance diagram for CScrollPanel:
Collaboration diagram for CScrollPanel:

Public Member Functions

 CScrollPanel (CGUI &pGUI)
 
virtual void ResetStates ()
 
void ResetScrollPosition (EScrollOrientation orientation=EScrollOrientation::BOTH)
 
- Public Member Functions inherited from IGUIPanel
 IGUIPanel (CGUI &pGUI)
 
virtual ~IGUIPanel ()
 
virtual bool IsMouseOver () const
 This function checks if the mouse is hovering the rectangle that the base setting "size" makes. More...
 
virtual const std::vector< IGUIObject * > & GetVisibleChildren () const
 
- Public Member Functions inherited from IGUIObject
 NONCOPYABLE (IGUIObject)
 
 IGUIObject (IGUIObject &&)=delete
 
IGUIObject & operator= (IGUIObject &&)=delete
 
 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...
 
Input::Reaction SendEvent (EGUIMessageType type, const CStr &eventName)
 Send event to this GUI object (HandleMessage and ScriptEvent) More...
 
Input::Reaction SendMouseEvent (EGUIMessageType type, const CStr &eventName)
 Same as SendEvent, but passes mouse coordinates and button state as an argument. More...
 
virtual void HandleSizeChanged ()
 All sizes are relative to resolution, and the calculation is not wanted in real time, therefore it is cached, update the cached size with this function. More...
 
virtual const CRect & GetActualSize () const
 Get the size of the object. More...
 
virtual const CStrW & GetTooltipText () const
 
virtual const CStr & GetTooltipStyle () const
 
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...
 
void SetIsInsideBoundaries (bool &isInsideBoundaries)
 
bool IsHiddenOrGhostOrOutOfBoundaries () const
 
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...
 
virtual void DrawInArea (CCanvas2D &canvas, CRect &area)
 
CGUI & GetGUI ()
 
const CGUI & GetGUI () const
 
void SetFocus ()
 Take focus! More...
 
void ReleaseFocus ()
 Release focus. More...
 
- Public Member Functions inherited from IGUIScrollBarOwner
 IGUIScrollBarOwner (IGUIObject &m_pObject)
 
virtual ~IGUIScrollBarOwner ()
 
virtual void Draw (CCanvas2D &canvas)
 
virtual void HandleMessage (SGUIMessage &Message)
 
virtual void ResetStates ()
 
virtual const SGUIScrollBarStyle * GetScrollBarStyle (const CStr8 &style) const
 Interface for the m_ScrollBar to use. More...
 
virtual void AddScrollBar (std::unique_ptr< IGUIScrollBar > scrollbar)
 Add a scroll-bar. More...
 
virtual IGUIScrollBar & GetScrollBar (const int &index) const
 Get Scroll Bar reference (it should be transparent it's actually pointers). More...
 
virtual float GetScrollBarPos (const int index) const
 Get the position of the scroll bar at. More...
 

Protected Member Functions

virtual void HandleMessage (SGUIMessage &Message)
 
virtual void RecalculateActualSize () const
 Recompute the actual (absolute) size from scratch again and cache it. More...
 
void UpdateScrollBars ()
 
bool HasHorizontalScrollBar () const
 
bool HasVerticalScrollBar () const
 
virtual void Draw (CCanvas2D &canvas)
 
virtual void CreateJSObject ()
 Creates the JS object representing this page upon first use. More...
 
virtual void RecalculateActualSize () const
 Recompute the actual (absolute) size from scratch again and cache it. More...
 
- Protected Member Functions inherited from IGUIObject
virtual Input::Reaction PreemptEvent (const SDL_Event &)
 Some objects need to be able to pre-emptively process SDL_Event. More...
 
virtual Input::Reaction ManuallyHandleKeys (const SDL_Event &)
 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...
 
IGUIObject * GetParent () 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 &, const XMBElement &)
 Handle additional children to the <object>-tag. More...
 
virtual void AdditionalChildrenHandled ()
 Allow the GUI object to process after all child items were handled. More...
 
bool ScriptEvent (const CStr &eventName, const JS::HandleValueArray &paramData=JS::HandleValueArray::empty())
 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 Attributes

CGUISimpleSetting< EScrollOrientation > m_Orientation
 
CGUISimpleSetting< CStr > m_ScrollBarStyle
 
CGUISimpleSetting< int > m_MinWidth
 
CGUISimpleSetting< int > m_MinHeight
 
- Protected Attributes inherited from IGUIPanel
CRect m_CachedLayoutActualSize
 
bool m_Drawing = false
 
- Protected Attributes inherited from IGUIObject
CStr m_Name
 
std::vector< IGUIObject * > m_Children
 
IGUIObject * m_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...
 
CGUI & m_pGUI
 
std::map< CStr, JS::Heap< JSObject * > > m_ScriptHandlers
 
std::unique_ptr< IGUIProxyObject > m_JSObject
 
CRect m_VisibleArea
 
bool m_IsInsideBoundaries = true
 
CRect m_CachedActualSize
 The actual size (usually) depends on the size of the parent. More...
 
bool m_CachedActualSizeDirty = true
 Whether m_CacheActualSize is not up-to-date and will have to be recomputed when accessing it the next time. More...
 
CGUISimpleSetting< bool > m_Enabled
 
CGUISimpleSetting< bool > m_Hidden
 
CGUISimpleSetting< CGUISize > m_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 IGUIScrollBarOwner
std::vector< std::unique_ptr< IGUIScrollBar > > m_ScrollBars
 Predominately you will only have one, but you can have as many as you like. More...
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ CScrollPanel()

CScrollPanel::CScrollPanel ( CGUI &  pGUI)

Member Function Documentation

◆ CreateJSObject()

virtual void CScrollPanel::CreateJSObject ( )
protectedvirtual

Creates the JS object representing this page upon first use.

This function (and its derived versions) are defined in the GUIProxy implementation file for convenience.

Reimplemented from IGUIObject.

◆ Draw()

void CScrollPanel::Draw ( CCanvas2D &  canvas)
protectedvirtual

Reimplemented from IGUIScrollBarOwner.

◆ HandleMessage()

void CScrollPanel::HandleMessage ( SGUIMessage &  Message)
protectedvirtual
See also
IGUIObject::HandleMessage()

Reimplemented from IGUIScrollBarOwner.

◆ HasHorizontalScrollBar()

bool CScrollPanel::HasHorizontalScrollBar ( ) const
inlineprotected

◆ HasVerticalScrollBar()

bool CScrollPanel::HasVerticalScrollBar ( ) const
inlineprotected

◆ RecalculateActualSize()

void CScrollPanel::RecalculateActualSize ( ) const
protectedvirtual

Recompute the actual (absolute) size from scratch again and cache it.

Reimplemented from IGUIPanel.

◆ ResetScrollPosition()

void CScrollPanel::ResetScrollPosition ( EScrollOrientation  orientation = EScrollOrientation::BOTH)

◆ ResetStates()

void CScrollPanel::ResetStates ( )
virtual
See also
IGUIObject::ResetStates()

Reimplemented from IGUIScrollBarOwner.

◆ UpdateScrollBars()

void CScrollPanel::UpdateScrollBars ( )
protected

Member Data Documentation

◆ m_MinHeight

CGUISimpleSetting<int> CScrollPanel::m_MinHeight
protected

◆ m_MinWidth

CGUISimpleSetting<int> CScrollPanel::m_MinWidth
protected

◆ m_Orientation

CGUISimpleSetting<EScrollOrientation> CScrollPanel::m_Orientation
protected

◆ m_ScrollBarStyle

CGUISimpleSetting<CStr> CScrollPanel::m_ScrollBarStyle
protected

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