Crazy Eddie's GUI System  0.8.7
CEGUI::NamedElement Class Reference

Adds name to the Element class, including name path traversal. More...

+ Inheritance diagram for CEGUI::NamedElement:
+ Collaboration diagram for CEGUI::NamedElement:

Public Member Functions

 NamedElement (const String &name="")
 Constructor. More...
 
virtual ~NamedElement ()
 Destructor.
 
virtual void setName (const String &name)
 Renames the element. More...
 
const StringgetName () const
 Return a String object holding the name of this Element.
 
String getNamePath () const
 Return a String object that describes the name path for this Element.
 
bool isChild (const String &name_path) const
 Checks whether given name path references a NamedElement that is attached to this Element. More...
 
bool isChildRecursive (const String &name) const
 returns whether at least one window with the given name is attached to this Window or any of it's children as a child. More...
 
bool isAncestor (const String &name) const
 Return true if the specified element name is a name of some ancestor of this Element. More...
 
NamedElementgetChildElement (const String &name_path) const
 Return the attached child element that the given name path references. More...
 
NamedElementgetChildElementRecursive (const String &name) const
 Find the first child with the given name, recursively and breadth-first. More...
 
void removeChild (const String &name_path)
 Remove the Element referenced by the given name path from this Element's child list. More...
 
- Public Member Functions inherited from CEGUI::Element
 Element ()
 Constructor.
 
virtual ~Element ()
 Destructor.
 
ElementgetParentElement () const
 Retrieves parent of this element. More...
 
virtual void setArea (const UVector2 &pos, const USize &size)
 Set the Element area. More...
 
void setArea (const UDim &xpos, const UDim &ypos, const UDim &width, const UDim &height)
 
void setArea (const URect &area)
 
const URectgetArea () const
 Return the element's area. More...
 
void setPosition (const UVector2 &pos)
 Set the element's position. More...
 
void setXPosition (const UDim &pos)
 
void setYPosition (const UDim &pos)
 
const UVector2getPosition () const
 Get the element's position. More...
 
const UDimgetXPosition () const
 
const UDimgetYPosition () const
 
virtual void setHorizontalAlignment (const HorizontalAlignment alignment)
 Set the horizontal alignment. More...
 
HorizontalAlignment getHorizontalAlignment () const
 Get the horizontal alignment. More...
 
virtual void setVerticalAlignment (const VerticalAlignment alignment)
 Set the vertical alignment. More...
 
VerticalAlignment getVerticalAlignment () const
 Get the vertical alignment. More...
 
void setSize (const USize &size)
 Set the element's size. More...
 
void setWidth (const UDim &width)
 
void setHeight (const UDim &height)
 
USize getSize () const
 Get the element's size. More...
 
UDim getWidth () const
 
UDim getHeight () const
 
void setMinSize (const USize &size)
 Set the element's minimum size. More...
 
const USizegetMinSize () const
 Get the element's minimum size. More...
 
void setMaxSize (const USize &size)
 Set the element's maximum size. More...
 
const USizegetMaxSize () const
 Get the element's maximum size. More...
 
void setAspectMode (const AspectMode mode)
 Sets current aspect mode and recalculates the area rect. More...
 
AspectMode getAspectMode () const
 Retrieves currently used aspect mode. More...
 
void setAspectRatio (const float ratio)
 Sets target aspect ratio. More...
 
float getAspectRatio () const
 Retrieves target aspect ratio. More...
 
void setPixelAligned (const bool setting)
 Sets whether this Element is pixel aligned (both position and size, basically the 4 "corners"). More...
 
bool isPixelAligned () const
 Checks whether this Element is pixel aligned. More...
 
const Vector2fgetPixelPosition () const
 Return the element's absolute (or screen, depending on the type of the element) position in pixels. More...
 
const SizefgetPixelSize () const
 Return the element's size in pixels. More...
 
Sizef calculatePixelSize (bool skipAllPixelAlignment=false) const
 Calculates this element's pixel size. More...
 
Sizef getParentPixelSize (bool skipAllPixelAlignment=false) const
 Return the pixel size of the parent element. More...
 
void setRotation (const Quaternion &rotation)
 sets rotation of this widget More...
 
const QuaterniongetRotation () const
 retrieves rotation of this widget More...
 
void addChild (Element *element)
 Add the specified Element as a child of this Element. More...
 
void removeChild (Element *element)
 Remove the Element Element's child list. More...
 
ElementgetChildElementAtIdx (size_t idx) const
 return a pointer to the child element that is attached to 'this' at the given index. More...
 
size_t getChildCount () const
 Returns number of child elements attached to this Element.
 
bool isChild (const Element *element) const
 Checks whether given element is attached to this Element.
 
bool isAncestor (const Element *element) const
 Checks whether the specified Element is an ancestor of this Element. More...
 
void setNonClient (const bool setting)
 Set whether the Element is non-client. More...
 
bool isNonClient () const
 Checks whether this element was set to be non client. More...
 
const CachedRectfgetUnclippedOuterRect () const
 Return a Rect that describes the unclipped outer rect area of the Element. More...
 
const CachedRectfgetUnclippedInnerRect () const
 Return a Rect that describes the unclipped inner rect area of the Element. More...
 
const CachedRectfgetUnclippedRect (const bool inner) const
 Return a Rect that describes the unclipped area covered by the Element. More...
 
virtual const CachedRectfgetClientChildContentArea () const
 Return a Rect that is used by client child elements as content area. More...
 
virtual const CachedRectfgetNonClientChildContentArea () const
 Return a Rect that is used by client child elements as content area. More...
 
const CachedRectfgetChildContentArea (const bool non_client=false) const
 Return a Rect that is used to position and size child elements. More...
 
virtual void notifyScreenAreaChanged (bool recursive=true)
 Inform the element and (optionally) all children that screen area has changed. More...
 
virtual const SizefgetRootContainerSize () const
 Return the size of the root container (such as screen size). More...
 
- Public Member Functions inherited from CEGUI::PropertySet
 PropertySet (void)
 Constructs a new PropertySet object.
 
virtual ~PropertySet (void)
 Destructor for PropertySet objects.
 
void addProperty (Property *property)
 Adds a new Property to the PropertySet. More...
 
void removeProperty (const String &name)
 Removes a Property from the PropertySet. More...
 
PropertygetPropertyInstance (const String &name) const
 Retrieves a property instance (that was previously added) More...
 
void clearProperties (void)
 Removes all Property objects from the PropertySet.
 
bool isPropertyPresent (const String &name) const
 Checks to see if a Property with the given name is in the PropertySet. More...
 
const StringgetPropertyHelp (const String &name) const
 Return the help text for the specified Property. More...
 
String getProperty (const String &name) const
 Gets the current value of the specified Property. More...
 
template<typename T >
PropertyHelper< T >::return_type getProperty (const String &name) const
 Gets the current value of the specified Property. More...
 
void setProperty (const String &name, const String &value)
 Sets the current value of a Property. More...
 
template<typename T >
void setProperty (const String &name, typename PropertyHelper< T >::pass_type value)
 Sets the current value of a Property. More...
 
bool isPropertyDefault (const String &name) const
 Returns whether a Property is at it's default value. More...
 
String getPropertyDefault (const String &name) const
 Returns the default value of a Property as a String. More...
 
PropertyIterator getPropertyIterator (void) const
 Return a PropertySet::PropertyIterator object to iterate over the available Properties.
 
- Public Member Functions inherited from CEGUI::EventSet
 EventSet ()
 Constructor for EventSet objects.
 
virtual ~EventSet (void)
 Destructor for EventSet objects.
 
void addEvent (const String &name)
 Creates a new Event object with the given name and adds it to the EventSet. More...
 
void addEvent (Event &event)
 Adds the given Event object to the EventSet. Ownership of the object passes to EventSet and it will be deleted when it is removed from the EventSet - whether explicitly via removeEvent or when the EventSet is destroyed. More...
 
