📄 ceguiitemlistbase.h
字号:
\return
Nothing.
*/
void setAutoResizeEnabled(bool setting);
/*!
\brief
Resize the ItemListBase to exactly fit the content that is attached to it.
Return a Rect object describing, in un-clipped pixels, the window relative area
that is to be used for rendering items.
\return
Nothing
*/
virtual void sizeToContent(void) {sizeToContent_impl();}
/*!
\brief
Triggers a ListContentsChanged event.
These are not fired during initialisation for optimization purposes.
*/
virtual void endInitialisation(void);
/*!
\brief
method called to perform extended laying out of attached child windows.
The system may call this at various times (like when it is resized for
example), and it may be invoked directly where required.
\return
Nothing.
*/
virtual void performChildWindowLayout(void);
/*!
\brief
Return a Rect object describing, in un-clipped pixels, the window relative area
that is to be used for rendering list items.
\return
Rect object describing the window relative area of the that is to be used for rendering
the items.
*/
Rect getItemRenderArea(void) const;
/*!
\brief
Returns a pointer to the window that all items are directed too.
\return
A pointer to the content pane window, or 'this' if children are added
directly to this window.
*/
Window* getContentPane(void) const {return d_pane;}
/*!
\brief
Notify this ItemListBase that the given item was just clicked.
Internal function - NOT to be used from client code.
*/
virtual void notifyItemClicked(ItemEntry* li) {}
/*!
\brief
Notify this ItemListBase that the given item just changed selection state.
Internal function - NOT to be used from client code.
*/
virtual void notifyItemSelectState(ItemEntry* li, bool state) {}
/*!
\brief
Set whether the list should be sorted (by text).
*/
void setSortEnabled(bool setting);
/*!
\brief
Set mode to be used when sorting the list.
\param mode
SortMode enum.
*/
void setSortMode(SortMode mode);
/*!
\brief
Set a user callback as sorting function
\param mode
SortCallback
*/
void setSortCallback(SortCallback cb);
/*!
\brief
Sort the list.
\param relayout
True if the item layout should be redone after the sorting.
False to only sort the internal list. Nothing more.
This parameter defaults to true and should generally not be
used in client code.
*/
void sortList(bool relayout=true);
/*************************************************************************
Construction and Destruction
*************************************************************************/
/*!
\brief
Constructor for ItemListBase base class.
*/
ItemListBase(const String& type, const String& name);
/*!
\brief
Destructor for ItemListBase base class.
*/
virtual ~ItemListBase(void);
protected:
/*************************************************************************
Abstract Implementation Functions (must be provided by derived class)
*************************************************************************/
/*!
\brief
Resize the ItemListBase to exactly fit the content that is attached to it.
Return a Rect object describing, in un-clipped pixels, the window relative area
that is to be used for rendering items.
\return
Nothing
*/
virtual void sizeToContent_impl(void);
/*!
\brief
Returns the Size in unclipped pixels of the content attached to this ItemListBase that is attached to it.
\return
Size object describing in unclipped pixels the size of the content ItemEntries attached to this menu.
*/
virtual Size getContentSize() const = 0;
/*!
\brief
Return a Rect object describing, in un-clipped pixels, the window relative area
that is to be used for rendering list items.
\return
Rect object describing the window relative area of the that is to be used for rendering
the items.
*/
//virtual Rect getItemRenderArea_impl(void) const = 0;
/*!
\brief
Setup size and position for the item widgets attached to this ItemListBase
\return
Nothing.
*/
virtual void layoutItemWidgets() = 0;
/*************************************************************************
Implementation Functions
*************************************************************************/
/*!
\brief
Remove all items from the list.
\note
Note that this will cause items with the 'DestroyedByParent' property set to 'true', to be deleted.
\return
- true if the list contents were changed.
- false if the list contents were not changed (list already empty).
*/
bool resetList_impl(void);
/*!
\brief
Return whether this window was inherited from the given class name at some point in the inheritance hierarchy.
\param class_name
The class name that is to be checked.
\return
true if this window was inherited from \a class_name. false if not.
*/
virtual bool testClassName_impl(const String& class_name) const
{
if (class_name=="ItemListBase") return true;
return Window::testClassName_impl(class_name);
}
// validate window renderer
virtual bool validateWindowRenderer(const String& name) const
{
return (name == EventNamespace);
}
/*!
\brief
Returns the SortCallback that's really going to be used for the sorting operation.
*/
SortCallback getRealSortCallback(void) const;
/*************************************************************************
New event handlers
*************************************************************************/
/*!
\brief
Handler called internally when the list contents are changed
*/
virtual void onListContentsChanged(WindowEventArgs& e);
/*!
\brief
Handler called internally when sorting gets enabled.
*/
virtual void onSortEnabledChanged(WindowEventArgs& e);
/*!
\brief
Handler called internally when the sorting mode is changed.
*/
virtual void onSortModeChanged(WindowEventArgs& e);
/*************************************************************************
Overridden Event handlers
*************************************************************************/
//virtual void onChildRemoved(WindowEventArgs& e);
//virtual void onDestructionStarted(WindowEventArgs& e);
/*************************************************************************
Implementation Data
*************************************************************************/
typedef std::vector<ItemEntry*> ItemEntryList;
ItemEntryList d_listItems; //!< list of items in the list.
//!< True if this ItemListBase widget should automatically resize to fit its content. False if not.
bool d_autoResize;
//!< Pointer to the content pane (for items), 0 if we're not using one
Window* d_pane;
//!< True if this ItemListBase is sorted. False if not.
bool d_sortEnabled;
//!< The current sorting mode applied if sorting is enabled.
SortMode d_sortMode;
//!< The user sort callback or 0 if none.
SortCallback d_sortCallback;
//!< True if the list needs to be resorted.
bool d_resort;
private:
/*************************************************************************
Static Properties for this class
*************************************************************************/
static ItemListBaseProperties::AutoResizeEnabled d_autoResizeEnabledProperty;
static ItemListBaseProperties::SortEnabled d_sortEnabledProperty;
static ItemListBaseProperties::SortMode d_sortModeProperty;
/*************************************************************************
Private methods
*************************************************************************/
void addItemListBaseProperties(void);
/*!
\brief
Add given window to child list at an appropriate position
*/
virtual void addChild_impl(Window* wnd);
/*!
\brief
Handler to manage items being removed from the content pane.
If there is one!
*/
bool handle_PaneChildRemoved(const EventArgs& e);
};
} // End of CEGUI namespace section
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif // end of guard _CEGUIItemListBase_h_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -