Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CDropDown Class Reference

Drop Down. More...

#include <CDropDown.h>

Inheritance diagram for CDropDown:
Collaboration diagram for CDropDown:

Public Member Functions

 CDropDown (CGUI &pGUI)
 
virtual void HandleMessage (SGUIMessage &Message)
 
virtual Input::Reaction ManuallyHandleKeys (const SDL_Event &ev)
 Handle events manually to catch keyboard inputting. More...
 
virtual void Draw (CCanvas2D &canvas)
 Draws the Button. More...
 
virtual void CreateJSObject ()
 Creates the JS object representing this page upon first use. More...
 
virtual bool IsMouseOver () const
 This function checks if the mouse is hovering the rectangle that the base setting "size" makes. More...
 
virtual float GetBufferedZ () const
 Returns not the Z value, but the actual buffered Z value, i.e. More...
 
virtual CSize2D GetPreferredHeaderTextSize () const
 Calculate the preferred text size of the currently selected item displayed in the header. More...
 
- Public Member Functions inherited from CList
 CList (CGUI &pGUI)
 
virtual void ResetStates ()
 
virtual void HandleSizeChanged ()
 
virtual void AddItem (const CGUIString &str, const CGUIString &data)
 Adds an item last to the list. More...
 
void AddItem (const CGUIString &strAndData)
 Add an item where both parameters are identical. More...
 
- 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 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...
 
virtual const std::vector< IGUIObject * > & GetVisibleChildren () const
 
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...
 
- Public Member Functions inherited from IGUITextOwner
 IGUITextOwner (IGUIObject &pObject)
 
virtual ~IGUITextOwner ()
 
CGUIText & AddText ()
 Adds a text object. More...
 
CGUIText & AddText (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 HandleSizeChanged ()
 
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

virtual void HandleSizeChanged ()
 If the size changed, the texts have to be updated as the word wrapping depends on the size. More...
 
void SetupText ()
 Sets up text, should be called every time changes has been made that can change the visual. More...
 
virtual void SetupListRect ()
 
virtual CRect GetListRect () const
 
- Protected Member Functions inherited from CList
virtual void SetupText ()
 Sets up text, should be called every time changes has been made that can change the visual. More...
 
virtual void SetupText (bool append)
 
virtual void HandleMessage (SGUIMessage &Message)
 
virtual Input::Reaction ManuallyHandleKeys (const SDL_Event &ev)
 Handle events manually to catch keyboard inputting. More...
 
virtual void Draw (CCanvas2D &canvas)
 Draws the List box. More...
 
virtual void CreateJSObject ()
 Creates the JS object representing this page upon first use. More...
 
virtual void SelectNextElement ()
 Easy select elements functions. More...
 
virtual void SelectPrevElement ()
 
virtual void SelectFirstElement ()
 
virtual void SelectLastElement ()
 
virtual bool HandleAdditionalChildren (const XMBData &xmb, const XMBElement &child)
 Handle the <item> tag. More...
 
void UpdateAutoScroll ()
 
virtual void DrawList (CCanvas2D &canvas, const int &selected, const CGUISpriteInstance &sprite, const CGUISpriteInstance &spriteOverlay, const CGUISpriteInstance &spriteSelectArea, const CGUISpriteInstance &spriteSelectAreaOverlay, const CGUIColor &textColor)
 
virtual CRect GetListRect () const
 
virtual bool GetModified () const
 
virtual int GetHoveredItem ()
 
- 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...
 
bool ApplyStyle (const CStr &StyleName)
 Applies the given style to the object. 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 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...
 
virtual void RecalculateActualSize () const
 Recompute the actual (absolute) size from scratch again and cache it. 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 (const CRect &ObjSize, CVector2D &TextPos, CGUIText &Text)
 Calculate the position for the text, based on the alignment. More...
 

Protected Attributes

CVector2D m_TextPos
 Placement of text. More...
 
bool m_Open
 
CRect m_CachedListRect
 
bool m_HideScrollBar
 
int m_ElementHighlight
 
std::string m_InputBuffer
 
double m_TimeOfLastInput
 
CGUISimpleSetting< float > m_ButtonWidth
 
CGUISimpleSetting< float > m_DropDownSize
 
CGUISimpleSetting< float > m_DropDownBuffer
 
CGUISimpleSetting< std::uint32_t > m_MinimumVisibleItems
 
CGUISimpleSetting< CStrW > m_SoundClosed
 
CGUISimpleSetting< CStrW > m_SoundEnter
 
CGUISimpleSetting< CStrW > m_SoundLeave
 
CGUISimpleSetting< CStrW > m_SoundOpened
 
CGUISimpleSetting< CGUISpriteInstance > m_SpriteDisabled
 
CGUISimpleSetting< CGUISpriteInstance > m_SpriteOverlayDisabled
 
CGUISimpleSetting< CGUISpriteInstance > m_SpriteList
 
CGUISimpleSetting< CGUISpriteInstance > m_SpriteListOverlay
 
CGUISimpleSetting< CGUISpriteInstance > m_Sprite2
 
CGUISimpleSetting< CGUISpriteInstance > m_Sprite2Over
 
CGUISimpleSetting< CGUISpriteInstance > m_Sprite2Pressed
 
CGUISimpleSetting< CGUISpriteInstance > m_Sprite2Disabled
 
CGUISimpleSetting< CGUIColor > m_TextColorDisabled
 
- Protected Attributes inherited from CList
std::vector< float > m_ItemsYPositions
 List of each element's relative y position. More...
 
CGUISimpleSetting< float > m_BufferZone
 
CGUISimpleSetting< CStrW > m_Font
 
CGUISimpleSetting< bool > m_ScrollBar
 
CGUISimpleSetting< CStr > m_ScrollBarStyle
 
CGUISimpleSetting< bool > m_ScrollBottom
 
CGUISimpleSetting< CStrW > m_SoundDisabled
 
CGUISimpleSetting< CStrW > m_SoundSelected
 
CGUISimpleSetting< CGUISpriteInstance > m_Sprite
 
CGUISimpleSetting< CGUISpriteInstance > m_SpriteOverlay
 
CGUISimpleSetting< CGUISpriteInstance > m_SpriteSelectArea
 
CGUISimpleSetting< CGUISpriteInstance > m_SpriteSelectAreaOverlay
 
CGUISimpleSetting< CGUIColor > m_TextColor
 
CGUISimpleSetting< CGUIColor > m_TextColorSelected
 
CGUISimpleSetting< std::int32_t > m_Selected
 
CGUISimpleSetting< bool > m_AutoScroll
 
CGUISimpleSetting< std::int32_t > m_Hovered
 
CGUISimpleSetting< CGUIList > m_List
 
CGUISimpleSetting< CGUIList > m_ListData
 
- 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...
 
- 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< CGUIText > m_GeneratedTexts
 Texts that are generated and ready to be rendered. More...
 
CGUISimpleSetting< EAlign > m_TextAlign
 
CGUISimpleSetting< EVAlign > m_TextVAlign
 

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

Drop Down.

The control can be pressed, but we will not inherent this behavior from IGUIButtonBehavior, because when you press this control, the list with elements will immediately appear, and not first after release (which is the whole gist of the IGUIButtonBehavior).

Constructor & Destructor Documentation

◆ CDropDown()

CDropDown::CDropDown ( CGUI &  pGUI)

Member Function Documentation

◆ CreateJSObject()

virtual void CDropDown::CreateJSObject ( )
virtual

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 CList.

◆ Draw()

void CDropDown::Draw ( CCanvas2D &  canvas)
virtual

Draws the Button.

Reimplemented from CList.

◆ GetBufferedZ()

float CDropDown::GetBufferedZ ( ) const
virtual

Returns not the Z value, but the actual buffered Z value, i.e.

if it's defined relative, then it will check its parent's Z value and add the relativity.

Returns
Actual Z value on the screen.

Reimplemented from IGUIObject.

◆ GetListRect()

CRect CDropDown::GetListRect ( ) const
protectedvirtual

Reimplemented from CList.

◆ GetPreferredHeaderTextSize()

CSize2D CDropDown::GetPreferredHeaderTextSize ( ) const
virtual

Calculate the preferred text size of the currently selected item displayed in the header.

◆ HandleMessage()

void CDropDown::HandleMessage ( SGUIMessage &  Message)
virtual
See also
IGUIObject::HandleMessage()

Reimplemented from CList.

◆ HandleSizeChanged()

void CDropDown::HandleSizeChanged ( )
protectedvirtual

If the size changed, the texts have to be updated as the word wrapping depends on the size.

Reimplemented from CList.

◆ IsMouseOver()

bool CDropDown::IsMouseOver ( ) const
virtual

This function checks if the mouse is hovering the rectangle that the base setting "size" makes.

Although it is virtual, so one could derive an object from CButton, which changes only this to checking the circle that "size" makes.

This function also returns true if there is a different GUI object shown on top of this one.

Reimplemented from IGUIObject.

◆ ManuallyHandleKeys()

Input::Reaction CDropDown::ManuallyHandleKeys ( const SDL_Event &  ev)
virtual

Handle events manually to catch keyboard inputting.

Reimplemented from CList.

◆ SetupListRect()

void CDropDown::SetupListRect ( )
protectedvirtual

◆ SetupText()

void CDropDown::SetupText ( )
protectedvirtual

Sets up text, should be called every time changes has been made that can change the visual.

Reimplemented from CList.

Member Data Documentation

◆ m_ButtonWidth

CGUISimpleSetting<float> CDropDown::m_ButtonWidth
protected

◆ m_CachedListRect

CRect CDropDown::m_CachedListRect
protected

◆ m_DropDownBuffer

CGUISimpleSetting<float> CDropDown::m_DropDownBuffer
protected

◆ m_DropDownSize

CGUISimpleSetting<float> CDropDown::m_DropDownSize
protected

◆ m_ElementHighlight

int CDropDown::m_ElementHighlight
protected

◆ m_HideScrollBar

bool CDropDown::m_HideScrollBar
protected

◆ m_InputBuffer

std::string CDropDown::m_InputBuffer
protected

◆ m_MinimumVisibleItems

CGUISimpleSetting<std::uint32_t> CDropDown::m_MinimumVisibleItems
protected

◆ m_Open

bool CDropDown::m_Open
protected

◆ m_SoundClosed

CGUISimpleSetting<CStrW> CDropDown::m_SoundClosed
protected

◆ m_SoundEnter

CGUISimpleSetting<CStrW> CDropDown::m_SoundEnter
protected

◆ m_SoundLeave

CGUISimpleSetting<CStrW> CDropDown::m_SoundLeave
protected

◆ m_SoundOpened

CGUISimpleSetting<CStrW> CDropDown::m_SoundOpened
protected

◆ m_Sprite2

CGUISimpleSetting<CGUISpriteInstance> CDropDown::m_Sprite2
protected

◆ m_Sprite2Disabled

CGUISimpleSetting<CGUISpriteInstance> CDropDown::m_Sprite2Disabled
protected

◆ m_Sprite2Over

CGUISimpleSetting<CGUISpriteInstance> CDropDown::m_Sprite2Over
protected

◆ m_Sprite2Pressed

CGUISimpleSetting<CGUISpriteInstance> CDropDown::m_Sprite2Pressed
protected

◆ m_SpriteDisabled

CGUISimpleSetting<CGUISpriteInstance> CDropDown::m_SpriteDisabled
protected

◆ m_SpriteList

CGUISimpleSetting<CGUISpriteInstance> CDropDown::m_SpriteList
protected

◆ m_SpriteListOverlay

CGUISimpleSetting<CGUISpriteInstance> CDropDown::m_SpriteListOverlay
protected

◆ m_SpriteOverlayDisabled

CGUISimpleSetting<CGUISpriteInstance> CDropDown::m_SpriteOverlayDisabled
protected

◆ m_TextColorDisabled

CGUISimpleSetting<CGUIColor> CDropDown::m_TextColorDisabled
protected

◆ m_TextPos

CVector2D CDropDown::m_TextPos
protected

Placement of text.

◆ m_TimeOfLastInput

double CDropDown::m_TimeOfLastInput
protected

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