void removeEvent (const String &name)
 Removes the Event with the given name. All connections to the event are disconnected, and the underlying Event object is destroyed. More...
 
void removeEvent (Event &event)
 Removes the given event from the EventSet. All connections to the event are disconnected, and the event object is destroyed. More...
 
void removeAllEvents (void)
 Remove all Event objects from the EventSet. Add connections will be disconnected, and all Event objects destroyed.
 
bool isEventPresent (const String &name)
 Checks to see if an Event with the given name is present in this EventSet. More...
 
virtual Event::Connection subscribeEvent (const String &name, Event::Subscriber subscriber)
 Subscribes a handler to the named Event. If the named Event is not yet present in the EventSet, it is created and added. More...
 
virtual Event::Connection subscribeEvent (const String &name, Event::Group group, Event::Subscriber subscriber)
 Subscribes a handler to the specified group of the named Event. If the named Event is not yet present in the EventSet, it is created and added. More...
 
template<typename Arg1 , typename Arg2 >
Event::Connection subscribeEvent (const String &name, Arg1 arg1, Arg2 arg2)
 Subscribes a handler to the named Event. If the named Event is not yet present in the EventSet, it is created and added. More...
 
template<typename Arg1 , typename Arg2 >
Event::Connection subscribeEvent (const String &name, Event::Group group, Arg1 arg1, Arg2 arg2)
 Subscribes a handler to the named Event. If the named Event is not yet present in the EventSet, it is created and added. More...
 
virtual Event::Connection subscribeScriptedEvent (const String &name, const String &subscriber_name)
 Subscribes the named Event to a scripted funtion. More...
 
virtual Event::Connection subscribeScriptedEvent (const String &name, Event::Group group, const String &subscriber_name)
 Subscribes the specified group of the named Event to a scripted funtion. More...
 
virtual void fireEvent (const String &name, EventArgs &args, const String &eventNamespace="")
 Fires the named event passing the given EventArgs object. More...
 
bool isMuted (void) const
 Return whether the EventSet is muted or not. More...
 
void setMutedState (bool setting)
 Set the mute state for this EventSet. More...
 
EventgetEventObject (const String &name, bool autoAdd=false)
 Return a pointer to the Event object with the given name, optionally adding such an Event object to the EventSet if it does not already exist. More...
 
EventIterator getEventIterator (void) const
 Return a EventSet::EventIterator object to iterate over the events currently added to the EventSet.
 

Static Public Attributes

static const String EventNamespace
 Namespace for global events.
 
static const String EventNameChanged
 
- Static Public Attributes inherited from CEGUI::Element
static const String EventNamespace
 Namespace for global events.
 
static const String EventSized
 
static const String EventParentSized
 
static const String EventMoved
 
static const String EventHorizontalAlignmentChanged
 
static const String EventVerticalAlignmentChanged
 
static const String EventRotated
 
static const String EventChildAdded
 
static const String EventChildRemoved
 
static const String EventZOrderChanged
 
static const String EventNonClientChanged
 

Protected Member Functions

virtual void addChild_impl (Element *element)
 Add given element to child list at an appropriate position. More...
 
virtual NamedElementgetChildByNamePath_impl (const String &name_path) const
 Retrieves a child at name_path or 0 if none such exists.
 
virtual NamedElementgetChildByNameRecursive_impl (const String &name) const
 Finds a child by name or 0 if none such exists.
 
void addNamedElementProperties ()
 Add standard CEGUI::NamedElement properties.
 
virtual void onNameChanged (NamedElementEventArgs &e)
 Handler called when the element's name changes. More...
 
- Protected Member Functions inherited from CEGUI::Element
void addElementProperties ()
 Add standard CEGUI::Element properties.
 
virtual void setArea_impl (const UVector2 &pos, const USize &size, bool topLeftSizing=false, bool fireEvents=true)
 Implementation method to modify element area while correctly applying min / max size processing, and firing any appropriate events. More...
 
