#ifndef WXSCONTAINER_H #define WXSCONTAINER_H #include "widget.h" #include class wxsContainer : public wxsWidget { public: wxsContainer(wxsWidgetManager* Manager,wxsWindowRes* Res,bool IsWindow = false,int MaxChildren = -1,BasePropertiesType pType=propNone): wxsWidget(Manager,Res,IsWindow,MaxChildren,pType), DeletingAll(false) {}; virtual ~wxsContainer(); /** Getting number of internal widgets */ virtual int GetChildCount() { return (int)Widgets.size(); } /** Getting pointer to given child */ virtual wxsWidget* GetChild(int Id) { return (Id>=0 && Id<(int)Widgets.size()) ? Widgets[Id] : NULL; } /** Checking if can add child * by default all children are allowed */ virtual bool CanAddChild(wxsWidget* NewWidget,int InsertBeforeThis = -1 ) { return true; } /** Binding child * * \param InsertAfterThis - position where to add new widget, if -1, * adding at the end */ virtual int AddChild(wxsWidget* NewWidget,int InsertBeforeThis = -1); /** Unbinding child * * This structure must inbing child window from this one, must NOT delete * child */ virtual bool DelChildId(int Id); /** Unbinding child * * This structure must inbing child window from this one, must NOT delete * child */ virtual bool DelChild(wxsWidget* Widget); /** Searching for specified widget * \param Widget - widget we're looking for * \param Level - max depth level (0 - unlimited, 1 - direct children only, >1 - children and subchildren) * \return >= 0 if found (when Level == 1, this value is Id of widget, 0<=Id= 0) && (Pos < (int)Extra.size()) ) ? Extra[Pos] : NULL; } /** Function which should be overridden in derived classes - returns * pointer to new extra data */ virtual void* NewExtra() { return NULL; } /** Fuunction which should be overridden in dedrived classes - destroys * previously created extra data */ virtual void DelExtra(void*) { } private: typedef std::vector WidgetsT; typedef WidgetsT::iterator WidgetsI; typedef std::vector ExtraT; typedef ExtraT::iterator ExtraI; WidgetsT Widgets; ExtraT Extra; bool DeletingAll; }; #endif // WXSCONTAINER_H