1 /* 2 This is a custom editor for stubbing problematic elements out, 3 for example elements which include modal screens 4 */ 5 6 #ifndef __C_GUI_DUMMY_EDITOR_STUB_H_INCLUDED__ 7 #define __C_GUI_DUMMY_EDITOR_STUB_H_INCLUDED__ 8 9 #include "IGUIElement.h" 10 #include "IGUIEnvironment.h" 11 #include "IGUIStaticText.h" 12 13 namespace irr 14 { 15 16 namespace gui 17 { 18 class CGUIDummyEditorStub : public IGUIElement 19 { 20 public: 21 //! constructor CGUIDummyEditorStub(IGUIEnvironment * environment,IGUIElement * parent,const char * text)22 CGUIDummyEditorStub(IGUIEnvironment* environment, IGUIElement *parent, const char *text) : 23 IGUIElement(EGUIET_ELEMENT, environment, parent, -1, core::rect<s32>(0, 0, 100, 100) ), 24 TextBox(0), TypeName(text) 25 { 26 27 #ifdef _DEBUG 28 setDebugName("CGUIDummyEditorStub"); 29 #endif 30 31 core::dimension2du d = Environment->getSkin()->getFont()->getDimension(L"A"); 32 s32 h = d.Height / 2; 33 s32 w = d.Width / 2; 34 35 TextBox = environment->addStaticText(core::stringw(text).c_str(), 36 core::rect<s32>(50-w, 50-h, 50+w, 50+h), 37 false, false, this, -1, false); 38 TextBox->grab(); 39 TextBox->setSubElement(true); 40 TextBox->setAlignment(EGUIA_CENTER, EGUIA_CENTER, EGUIA_CENTER, EGUIA_CENTER); 41 } 42 ~CGUIDummyEditorStub()43 virtual ~CGUIDummyEditorStub() 44 { 45 if (TextBox) 46 TextBox->drop(); 47 } getTypeName()48 virtual const c8* getTypeName() const { return TypeName.c_str(); } 49 50 protected: 51 IGUIStaticText* TextBox; 52 core::stringc TypeName; 53 54 }; 55 56 } // namespace gui 57 } // namespace irr 58 59 #endif 60