bool isInnerRectSizeChanged () const
 helper to return whether the inner rect size has changed
 
virtual void setParent (Element *parent)
 Set the parent element for this element object. More...
 
virtual void removeChild_impl (Element *element)
 Remove given element from child list.
 
virtual Rectf getUnclippedOuterRect_impl (bool skipAllPixelAlignment) const
 Default implementation of function to return Element's outer rect area.
 
virtual Rectf getUnclippedInnerRect_impl (bool skipAllPixelAlignment) const
 Default implementation of function to return Element's inner rect area.
 
void fireAreaChangeEvents (const bool moved, const bool sized)
 helper to fire events based on changes to area rect
 
void notifyChildrenOfSizeChange (const bool non_client, const bool client)
 
virtual void onSized (ElementEventArgs &e)
 Handler called when the element's size changes. More...
 
virtual void onParentSized (ElementEventArgs &e)
 Handler called when this element's parent element has been resized. If this element is the root / GUI Sheet element, this call will be made when the display size changes. More...
 
virtual void onMoved (ElementEventArgs &e)
 Handler called when the element's position changes. More...
 
virtual void onHorizontalAlignmentChanged (ElementEventArgs &e)
 Handler called when the horizontal alignment setting for the element is changed. More...
 
virtual void onVerticalAlignmentChanged (ElementEventArgs &e)
 Handler called when the vertical alignment setting for the element is changed. More...
 
virtual void onRotated (ElementEventArgs &e)
 Handler called when the element's rotation is changed. More...
 
virtual void onChildAdded (ElementEventArgs &e)
 Handler called when a child element is added to this element. More...
 
virtual void onChildRemoved (ElementEventArgs &e)
 Handler called when a child element is removed from this element. More...
 
virtual void onNonClientChanged (ElementEventArgs &e)
 Handler called when the element's non-client setting, affecting it's position and size relative to it's parent is changed. More...
 
- Protected Member Functions inherited from CEGUI::EventSet
void fireEvent_impl (const String &name, EventArgs &args)
 Implementation event firing member.
 
ScriptModulegetScriptModule () const
 Helper to return the script module pointer or throw.
 
 EventSet (EventSet &)
 
 EventSet (const EventSet &)
 
EventSetoperator= (EventSet &)
 
EventSetoperator= (const EventSet &)
 

Protected Attributes

String d_name
 The name of the element, unique in the parent of this element.
 
- Protected Attributes inherited from CEGUI::Element
ChildList d_children
 The list of child element objects attached to this.
 
Elementd_parent
 Holds pointer to the parent element.
 
bool d_nonClient
 true if element is in non-client (outside InnerRect) area of parent.
 
URect d_area
 This element objects area as defined by a URect.
 
HorizontalAlignment d_horizontalAlignment
 Specifies the base for horizontal alignment.
 
VerticalAlignment d_verticalAlignment
 Specifies the base for vertical alignment.
 
USize d_minSize
 current minimum size for the element.
 
USize d_maxSize
 current maximum size for the element.
 
AspectMode d_aspectMode
 How to satisfy current aspect ratio.
 
float d_aspectRatio
 The target aspect ratio.
 
bool d_pixelAligned
 If true, the position and size are pixel aligned.
 
Sizef d_pixelSize
 Current constrained pixel size of the element.
 
Quaternion d_rotation
 Rotation of this element (relative to the parent)
 
CachedRectf d_unclippedOuterRect
 outer area rect in screen pixels
 
CachedRectf d_unclippedInnerRect
 inner area rect in screen pixels
 
- Protected Attributes inherited from CEGUI::EventSet
EventMap d_events
 
bool d_muted
 true if events for this EventSet have been muted.
 

Additional Inherited Members

- Public Types inherited from CEGUI::PropertySet
typedef ConstMapIterator< PropertyRegistry > PropertyIterator
 
- Public Types inherited from CEGUI::EventSet
typedef ConstMapIterator< EventMap > EventIterator
 
- Protected Types inherited from CEGUI::Element
typedef std::vector< Element *CEGUI_VECTOR_ALLOC(Element *)> ChildList
 definition of type used for the list of attached child elements.
 
- Protected Types inherited from CEGUI::EventSet
typedef std::map< String, Event *, StringFastLessCompare CEGUI_MAP_ALLOC(String, Event *)> EventMap
 

Detailed Description

Adds name to the Element class, including name path traversal.

Name path
A name path is a string that describes a path down the element hierarchy using names and the forward slash '/' as a separator. For example, if this element has a child attached to it named "Panel" which has its own children attached named "Okay" and "Cancel", you can check for the element "Okay" from this element by using the name path "Panel/Okay". To check for "Panel", you would simply pass the name "Panel".
See also
Element

Constructor & Destructor Documentation

CEGUI::NamedElement::NamedElement ( const String name = "")

Constructor.

Parameters
nameThe initial name this element will have

Member Function Documentation

virtual void CEGUI::NamedElement::addChild_impl ( Element element)
protectedvirtual

Add given element to child list at an appropriate position.

Reimplemented from CEGUI::Element.

Reimplemented in CEGUI::Window, CEGUI::ScrollablePane, CEGUI::TabControl, CEGUI::GridLayoutContainer, CEGUI::LayoutContainer, CEGUI::LayoutCell, and CEGUI::GroupBox.

NamedElement* CEGUI::NamedElement::getChildElement ( const String name_path) const

Return the attached child element that the given name path references.

Parameters
name_pathString object holding the name path of the child element to return.
Returns
the NamedElement object referenced by name_path.
Exceptions
UnknownObjectExceptionthrown if name_path does not reference an Element attached to this Element.
NamedElement* CEGUI::NamedElement::getChildElementRecursive ( const String name) const

Find the first child with the given name, recursively and breadth-first.

Parameters
nameString object holding the name of the child element to find.
Returns
Pointer to the (first) Element object attached to this Element that has the name name
bool CEGUI::NamedElement::isAncestor ( const String name) const

Return true if the specified element name is a name of some ancestor of this Element.

Parameters
nameString object holding the name to check for.
Returns
  • true if an element named name is an ancestor (parent, or parent of parent, etc) of this element.
  • false if an element named name is in no way an ancestor of this element.
bool CEGUI::NamedElement::isChild ( const String name_path) const

Checks whether given name path references a NamedElement that is attached to this Element.

Parameters
name_pathString object holding the name path of the child element to test.
Returns
  • true if the element referenced by name_path is attached.
  • false if the element referenced by name_path is not attached.
bool CEGUI::NamedElement::isChildRecursive ( const String name) const

returns whether at least one window with the given name is attached to this Window or any of it's children as a child.

Note
WARNING! This function can be very expensive and should only be used when you have no other option available. If you decide to use it anyway, make sure the window hierarchy from the entry point is small.
Parameters
IDuint ID code to look for.
Returns
  • true if at least one child window was found with the name name
    • false if no child window was found with the name name.
virtual void CEGUI::NamedElement::onNameChanged ( NamedElementEventArgs e)
protectedvirtual

Handler called when the element's name changes.

Parameters
eNamedElementEventArgs object whose 'element' pointer field is set to the element that triggered the event. For this event the trigger element is always 'this'.
void CEGUI::NamedElement::removeChild ( const String name_path)

Remove the Element referenced by the given name path from this Element's child list.

Parameters
name_pathString the name path that references the the Element to be removed. If the Element specified is not attached to this Window, UnknownObjectException is thrown
virtual void CEGUI::NamedElement::setName ( const String name)
virtual

Renames the element.

Parameters
nameString object holding the new name for the element.
Exceptions
AlreadyExistsExceptionthrown if an element named name already exists in the parent of this element.

Member Data Documentation

const String CEGUI::NamedElement::EventNameChanged
static

Event fired when the Element name has changed. Handlers are passed a const NamedElementEventArgs reference with NamedElementEventArgs::element set to the Element whose name was changed.