GUI Editor no longer depends on RTTI typename, instead it uses GetClassName() string provided by DECLARE_UI_CLASS().

This commit is contained in:
dfighter1985 2013-02-20 22:05:09 +01:00
parent 668e34f996
commit f55ab4e21e
39 changed files with 71 additions and 18 deletions

View file

@ -35,6 +35,7 @@ namespace NLGUI
class CCtrlButton : public CCtrlBaseButton class CCtrlButton : public CCtrlBaseButton
{ {
public: public:
DECLARE_UI_CLASS( CCtrlButton )
/// Constructor /// Constructor
CCtrlButton(const TCtorParam &param) : CCtrlBaseButton(param) CCtrlButton(const TCtorParam &param) : CCtrlBaseButton(param)

View file

@ -36,6 +36,7 @@ namespace NLGUI
{ {
public: public:
DECLARE_UI_CLASS( CCtrlColPick )
CCtrlColPick(const TCtorParam &param); CCtrlColPick(const TCtorParam &param);
~CCtrlColPick(); ~CCtrlColPick();

View file

@ -43,7 +43,8 @@ namespace NLGUI
class CCtrlPolygon : public CCtrlBase class CCtrlPolygon : public CCtrlBase
{ {
public: public:
CCtrlPolygon(); DECLARE_UI_CLASS( CCtrlPolygon )
CCtrlPolygon( const TCtorParam &param );
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); } virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
virtual void updateCoords(); virtual void updateCoords();
virtual void draw(); virtual void draw();

View file

@ -38,10 +38,12 @@ namespace NLGUI
class CCtrlQuad : public CCtrlBase class CCtrlQuad : public CCtrlBase
{ {
public: public:
DECLARE_UI_CLASS( CCtrlQuad )
enum TWrapMode { Repeat = 0, Clamp, CustomUVs, WrapModeCount }; enum TWrapMode { Repeat = 0, Clamp, CustomUVs, WrapModeCount };
CCtrlQuad(); CCtrlQuad( const TCtorParam &param );
// from CInterfaceElement // from CInterfaceElement
bool parse(xmlNodePtr cur,CInterfaceGroup *parentGroup); bool parse(xmlNodePtr cur,CInterfaceGroup *parentGroup);

View file

@ -54,7 +54,7 @@ namespace NLGUI
*/ */
class CCtrlSheetSelection class CCtrlSheetSelection
{ {
public: public:
// Add a group, and returns its index, or -1 if already created. // Add a group, and returns its index, or -1 if already created.
sint addGroup(const std::string &name); sint addGroup(const std::string &name);
// Get a group by its name (must exist) // Get a group by its name (must exist)

View file

@ -38,6 +38,7 @@ namespace NLGUI
class CCtrlTextButton : public CCtrlBaseButton class CCtrlTextButton : public CCtrlBaseButton
{ {
public: public:
DECLARE_UI_CLASS( CCtrlTextButton )
/// Constructor /// Constructor
CCtrlTextButton(const TCtorParam &param); CCtrlTextButton(const TCtorParam &param);

View file

@ -39,6 +39,7 @@ namespace NLGUI
class CDBGroupComboBox : public CInterfaceGroup class CDBGroupComboBox : public CInterfaceGroup
{ {
public: public:
DECLARE_UI_CLASS( CDBGroupComboBox )
/// Constructor /// Constructor
CDBGroupComboBox(const TCtorParam &param); CDBGroupComboBox(const TCtorParam &param);

View file

@ -39,6 +39,7 @@ namespace NLGUI
class CDBGroupSelectNumber : public CInterfaceGroup class CDBGroupSelectNumber : public CInterfaceGroup
{ {
public: public:
DECLARE_UI_CLASS( CDBGroupSelectNumber )
/// Constructor /// Constructor
CDBGroupSelectNumber(const TCtorParam &param); CDBGroupSelectNumber(const TCtorParam &param);

View file

@ -37,6 +37,7 @@ namespace NLGUI
public: public:
enum TViewBar { ViewBar_UltraMini, ViewBar_Mini, ViewBar_Normal, ViewBar_MiniThick }; enum TViewBar { ViewBar_UltraMini, ViewBar_Mini, ViewBar_Normal, ViewBar_MiniThick };
public: public:
DECLARE_UI_CLASS( CDBViewBar )
/// Constructor /// Constructor
CDBViewBar(const TCtorParam &param) CDBViewBar(const TCtorParam &param)

View file

@ -34,6 +34,7 @@ namespace NLGUI
class CDBViewBar3 : public CViewBitmap class CDBViewBar3 : public CViewBitmap
{ {
public: public:
DECLARE_UI_CLASS( CDBViewBar3 )
/// Constructor /// Constructor
CDBViewBar3(const TCtorParam &param); CDBViewBar3(const TCtorParam &param);

View file

@ -34,6 +34,7 @@ namespace NLGUI
class CDBViewDigit : public CViewBase class CDBViewDigit : public CViewBase
{ {
public: public:
DECLARE_UI_CLASS( CDBViewDigit )
/// Constructor /// Constructor
CDBViewDigit(const TCtorParam &param); CDBViewDigit(const TCtorParam &param);

View file

@ -35,6 +35,7 @@ namespace NLGUI
class CDBViewNumber : public CViewText class CDBViewNumber : public CViewText
{ {
public: public:
DECLARE_UI_CLASS( CDBViewNumber )
/// Constructor /// Constructor
CDBViewNumber(const TCtorParam &param); CDBViewNumber(const TCtorParam &param);

View file

@ -35,6 +35,7 @@ namespace NLGUI
class CDBViewQuantity : public CViewText class CDBViewQuantity : public CViewText
{ {
public: public:
DECLARE_UI_CLASS( CDBViewQuantity )
/// Constructor /// Constructor
CDBViewQuantity(const TCtorParam &param); CDBViewQuantity(const TCtorParam &param);

View file

@ -48,6 +48,7 @@ namespace NLGUI
{ {
public: public:
DECLARE_UI_CLASS( CCtrlResizer )
CCtrlResizer(const TCtorParam &param); CCtrlResizer(const TCtorParam &param);
virtual void draw (); virtual void draw ();
@ -98,8 +99,9 @@ namespace NLGUI
class CCtrlMover : public CCtrlBase class CCtrlMover : public CCtrlBase
{ {
public: public:
DECLARE_UI_CLASS( CCtrlMover )
CCtrlMover(const TCtorParam &param, bool canMove, bool canOpen); CCtrlMover(const TCtorParam &param, bool canMove = true, bool canOpen = true );
~CCtrlMover(); ~CCtrlMover();
virtual void draw (); virtual void draw ();
virtual bool handleEvent (const NLGUI::CEventDescriptor &event); virtual bool handleEvent (const NLGUI::CEventDescriptor &event);
@ -163,6 +165,7 @@ namespace NLGUI
virtual void childrenMoved(uint srcIndex, uint destIndex, CGroupContainer *children) = 0; virtual void childrenMoved(uint srcIndex, uint destIndex, CGroupContainer *children) = 0;
}; };
public: public:
DECLARE_UI_CLASS( CGroupContainer )
CGroupContainer(const TCtorParam &param); CGroupContainer(const TCtorParam &param);
~CGroupContainer(); ~CGroupContainer();

View file

@ -32,6 +32,7 @@ namespace NLGUI
class CGroupEditBox : public CGroupEditBoxBase class CGroupEditBox : public CGroupEditBoxBase
{ {
public: public:
DECLARE_UI_CLASS( CGroupEditBox )
class IComboKeyHandler class IComboKeyHandler
{ {
@ -42,7 +43,6 @@ namespace NLGUI
enum TEntryType { Text, Integer, PositiveInteger, Float, PositiveFloat, Alpha, AlphaNum, AlphaNumSpace, Password, Filename, PlayerName }; // the type of entry this edit bot can deal with enum TEntryType { Text, Integer, PositiveInteger, Float, PositiveFloat, Alpha, AlphaNum, AlphaNumSpace, Password, Filename, PlayerName }; // the type of entry this edit bot can deal with
DECLARE_UI_CLASS( CGroupEditBox )
/// Constructor /// Constructor
CGroupEditBox(const TCtorParam &param); CGroupEditBox(const TCtorParam &param);
/// Dtor /// Dtor

View file

@ -36,6 +36,7 @@ namespace NLGUI
class CGroupFrame : public CInterfaceGroup class CGroupFrame : public CInterfaceGroup
{ {
public: public:
DECLARE_UI_CLASS( CGroupFrame )
/// Constructor /// Constructor
CGroupFrame(const TCtorParam &param); CGroupFrame(const TCtorParam &param);

View file

@ -35,6 +35,8 @@ namespace NLGUI
class CGroupHeader : public CGroupList class CGroupHeader : public CGroupList
{ {
public: public:
DECLARE_UI_CLASS( CGroupHeader )
REFLECT_EXPORT_START(CGroupHeader, CGroupList) REFLECT_EXPORT_START(CGroupHeader, CGroupList)
REFLECT_LUA_METHOD("enlargeColumns", luaEnlargeColumns); REFLECT_LUA_METHOD("enlargeColumns", luaEnlargeColumns);
REFLECT_LUA_METHOD("resizeColumnsAndContainer", luaResizeColumnsAndContainer); REFLECT_LUA_METHOD("resizeColumnsAndContainer", luaResizeColumnsAndContainer);
@ -67,6 +69,8 @@ namespace NLGUI
class CGroupHeaderEntry : public CInterfaceGroup class CGroupHeaderEntry : public CInterfaceGroup
{ {
public: public:
DECLARE_UI_CLASS( CGroupHeaderEntry )
CGroupHeaderEntry(const TCtorParam &param); CGroupHeaderEntry(const TCtorParam &param);
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
// from CInterfaceGroup // from CInterfaceGroup

View file

@ -54,6 +54,8 @@ namespace NLGUI
class CGroupHTML : public CGroupScrollText class CGroupHTML : public CGroupScrollText
{ {
public: public:
DECLARE_UI_CLASS( CGroupHTML )
friend void TextAdd (struct _HText *me, const char * buf, int len); friend void TextAdd (struct _HText *me, const char * buf, int len);
friend void TextBeginElement (_HText *me, int element_number, const BOOL *present, const char ** value); friend void TextBeginElement (_HText *me, int element_number, const BOOL *present, const char ** value);
friend void TextEndElement (_HText *me, int element_number); friend void TextEndElement (_HText *me, int element_number);
@ -658,6 +660,8 @@ namespace NLGUI
class CGroupHTMLInputOffset : public CInterfaceGroup class CGroupHTMLInputOffset : public CInterfaceGroup
{ {
public: public:
DECLARE_UI_CLASS( CGroupHTMLInputOffset )
sint32 Offset; sint32 Offset;
CGroupHTMLInputOffset(const TCtorParam &param); CGroupHTMLInputOffset(const TCtorParam &param);
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;

View file

@ -30,6 +30,8 @@ namespace NLGUI
class CGroupList : public CInterfaceGroup class CGroupList : public CInterfaceGroup
{ {
public: public:
DECLARE_UI_CLASS( CGroupList )
enum EAlign enum EAlign
{ {
Bottom = 0, Bottom = 0,

View file

@ -42,6 +42,7 @@ namespace NLGUI
class CViewTextMenu : public CViewText class CViewTextMenu : public CViewText
{ {
public: public:
DECLARE_UI_CLASS( CViewTextMenu )
CViewTextMenu(const TCtorParam &param) : CViewText(param) CViewTextMenu(const TCtorParam &param) : CViewText(param)
{ {
@ -97,6 +98,7 @@ namespace NLGUI
class CGroupSubMenu : public CGroupSubMenuBase class CGroupSubMenu : public CGroupSubMenuBase
{ {
public: public:
DECLARE_UI_CLASS( CGroupSubMenu )
CGroupSubMenu(const TCtorParam &param); CGroupSubMenu(const TCtorParam &param);
virtual ~CGroupSubMenu(); virtual ~CGroupSubMenu();
@ -290,6 +292,7 @@ namespace NLGUI
{ {
public: public:
DECLARE_UI_CLASS( CGroupMenu )
CGroupMenu(const TCtorParam &param); CGroupMenu(const TCtorParam &param);
virtual ~CGroupMenu(); virtual ~CGroupMenu();

View file

@ -35,6 +35,8 @@ namespace NLGUI
class CGroupModal : public CGroupFrame class CGroupModal : public CGroupFrame
{ {
public: public:
DECLARE_UI_CLASS( CGroupModal )
bool SpawnOnMousePos : 1; bool SpawnOnMousePos : 1;
bool ExitClickOut : 1; bool ExitClickOut : 1;
bool ExitClickL : 1; bool ExitClickL : 1;

View file

@ -31,6 +31,8 @@ namespace NLGUI
class CCtrlLink : public CCtrlButton class CCtrlLink : public CCtrlButton
{ {
public: public:
DECLARE_UI_CLASS( CCtrlLink )
CCtrlLink (const TCtorParam &param) : CCtrlButton(param) CCtrlLink (const TCtorParam &param) : CCtrlButton(param)
{} {}
}; };
@ -39,6 +41,8 @@ namespace NLGUI
class CGroupParagraph : public CInterfaceGroup class CGroupParagraph : public CInterfaceGroup
{ {
public: public:
DECLARE_UI_CLASS( CGroupParagraph )
enum EAlign enum EAlign
{ {
Bottom = 0, Bottom = 0,

View file

@ -39,6 +39,8 @@ namespace NLGUI
class CGroupScrollText : public CInterfaceGroup class CGroupScrollText : public CInterfaceGroup
{ {
public: public:
DECLARE_UI_CLASS( CGroupScrollText )
/// Constructor /// Constructor
CGroupScrollText(const TCtorParam &param); CGroupScrollText(const TCtorParam &param);
~CGroupScrollText(); ~CGroupScrollText();

View file

@ -43,6 +43,7 @@ namespace NLGUI
class CGroupTab : public CInterfaceGroup class CGroupTab : public CInterfaceGroup
{ {
public: public:
DECLARE_UI_CLASS( CGroupTab )
/// Constructor /// Constructor
CGroupTab(const TCtorParam &param); CGroupTab(const TCtorParam &param);
@ -153,6 +154,7 @@ namespace NLGUI
class CCtrlTabButton : public CCtrlTextButton class CCtrlTabButton : public CCtrlTextButton
{ {
public: public:
DECLARE_UI_CLASS( CCtrlTabButton )
CCtrlTabButton(const TCtorParam &param); CCtrlTabButton(const TCtorParam &param);

View file

@ -36,6 +36,8 @@ namespace NLGUI
{ {
friend class CGroupTable; friend class CGroupTable;
public: public:
DECLARE_UI_CLASS( CGroupCell )
CGroupCell(const TCtorParam &param); CGroupCell(const TCtorParam &param);
enum TAlign enum TAlign
@ -121,6 +123,7 @@ namespace NLGUI
class CGroupTable : public CInterfaceGroup class CGroupTable : public CInterfaceGroup
{ {
public: public:
DECLARE_UI_CLASS( CGroupTable )
///constructor ///constructor
CGroupTable(const TCtorParam &param); CGroupTable(const TCtorParam &param);

View file

@ -33,6 +33,7 @@ namespace NLGUI
{ {
public: public:
DECLARE_UI_CLASS( CGroupTree )
struct SNode; struct SNode;
// optional callback that is called when a node has been added // optional callback that is called when a node has been added

View file

@ -28,6 +28,8 @@ namespace NLGUI
class CInterfaceGroupWheel : public CInterfaceGroup class CInterfaceGroupWheel : public CInterfaceGroup
{ {
public: public:
DECLARE_UI_CLASS( CInterfaceGroupWheel )
/// Constructor /// Constructor
CInterfaceGroupWheel(const TCtorParam &param); CInterfaceGroupWheel(const TCtorParam &param);

View file

@ -99,6 +99,8 @@ namespace NLGUI
class CViewBitmapCombo : public CViewBase, public NLMISC::ICDBNode::IPropertyObserver class CViewBitmapCombo : public CViewBase, public NLMISC::ICDBNode::IPropertyObserver
{ {
public: public:
DECLARE_UI_CLASS( CViewBitmapCombo )
typedef std::vector<sint32> TIdArray; typedef std::vector<sint32> TIdArray;
typedef std::vector<std::string> TStringArray; typedef std::vector<std::string> TStringArray;
typedef std::vector<NLMISC::CRGBA> TColorArray; typedef std::vector<NLMISC::CRGBA> TColorArray;

View file

@ -36,6 +36,7 @@ namespace NLGUI
class CViewLink : public CViewText class CViewLink : public CViewText
{ {
public: public:
DECLARE_UI_CLASS( CViewLink )
// Default constructor // Default constructor
CViewLink (const TCtorParam &param); CViewLink (const TCtorParam &param);

View file

@ -36,7 +36,9 @@ namespace NLGUI
class CViewPolygon : public CViewBase class CViewPolygon : public CViewBase
{ {
public: public:
CViewPolygon(); DECLARE_UI_CLASS( CViewPolygon )
CViewPolygon( const TCtorParam &param );
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); } virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
virtual void updateCoords(); virtual void updateCoords();
virtual void draw(); virtual void draw();

View file

@ -36,10 +36,12 @@ namespace NLGUI
class CViewQuad : public CViewBase class CViewQuad : public CViewBase
{ {
public: public:
DECLARE_UI_CLASS( CViewQuad )
enum TWrapMode { Repeat = 0, Clamp, WrapModeCount }; enum TWrapMode { Repeat = 0, Clamp, WrapModeCount };
CViewQuad(); CViewQuad( const TCtorParam &param );
// from CInterfaceElement // from CInterfaceElement
bool parse(xmlNodePtr cur,CInterfaceGroup *parentGroup); bool parse(xmlNodePtr cur,CInterfaceGroup *parentGroup);

View file

@ -35,6 +35,7 @@ namespace NLGUI
class CViewTextFormated : public CViewText class CViewTextFormated : public CViewText
{ {
public: public:
DECLARE_UI_CLASS( CViewTextFormated )
/// Interface for classes which can format the text for this view. /// Interface for classes which can format the text for this view.
class IViewTextFormatter class IViewTextFormatter

View file

@ -48,6 +48,7 @@ namespace NLGUI
class CViewTextID : public CViewText class CViewTextID : public CViewText
{ {
public: public:
DECLARE_UI_CLASS( CViewTextID )
/// Interface for classes which can provide text to CViewTextId /// Interface for classes which can provide text to CViewTextId
class IViewTextProvider class IViewTextProvider

View file

@ -36,6 +36,8 @@ namespace NLGUI
class CViewTextIDFormated : public CViewTextID class CViewTextIDFormated : public CViewTextID
{ {
public: public:
DECLARE_UI_CLASS( CViewTextIDFormated )
CViewTextIDFormated(const TCtorParam &param) : CViewTextID(param) CViewTextIDFormated(const TCtorParam &param) : CViewTextID(param)
{} {}

View file

@ -25,7 +25,7 @@ namespace NLGUI
{ {
// ********************************************************************************* // *********************************************************************************
CCtrlPolygon::CCtrlPolygon() : CCtrlBase(TCtorParam()) CCtrlPolygon::CCtrlPolygon( const TCtorParam &param ) : CCtrlBase( param )
{ {
// Construct // Construct
_Color = CRGBA::White; _Color = CRGBA::White;

View file

@ -25,7 +25,7 @@ namespace NLGUI
{ {
// ********************************************************************************* // *********************************************************************************
CCtrlQuad::CCtrlQuad() : CCtrlBase(TCtorParam()), _Color(CRGBA::White), CCtrlQuad::CCtrlQuad( const TCtorParam &param ) : CCtrlBase( param ), _Color(CRGBA::White),
_Additif(false), _Additif(false),
_Filtered(true), _Filtered(true),
_UMin(0.f), _UMin(0.f),

View file

@ -25,7 +25,7 @@ namespace NLGUI
{ {
// ********************************************************************************* // *********************************************************************************
CViewPolygon::CViewPolygon() : CViewBase(TCtorParam()) CViewPolygon::CViewPolygon( const TCtorParam &param ) : CViewBase( param )
{ {
// Construct // Construct
_Color = CRGBA::White; _Color = CRGBA::White;

View file

@ -24,7 +24,7 @@ namespace NLGUI
{ {
// ********************************************************************************* // *********************************************************************************
CViewQuad::CViewQuad() : CViewBase(TCtorParam()), _Color(CRGBA::White), CViewQuad::CViewQuad( const TCtorParam &param ) : CViewBase( param ), _Color(CRGBA::White),
_Additif(false), _Additif(false),
_UMin(0.f), _UMin(0.f),
_UMax(1.f), _UMax(1.f),

View file

@ -82,13 +82,9 @@ namespace GUIEditor
currentElement = id; currentElement = id;
std::string n; std::string n = e->getClassName();
n = typeid( *e ).name();
std::string::size_type i = n.find_last_of( ':' );
if( i != std::string::npos )
n = n.substr( i + 1, n.size() - 1 );
setupProperties( n, e ); setupProperties( n, e );
connect( propertyMgr, SIGNAL( propertyChanged( QtProperty* ) ), connect( propertyMgr, SIGNAL( propertyChanged( QtProperty* ) ),
this, SLOT( onPropertyChanged( QtProperty* ) ) ); this, SLOT( onPropertyChanged( QtProperty* ) ) );
} }
@ -163,4 +159,4 @@ namespace GUIEditor
p->setValue( v ); p->setValue( v );
browser->addProperty( p ); browser->addProperty( p );
} }
} }