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
{
public:
DECLARE_UI_CLASS( CCtrlButton )
/// Constructor
CCtrlButton(const TCtorParam &param) : CCtrlBaseButton(param)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -32,6 +32,7 @@ namespace NLGUI
class CGroupEditBox : public CGroupEditBoxBase
{
public:
DECLARE_UI_CLASS( CGroupEditBox )
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
DECLARE_UI_CLASS( CGroupEditBox )
/// Constructor
CGroupEditBox(const TCtorParam &param);
/// Dtor

View file

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

View file

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

View file

@ -54,6 +54,8 @@ namespace NLGUI
class CGroupHTML : public CGroupScrollText
{
public:
DECLARE_UI_CLASS( CGroupHTML )
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 TextEndElement (_HText *me, int element_number);
@ -658,6 +660,8 @@ namespace NLGUI
class CGroupHTMLInputOffset : public CInterfaceGroup
{
public:
DECLARE_UI_CLASS( CGroupHTMLInputOffset )
sint32 Offset;
CGroupHTMLInputOffset(const TCtorParam &param);
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -36,6 +36,8 @@ namespace NLGUI
class CViewTextIDFormated : public CViewTextID
{
public:
DECLARE_UI_CLASS( CViewTextIDFormated )
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
_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),
_Filtered(true),
_UMin(0.f),

View file

@ -25,7 +25,7 @@ namespace NLGUI
{
// *********************************************************************************
CViewPolygon::CViewPolygon() : CViewBase(TCtorParam())
CViewPolygon::CViewPolygon( const TCtorParam &param ) : CViewBase( param )
{
// Construct
_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),
_UMin(0.f),
_UMax(1.f),

View file

@ -82,13 +82,9 @@ namespace GUIEditor
currentElement = id;
std::string n;
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 );
std::string n = e->getClassName();
setupProperties( n, e );
setupProperties( n, e );
connect( propertyMgr, SIGNAL( propertyChanged( QtProperty* ) ),
this, SLOT( onPropertyChanged( QtProperty* ) ) );
}