1 // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 // This file is part of the "Irrlicht Engine". 3 // For conditions of distribution and use, see copyright notice in irrlicht.h 4 5 #ifndef __C_GUIEDIT_FACTORY_H_INCLUDED__ 6 #define __C_GUIEDIT_FACTORY_H_INCLUDED__ 7 8 #include "IGUIElementFactory.h" 9 10 namespace irr 11 { 12 namespace gui 13 { 14 class IGUIElement; 15 class IGUIEnvironment; 16 17 //! Interface making it possible to dynamicly create gui elements 18 class CGUIEditFactory : public IGUIElementFactory 19 { 20 public: 21 22 CGUIEditFactory(IGUIEnvironment* env); 23 ~CGUIEditFactory(); 24 25 //! adds a GUI element to the GUI Environment based on its type name 26 /** \param typeName: Type name of the element to add. 27 \param parent: Parent scene node of the new element, can be null to add it to the root. 28 \return Returns pointer to the new element or null if not successful. */ 29 virtual IGUIElement* addGUIElement(const c8* typeName, IGUIElement* parent=0); 30 31 //! returns amount of GUI element types this factory is able to create 32 virtual s32 getCreatableGUIElementTypeCount() const; 33 34 //! returns type name of a createable GUI element type by index 35 /** \param idx: Index of the type in this factory. Must be a value between 0 and 36 getCreatableGUIElementTypeCount() */ 37 virtual const c8* getCreateableGUIElementTypeName(s32 idx) const; 38 39 // not used: getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type)40 virtual const c8* getCreateableGUIElementTypeName(EGUI_ELEMENT_TYPE type) const {return 0;} ; getCreateableGUIElementType(s32 idx)41 virtual EGUI_ELEMENT_TYPE getCreateableGUIElementType(s32 idx) const { return EGUIET_ELEMENT;}; 42 virtual IGUIElement* addGUIElement(EGUI_ELEMENT_TYPE type, IGUIElement* parent=0) {return 0;}; 43 private: 44 45 IGUIEnvironment* Environment; 46 }; 47 48 49 } // end namespace scene 50 } // end namespace irr 51 52 #endif 53 54