updated xti sample
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66632 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -429,7 +429,7 @@ wxString DumpPropertyInfo(const wxPropertyInfo *prop, int indent)
|
|||||||
infostr << ind << _T("collection element type: ") << DumpTypeInfo(prop->GetCollectionElementTypeInfo());
|
infostr << ind << _T("collection element type: ") << DumpTypeInfo(prop->GetCollectionElementTypeInfo());
|
||||||
infostr << ind << _T("type: ") << DumpTypeInfo(prop->GetTypeInfo());
|
infostr << ind << _T("type: ") << DumpTypeInfo(prop->GetTypeInfo());
|
||||||
|
|
||||||
infostr << ind << _T("default value: ") << DumpStr(prop->GetDefaultValue().GetAsString());
|
infostr << ind << _T("default value: ") << DumpStr(wxAnyGetAsString(prop->GetDefaultValue()));
|
||||||
infostr << DumpPropertyAccessor(prop->GetAccessor(), indent+1);
|
infostr << DumpPropertyAccessor(prop->GetAccessor(), indent+1);
|
||||||
|
|
||||||
return infostr;
|
return infostr;
|
||||||
|
@@ -73,8 +73,8 @@ struct wxObjectCodeReaderCallback::wxObjectCodeReaderCallbackInternal
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
wxObjectCodeReaderCallback::wxObjectCodeReaderCallback(wxTextOutputStream *out)
|
wxObjectCodeReaderCallback::wxObjectCodeReaderCallback(wxString& headerincludes, wxString &source)
|
||||||
: m_fp(out)
|
: m_headerincludes(headerincludes),m_source(source)
|
||||||
{
|
{
|
||||||
m_data = new wxObjectCodeReaderCallbackInternal;
|
m_data = new wxObjectCodeReaderCallbackInternal;
|
||||||
}
|
}
|
||||||
@@ -85,10 +85,19 @@ wxObjectCodeReaderCallback::~wxObjectCodeReaderCallback()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wxObjectCodeReaderCallback::AllocateObject(int objectID, wxClassInfo *classInfo,
|
void wxObjectCodeReaderCallback::AllocateObject(int objectID, wxClassInfo *classInfo,
|
||||||
wxVariantBaseArray &WXUNUSED(metadata))
|
wxStringToAnyHashMap &WXUNUSED(metadata))
|
||||||
{
|
{
|
||||||
|
if ( classInfo->GetIncludeName() != wxEmptyString)
|
||||||
|
{
|
||||||
|
// add corresponding header if not already included
|
||||||
|
wxString include;
|
||||||
|
include.Printf(wxT("#include \"%s\"\n"),classInfo->GetIncludeName());
|
||||||
|
if ( m_headerincludes.Find(include) == wxNOT_FOUND)
|
||||||
|
m_headerincludes += include;
|
||||||
|
}
|
||||||
|
|
||||||
wxString objectName = wxString::Format( wxT("LocalObject_%d"), objectID );
|
wxString objectName = wxString::Format( wxT("LocalObject_%d"), objectID );
|
||||||
m_fp->WriteString( wxString::Format( wxT("\t%s *%s = new %s;\n"),
|
m_source += ( wxString::Format( wxT("\t%s *%s = new %s;\n"),
|
||||||
classInfo->GetClassName(),
|
classInfo->GetClassName(),
|
||||||
objectName.c_str(),
|
objectName.c_str(),
|
||||||
classInfo->GetClassName()) );
|
classInfo->GetClassName()) );
|
||||||
@@ -97,13 +106,45 @@ void wxObjectCodeReaderCallback::AllocateObject(int objectID, wxClassInfo *class
|
|||||||
|
|
||||||
void wxObjectCodeReaderCallback::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo))
|
void wxObjectCodeReaderCallback::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo))
|
||||||
{
|
{
|
||||||
m_fp->WriteString( wxString::Format( wxT("\tdelete %s;\n"),
|
m_source += ( wxString::Format( wxT("\tdelete %s;\n"),
|
||||||
m_data->GetObjectName( objectID).c_str() ) );
|
m_data->GetObjectName( objectID).c_str() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxObjectCodeReaderCallback::ValueAsCode( const wxVariantBase ¶m )
|
class WXDLLIMPEXP_BASE wxObjectConstructorWriter: public wxObjectWriterFunctor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxObjectConstructorWriter(const wxClassTypeInfo* cti,
|
||||||
|
wxObjectCodeReaderCallback* writer) :
|
||||||
|
m_cti(cti),m_writer(writer)
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual void operator()(const wxObject *vobj)
|
||||||
|
{
|
||||||
|
const wxClassInfo* ci = m_cti->GetClassInfo();
|
||||||
|
|
||||||
|
for ( int i = 0; i < ci->GetCreateParamCount(); ++i )
|
||||||
|
{
|
||||||
|
wxString name = ci->GetCreateParamName(i);
|
||||||
|
const wxPropertyInfo* prop = ci->FindPropertyInfo(name);
|
||||||
|
if ( i > 0 )
|
||||||
|
m_constructor += ", ";
|
||||||
|
wxAny value;
|
||||||
|
prop->GetAccessor()->GetProperty(vobj, value);
|
||||||
|
m_constructor+= m_writer->ValueAsCode(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const wxString& GetConstructorString() const { return m_constructor;}
|
||||||
|
private:
|
||||||
|
const wxClassTypeInfo* m_cti;
|
||||||
|
wxObjectCodeReaderCallback* m_writer;
|
||||||
|
wxString m_constructor;
|
||||||
|
};
|
||||||
|
|
||||||
|
wxString wxObjectCodeReaderCallback::ValueAsCode( const wxAny ¶m )
|
||||||
{
|
{
|
||||||
wxString value;
|
wxString value;
|
||||||
|
|
||||||
const wxTypeInfo* type = param.GetTypeInfo();
|
const wxTypeInfo* type = param.GetTypeInfo();
|
||||||
if ( type->GetKind() == wxT_CUSTOM )
|
if ( type->GetKind() == wxT_CUSTOM )
|
||||||
{
|
{
|
||||||
@@ -111,7 +152,7 @@ wxString wxObjectCodeReaderCallback::ValueAsCode( const wxVariantBase ¶m )
|
|||||||
if ( cti )
|
if ( cti )
|
||||||
{
|
{
|
||||||
value.Printf( wxT("%s(%s)"), cti->GetTypeName().c_str(),
|
value.Printf( wxT("%s(%s)"), cti->GetTypeName().c_str(),
|
||||||
param.GetAsString().c_str() );
|
wxAnyGetAsString(param).c_str() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -120,26 +161,41 @@ wxString wxObjectCodeReaderCallback::ValueAsCode( const wxVariantBase ¶m )
|
|||||||
}
|
}
|
||||||
else if ( type->GetKind() == wxT_STRING )
|
else if ( type->GetKind() == wxT_STRING )
|
||||||
{
|
{
|
||||||
value.Printf( wxT("\"%s\""),param.GetAsString().c_str() );
|
value.Printf( wxT("\"%s\""), wxAnyGetAsString(param).c_str() );
|
||||||
|
}
|
||||||
|
else if ( type->GetKind() == wxT_OBJECT )
|
||||||
|
{
|
||||||
|
const wxClassTypeInfo* ctype = wx_dynamic_cast(const wxClassTypeInfo*,type);
|
||||||
|
const wxClassInfo* ci = ctype->GetClassInfo();
|
||||||
|
if( ci->NeedsDirectConstruction())
|
||||||
|
{
|
||||||
|
wxObjectConstructorWriter cw(ctype,this);
|
||||||
|
|
||||||
|
ci->CallOnAny(param,&cw);
|
||||||
|
|
||||||
|
value.Printf( wxT("%s(%s)"), ctype->GetClassInfo()->GetClassName(),
|
||||||
|
cw.GetConstructorString() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value.Printf( wxT("%s"), param.GetAsString().c_str() );
|
value.Printf( wxT("%s"), wxAnyGetAsString(param).c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxObjectCodeReaderCallback::CreateObject(int objectID,
|
void wxObjectCodeReaderCallback::CreateObject(int objectID,
|
||||||
const wxClassInfo *WXUNUSED(classInfo),
|
const wxClassInfo *WXUNUSED(classInfo),
|
||||||
int paramCount,
|
int paramCount,
|
||||||
wxVariantBase *params,
|
wxAny *params,
|
||||||
int *objectIDValues,
|
int *objectIDValues,
|
||||||
const wxClassInfo **WXUNUSED(objectClassInfos),
|
const wxClassInfo **WXUNUSED(objectClassInfos),
|
||||||
wxVariantBaseArray &WXUNUSED(metadata)
|
wxStringToAnyHashMap &WXUNUSED(metadata)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
m_fp->WriteString( wxString::Format( wxT("\t%s->Create("),
|
m_source += ( wxString::Format( wxT("\t%s->Create("),
|
||||||
m_data->GetObjectName(objectID).c_str() ) );
|
m_data->GetObjectName(objectID).c_str() ) );
|
||||||
for (i = 0; i < paramCount; i++)
|
for (i = 0; i < paramCount; i++)
|
||||||
{
|
{
|
||||||
@@ -148,30 +204,30 @@ void wxObjectCodeReaderCallback::CreateObject(int objectID,
|
|||||||
wxString str =
|
wxString str =
|
||||||
wxString::Format( wxT("%s"),
|
wxString::Format( wxT("%s"),
|
||||||
m_data->GetObjectName( objectIDValues[i] ).c_str() );
|
m_data->GetObjectName( objectIDValues[i] ).c_str() );
|
||||||
m_fp->WriteString( str );
|
m_source += ( str );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_fp->WriteString(
|
m_source += (
|
||||||
wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) );
|
wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) );
|
||||||
}
|
}
|
||||||
if (i < paramCount - 1)
|
if (i < paramCount - 1)
|
||||||
m_fp->WriteString( wxT(", "));
|
m_source += ( wxT(", "));
|
||||||
}
|
}
|
||||||
m_fp->WriteString( wxT(");\n") );
|
m_source += ( wxT(");\n") );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxObjectCodeReaderCallback::ConstructObject(int objectID,
|
void wxObjectCodeReaderCallback::ConstructObject(int objectID,
|
||||||
const wxClassInfo *classInfo,
|
const wxClassInfo *classInfo,
|
||||||
int paramCount,
|
int paramCount,
|
||||||
wxVariantBase *params,
|
wxAny *params,
|
||||||
int *objectIDValues,
|
int *objectIDValues,
|
||||||
const wxClassInfo **WXUNUSED(objectClassInfos),
|
const wxClassInfo **WXUNUSED(objectClassInfos),
|
||||||
wxVariantBaseArray &WXUNUSED(metadata)
|
wxStringToAnyHashMap &WXUNUSED(metadata)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
wxString objectName = wxString::Format( wxT("LocalObject_%d"), objectID );
|
wxString objectName = wxString::Format( wxT("LocalObject_%d"), objectID );
|
||||||
m_fp->WriteString( wxString::Format( wxT("\t%s *%s = new %s("),
|
m_source += ( wxString::Format( wxT("\t%s *%s = new %s("),
|
||||||
classInfo->GetClassName(),
|
classInfo->GetClassName(),
|
||||||
objectName.c_str(),
|
objectName.c_str(),
|
||||||
classInfo->GetClassName()) );
|
classInfo->GetClassName()) );
|
||||||
@@ -181,25 +237,25 @@ void wxObjectCodeReaderCallback::ConstructObject(int objectID,
|
|||||||
for (i = 0; i < paramCount; i++)
|
for (i = 0; i < paramCount; i++)
|
||||||
{
|
{
|
||||||
if ( objectIDValues[i] != wxInvalidObjectID )
|
if ( objectIDValues[i] != wxInvalidObjectID )
|
||||||
m_fp->WriteString( wxString::Format( wxT("%s"),
|
m_source += ( wxString::Format( wxT("%s"),
|
||||||
m_data->GetObjectName( objectIDValues[i] ).c_str() ) );
|
m_data->GetObjectName( objectIDValues[i] ).c_str() ) );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_fp->WriteString(
|
m_source += (
|
||||||
wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) );
|
wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) );
|
||||||
}
|
}
|
||||||
if (i < paramCount - 1)
|
if (i < paramCount - 1)
|
||||||
m_fp->WriteString( wxT(", ") );
|
m_source += ( wxT(", ") );
|
||||||
}
|
}
|
||||||
m_fp->WriteString( wxT(");\n") );
|
m_source += ( wxT(");\n") );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxObjectCodeReaderCallback::SetProperty(int objectID,
|
void wxObjectCodeReaderCallback::SetProperty(int objectID,
|
||||||
const wxClassInfo *WXUNUSED(classInfo),
|
const wxClassInfo *WXUNUSED(classInfo),
|
||||||
const wxPropertyInfo* propertyInfo,
|
const wxPropertyInfo* propertyInfo,
|
||||||
const wxVariantBase &value)
|
const wxAny &value)
|
||||||
{
|
{
|
||||||
m_fp->WriteString( wxString::Format( wxT("\t%s->%s(%s);\n"),
|
m_source += ( wxString::Format( wxT("\t%s->%s(%s);\n"),
|
||||||
m_data->GetObjectName(objectID).c_str(),
|
m_data->GetObjectName(objectID).c_str(),
|
||||||
propertyInfo->GetAccessor()->GetSetterName().c_str(),
|
propertyInfo->GetAccessor()->GetSetterName().c_str(),
|
||||||
ValueAsCode(value).c_str()) );
|
ValueAsCode(value).c_str()) );
|
||||||
@@ -211,12 +267,12 @@ void wxObjectCodeReaderCallback::SetPropertyAsObject(int objectID,
|
|||||||
int valueObjectId)
|
int valueObjectId)
|
||||||
{
|
{
|
||||||
if ( propertyInfo->GetTypeInfo()->GetKind() == wxT_OBJECT )
|
if ( propertyInfo->GetTypeInfo()->GetKind() == wxT_OBJECT )
|
||||||
m_fp->WriteString( wxString::Format( wxT("\t%s->%s(*%s);\n"),
|
m_source += ( wxString::Format( wxT("\t%s->%s(*%s);\n"),
|
||||||
m_data->GetObjectName(objectID).c_str(),
|
m_data->GetObjectName(objectID).c_str(),
|
||||||
propertyInfo->GetAccessor()->GetSetterName().c_str(),
|
propertyInfo->GetAccessor()->GetSetterName().c_str(),
|
||||||
m_data->GetObjectName( valueObjectId).c_str() ) );
|
m_data->GetObjectName( valueObjectId).c_str() ) );
|
||||||
else
|
else
|
||||||
m_fp->WriteString( wxString::Format( wxT("\t%s->%s(%s);\n"),
|
m_source += ( wxString::Format( wxT("\t%s->%s(%s);\n"),
|
||||||
m_data->GetObjectName(objectID).c_str(),
|
m_data->GetObjectName(objectID).c_str(),
|
||||||
propertyInfo->GetAccessor()->GetSetterName().c_str(),
|
propertyInfo->GetAccessor()->GetSetterName().c_str(),
|
||||||
m_data->GetObjectName( valueObjectId).c_str() ) );
|
m_data->GetObjectName( valueObjectId).c_str() ) );
|
||||||
@@ -225,9 +281,9 @@ void wxObjectCodeReaderCallback::SetPropertyAsObject(int objectID,
|
|||||||
void wxObjectCodeReaderCallback::AddToPropertyCollection( int objectID,
|
void wxObjectCodeReaderCallback::AddToPropertyCollection( int objectID,
|
||||||
const wxClassInfo *WXUNUSED(classInfo),
|
const wxClassInfo *WXUNUSED(classInfo),
|
||||||
const wxPropertyInfo* propertyInfo,
|
const wxPropertyInfo* propertyInfo,
|
||||||
const wxVariantBase &value)
|
const wxAny &value)
|
||||||
{
|
{
|
||||||
m_fp->WriteString( wxString::Format( wxT("\t%s->%s(%s);\n"),
|
m_source += ( wxString::Format( wxT("\t%s->%s(%s);\n"),
|
||||||
m_data->GetObjectName(objectID).c_str(),
|
m_data->GetObjectName(objectID).c_str(),
|
||||||
propertyInfo->GetAccessor()->GetAdderName().c_str(),
|
propertyInfo->GetAccessor()->GetAdderName().c_str(),
|
||||||
ValueAsCode(value).c_str()) );
|
ValueAsCode(value).c_str()) );
|
||||||
@@ -267,7 +323,7 @@ void wxObjectCodeReaderCallback::SetConnect(int eventSourceObjectID,
|
|||||||
ehsource.c_str(), ehsource.c_str(), eventType, ehsinkClass.c_str(),
|
ehsource.c_str(), ehsource.c_str(), eventType, ehsinkClass.c_str(),
|
||||||
handlerName.c_str(), ehsink.c_str() );
|
handlerName.c_str(), ehsink.c_str() );
|
||||||
|
|
||||||
m_fp->WriteString( code );
|
m_source += ( code );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
#define _CODEDEPERSISTER_
|
#define _CODEDEPERSISTER_
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
#include "wx/sstream.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
wxObjectCodeReaderCallback implements the callbacks that will depersist
|
wxObjectCodeReaderCallback implements the callbacks that will depersist
|
||||||
@@ -21,21 +22,21 @@ an object into a C++ initialization function.
|
|||||||
|
|
||||||
class WXDLLIMPEXP_BASE wxTextOutputStream;
|
class WXDLLIMPEXP_BASE wxTextOutputStream;
|
||||||
|
|
||||||
class WXDLLIMPEXP_BASE wxObjectCodeReaderCallback: public wxObjectWriterCallback
|
class WXDLLIMPEXP_BASE wxObjectCodeReaderCallback: public wxObjectReaderCallback
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
struct wxObjectCodeReaderCallbackInternal;
|
struct wxObjectCodeReaderCallbackInternal;
|
||||||
wxObjectCodeReaderCallbackInternal * m_data;
|
wxObjectCodeReaderCallbackInternal * m_data;
|
||||||
wxTextOutputStream *m_fp;
|
wxString& m_headerincludes;
|
||||||
wxString ValueAsCode( const wxVariantBase ¶m );
|
wxString& m_source;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxObjectCodeReaderCallback(wxTextOutputStream *out);
|
wxObjectCodeReaderCallback(wxString& headerincludes, wxString &source);
|
||||||
virtual ~wxObjectCodeReaderCallback();
|
virtual ~wxObjectCodeReaderCallback();
|
||||||
|
|
||||||
// allocate the new object on the heap, that object will have the passed in ID
|
// allocate the new object on the heap, that object will have the passed in ID
|
||||||
virtual void AllocateObject(int objectID, wxClassInfo *classInfo,
|
virtual void AllocateObject(int objectID, wxClassInfo *classInfo,
|
||||||
wxVariantBaseArray &metadata);
|
wxStringToAnyHashMap &metadata);
|
||||||
|
|
||||||
// initialize the already allocated object having the ID objectID
|
// initialize the already allocated object having the ID objectID
|
||||||
// with the Create method creation parameters which are objects are
|
// with the Create method creation parameters which are objects are
|
||||||
@@ -44,10 +45,10 @@ public:
|
|||||||
virtual void CreateObject(int objectID,
|
virtual void CreateObject(int objectID,
|
||||||
const wxClassInfo *classInfo,
|
const wxClassInfo *classInfo,
|
||||||
int paramCount,
|
int paramCount,
|
||||||
wxVariantBase *variantValues,
|
wxAny *variantValues,
|
||||||
int *objectIDValues,
|
int *objectIDValues,
|
||||||
const wxClassInfo **objectClassInfos,
|
const wxClassInfo **objectClassInfos,
|
||||||
wxVariantBaseArray &metadata
|
wxStringToAnyHashMap &metadata
|
||||||
);
|
);
|
||||||
|
|
||||||
// construct the new object on the heap, that object will have the
|
// construct the new object on the heap, that object will have the
|
||||||
@@ -58,10 +59,10 @@ public:
|
|||||||
virtual void ConstructObject(int objectID,
|
virtual void ConstructObject(int objectID,
|
||||||
const wxClassInfo *classInfo,
|
const wxClassInfo *classInfo,
|
||||||
int paramCount,
|
int paramCount,
|
||||||
wxVariantBase *VariantValues,
|
wxAny *VariantValues,
|
||||||
int *objectIDValues,
|
int *objectIDValues,
|
||||||
const wxClassInfo **objectClassInfos,
|
const wxClassInfo **objectClassInfos,
|
||||||
wxVariantBaseArray &metadata);
|
wxStringToAnyHashMap &metadata);
|
||||||
|
|
||||||
// destroy the heap-allocated object having the ID objectID, this may
|
// destroy the heap-allocated object having the ID objectID, this may
|
||||||
// be used if an object is embedded in another object and set via value
|
// be used if an object is embedded in another object and set via value
|
||||||
@@ -72,7 +73,7 @@ public:
|
|||||||
virtual void SetProperty(int objectID,
|
virtual void SetProperty(int objectID,
|
||||||
const wxClassInfo *classInfo,
|
const wxClassInfo *classInfo,
|
||||||
const wxPropertyInfo* propertyInfo,
|
const wxPropertyInfo* propertyInfo,
|
||||||
const wxVariantBase &variantValue);
|
const wxAny &variantValue);
|
||||||
|
|
||||||
// sets the corresponding property (value is an object)
|
// sets the corresponding property (value is an object)
|
||||||
virtual void SetPropertyAsObject(int objectId,
|
virtual void SetPropertyAsObject(int objectId,
|
||||||
@@ -84,7 +85,7 @@ public:
|
|||||||
virtual void AddToPropertyCollection( int objectID,
|
virtual void AddToPropertyCollection( int objectID,
|
||||||
const wxClassInfo *classInfo,
|
const wxClassInfo *classInfo,
|
||||||
const wxPropertyInfo* propertyInfo,
|
const wxPropertyInfo* propertyInfo,
|
||||||
const wxVariantBase &VariantValue);
|
const wxAny &VariantValue);
|
||||||
|
|
||||||
// sets the corresponding property (value is an object)
|
// sets the corresponding property (value is an object)
|
||||||
virtual void AddToPropertyCollectionAsObject(int objectID,
|
virtual void AddToPropertyCollectionAsObject(int objectID,
|
||||||
@@ -99,6 +100,9 @@ public:
|
|||||||
const wxClassInfo *eventSinkClassInfo,
|
const wxClassInfo *eventSinkClassInfo,
|
||||||
const wxHandlerInfo* handlerInfo,
|
const wxHandlerInfo* handlerInfo,
|
||||||
int eventSinkObjectID );
|
int eventSinkObjectID );
|
||||||
|
|
||||||
|
// utility function exposed for callbacks
|
||||||
|
wxString ValueAsCode( const wxAny ¶m );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -89,7 +89,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// any class wishing to process wxWidgets events must use this macro
|
// any class wishing to process wxWidgets events must use this macro
|
||||||
wxDECLARE_EVENT_TABLE()
|
wxDECLARE_EVENT_TABLE();
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -121,7 +121,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(Minimal_About, MyFrame::OnAbout)
|
EVT_MENU(Minimal_About, MyFrame::OnAbout)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxIMPLEMENT_APP(MyApp)
|
wxIMPLEMENT_APP(MyApp);
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
@@ -263,7 +263,7 @@ MyFrame::MyFrame(const wxString& title)
|
|||||||
|
|
||||||
// the following class "persists" (i.e. saves) a wxFrame into a wxObjectWriter
|
// the following class "persists" (i.e. saves) a wxFrame into a wxObjectWriter
|
||||||
|
|
||||||
class MyDesignerPersister : public wxObjectReaderCallback
|
class MyDesignerPersister : public wxObjectWriterCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyDesignerPersister( wxDynamicObject * frame)
|
MyDesignerPersister( wxDynamicObject * frame)
|
||||||
@@ -278,15 +278,16 @@ public:
|
|||||||
const wxObject *&eventSink,
|
const wxObject *&eventSink,
|
||||||
const wxHandlerInfo* &handlerInfo )
|
const wxHandlerInfo* &handlerInfo )
|
||||||
{
|
{
|
||||||
// this approach would be used it the handler would not
|
// this approach would be used if the handler would not
|
||||||
// be connected really in the designer, so we have to supply
|
// be connected really in the designer, so we have to supply
|
||||||
// the information
|
// the information
|
||||||
if ( object == m_frame->GetProperty(wxT("Button")).GetAsObject() &&
|
const wxObject* but = wxAnyGetAsObjectPtr( m_frame->GetProperty(wxT("Button")) );
|
||||||
propInfo == wxCLASSINFO( wxButton )->FindPropertyInfo("OnClick") )
|
if ( object == but &&
|
||||||
|
propInfo == wxCLASSINFO( wxButton )->FindPropertyInfo(wxT("OnClick")) )
|
||||||
{
|
{
|
||||||
eventSink = m_frame;
|
eventSink = m_frame;
|
||||||
handlerInfo = m_frame->GetClassInfo()->
|
handlerInfo = m_frame->GetClassInfo()->
|
||||||
FindHandlerInfo("ButtonClickHandler");
|
FindHandlerInfo(wxT("ButtonClickHandler"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -323,8 +324,8 @@ void RegisterFrameRTTI()
|
|||||||
CLASSINFO(wxFrame) );
|
CLASSINFO(wxFrame) );
|
||||||
|
|
||||||
// this class has a property named "Button" and the relative handler:
|
// this class has a property named "Button" and the relative handler:
|
||||||
dyninfo->AddProperty("Button", wxGetTypeInfo((wxButton**) NULL));
|
dyninfo->AddProperty(wxT("Button"), wxGetTypeInfo((wxButton**) NULL));
|
||||||
dyninfo->AddHandler("ButtonClickHandler",
|
dyninfo->AddHandler(wxT("ButtonClickHandler"),
|
||||||
NULL /* no instance of the handler method */, CLASSINFO( wxEvent ) );
|
NULL /* no instance of the handler method */, CLASSINFO( wxEvent ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -332,7 +333,7 @@ void RegisterFrameRTTI()
|
|||||||
wxDynamicObject* CreateFrameRTTI()
|
wxDynamicObject* CreateFrameRTTI()
|
||||||
{
|
{
|
||||||
int baseID = 100;
|
int baseID = 100;
|
||||||
wxVariantBase Params[10];
|
wxAny Params[10];
|
||||||
|
|
||||||
// the class is now part of XTI internal table so that we can
|
// the class is now part of XTI internal table so that we can
|
||||||
// get a pointer to it just searching it like any other class:
|
// get a pointer to it just searching it like any other class:
|
||||||
@@ -341,25 +342,26 @@ wxDynamicObject* CreateFrameRTTI()
|
|||||||
wxASSERT( info );
|
wxASSERT( info );
|
||||||
wxDynamicObject* frameWrapper =
|
wxDynamicObject* frameWrapper =
|
||||||
wx_dynamic_cast(wxDynamicObject*, info->CreateObject() );
|
wx_dynamic_cast(wxDynamicObject*, info->CreateObject() );
|
||||||
Params[0] = wxVariantBase((wxWindow*)(NULL));
|
Params[0] = wxAny((wxWindow*)(NULL));
|
||||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
Params[1] = wxAny(wxWindowID(baseID++));
|
||||||
Params[2] = wxVariantBase(wxString(wxT("This is a frame created from XTI")));
|
Params[2] = wxAny(wxString(wxT("This is a frame created from XTI")));
|
||||||
Params[3] = wxVariantBase(wxPoint(-1,-1));
|
Params[3] = wxAny(wxPoint(-1,-1));
|
||||||
Params[4] = wxVariantBase(wxSize(400,300));
|
Params[4] = wxAny(wxSize(400,300));
|
||||||
Params[5] = wxVariantBase((long)wxDEFAULT_FRAME_STYLE);
|
Params[5] = wxAny((long)wxDEFAULT_FRAME_STYLE);
|
||||||
wxASSERT( info->Create(frameWrapper, 6, Params ));
|
wxASSERT( info->Create(frameWrapper, 6, Params ));
|
||||||
frame = wx_dynamic_cast(wxFrame*, frameWrapper->GetSuperClassInstance());
|
frame = wx_dynamic_cast(wxFrame*, frameWrapper->GetSuperClassInstance());
|
||||||
|
|
||||||
|
#if 1
|
||||||
// now build a notebook inside it:
|
// now build a notebook inside it:
|
||||||
wxNotebook* notebook;
|
wxNotebook* notebook;
|
||||||
info = wxClassInfo::FindClass("wxNotebook");
|
info = wxClassInfo::FindClass("wxNotebook");
|
||||||
wxASSERT( info );
|
wxASSERT( info );
|
||||||
notebook = wxDynamicCast( info->CreateObject(), wxNotebook );
|
notebook = wxDynamicCast( info->CreateObject(), wxNotebook );
|
||||||
Params[0] = wxVariantBase((wxWindow*)frame);
|
Params[0] = wxAny((wxWindow*)frame);
|
||||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
Params[1] = wxAny(wxWindowID(baseID++));
|
||||||
Params[2] = wxVariantBase(wxPoint( 10, 10 ));
|
Params[2] = wxAny(wxPoint( 10, 10 ));
|
||||||
Params[3] = wxVariantBase(wxDefaultSize);
|
Params[3] = wxAny(wxDefaultSize);
|
||||||
Params[4] = wxVariantBase((long)0);
|
Params[4] = wxAny((long)0);
|
||||||
wxASSERT( info->Create(notebook, 5, Params ));
|
wxASSERT( info->Create(notebook, 5, Params ));
|
||||||
|
|
||||||
// button page
|
// button page
|
||||||
@@ -368,12 +370,12 @@ wxDynamicObject* CreateFrameRTTI()
|
|||||||
info = wxClassInfo::FindClass("wxPanel");
|
info = wxClassInfo::FindClass("wxPanel");
|
||||||
wxASSERT( info );
|
wxASSERT( info );
|
||||||
panel = wxDynamicCast( info->CreateObject(), wxPanel );
|
panel = wxDynamicCast( info->CreateObject(), wxPanel );
|
||||||
Params[0] = wxVariantBase((wxWindow*)(notebook));
|
Params[0] = wxAny((wxWindow*)(notebook));
|
||||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
Params[1] = wxAny(wxWindowID(baseID++));
|
||||||
Params[2] = wxVariantBase(wxPoint(-1,-1));
|
Params[2] = wxAny(wxPoint(-1,-1));
|
||||||
Params[3] = wxVariantBase(wxSize(-1,-1));
|
Params[3] = wxAny(wxSize(-1,-1));
|
||||||
Params[4] = wxVariantBase((long)0);
|
Params[4] = wxAny((long)0);
|
||||||
Params[5] = wxVariantBase(wxString(wxT("Hello")));
|
Params[5] = wxAny(wxString(wxT("Hello")));
|
||||||
wxASSERT( info->Create(panel, 6, Params ));
|
wxASSERT( info->Create(panel, 6, Params ));
|
||||||
notebook->AddPage( panel, "Buttons" );
|
notebook->AddPage( panel, "Buttons" );
|
||||||
|
|
||||||
@@ -381,26 +383,26 @@ wxDynamicObject* CreateFrameRTTI()
|
|||||||
info = wxClassInfo::FindClass("wxButton");
|
info = wxClassInfo::FindClass("wxButton");
|
||||||
wxASSERT( info );
|
wxASSERT( info );
|
||||||
button = wxDynamicCast( info->CreateObject(), wxButton );
|
button = wxDynamicCast( info->CreateObject(), wxButton );
|
||||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
Params[0] = wxAny((wxWindow*)(panel));
|
||||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
Params[1] = wxAny(wxWindowID(baseID++));
|
||||||
Params[2] = wxVariantBase(wxString(wxT("Click Me!")));
|
Params[2] = wxAny(wxString(wxT("Click Me!")));
|
||||||
Params[3] = wxVariantBase(wxPoint( 10, 10 ));
|
Params[3] = wxAny(wxPoint( 10, 10 ));
|
||||||
Params[4] = wxVariantBase(wxSize(-1,-1));
|
Params[4] = wxAny(wxSize(-1,-1));
|
||||||
Params[5] = wxVariantBase((long)0);
|
Params[5] = wxAny((long)0);
|
||||||
wxASSERT( info->Create(button, 6, Params ));
|
wxASSERT( info->Create(button, 6, Params ));
|
||||||
frameWrapper->SetProperty( "Button", wxVariantBase( button ) );
|
frameWrapper->SetProperty( wxT("Button"), wxAny( button ) );
|
||||||
|
|
||||||
// other controls page
|
// other controls page
|
||||||
|
|
||||||
info = wxClassInfo::FindClass("wxPanel");
|
info = wxClassInfo::FindClass("wxPanel");
|
||||||
wxASSERT( info );
|
wxASSERT( info );
|
||||||
panel = wxDynamicCast( info->CreateObject(), wxPanel );
|
panel = wxDynamicCast( info->CreateObject(), wxPanel );
|
||||||
Params[0] = wxVariantBase((wxWindow*)(notebook));
|
Params[0] = wxAny((wxWindow*)(notebook));
|
||||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
Params[1] = wxAny(wxWindowID(baseID++));
|
||||||
Params[2] = wxVariantBase(wxPoint(-1,-1));
|
Params[2] = wxAny(wxPoint(-1,-1));
|
||||||
Params[3] = wxVariantBase(wxSize(-1,-1));
|
Params[3] = wxAny(wxSize(-1,-1));
|
||||||
Params[4] = wxVariantBase((long)0);
|
Params[4] = wxAny((long)0);
|
||||||
Params[5] = wxVariantBase(wxString(wxT("Hello")));
|
Params[5] = wxAny(wxString(wxT("Hello")));
|
||||||
wxASSERT( info->Create(panel, 6, Params ));
|
wxASSERT( info->Create(panel, 6, Params ));
|
||||||
notebook->AddPage( panel, "Other Standard controls" );
|
notebook->AddPage( panel, "Other Standard controls" );
|
||||||
|
|
||||||
@@ -408,62 +410,62 @@ wxDynamicObject* CreateFrameRTTI()
|
|||||||
info = wxClassInfo::FindClass("wxCheckBox");
|
info = wxClassInfo::FindClass("wxCheckBox");
|
||||||
wxASSERT( info );
|
wxASSERT( info );
|
||||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
Params[0] = wxAny((wxWindow*)(panel));
|
||||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
Params[1] = wxAny(wxWindowID(baseID++));
|
||||||
Params[2] = wxVariantBase(wxString(wxT("A Checkbox")));
|
Params[2] = wxAny(wxString(wxT("A Checkbox")));
|
||||||
Params[3] = wxVariantBase(wxPoint( 10, 10 ));
|
Params[3] = wxAny(wxPoint( 10, 10 ));
|
||||||
Params[4] = wxVariantBase(wxSize(-1,-1));
|
Params[4] = wxAny(wxSize(-1,-1));
|
||||||
Params[5] = wxVariantBase((long)0);
|
Params[5] = wxAny((long)0);
|
||||||
wxASSERT( info->Create(control, 6, Params ));
|
wxASSERT( info->Create(control, 6, Params ));
|
||||||
|
|
||||||
info = wxClassInfo::FindClass("wxRadioButton");
|
info = wxClassInfo::FindClass("wxRadioButton");
|
||||||
wxASSERT( info );
|
wxASSERT( info );
|
||||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
Params[0] = wxAny((wxWindow*)(panel));
|
||||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
Params[1] = wxAny(wxWindowID(baseID++));
|
||||||
Params[2] = wxVariantBase(wxString(wxT("A Radiobutton")));
|
Params[2] = wxAny(wxString(wxT("A Radiobutton")));
|
||||||
Params[3] = wxVariantBase(wxPoint( 10, 30 ));
|
Params[3] = wxAny(wxPoint( 10, 30 ));
|
||||||
Params[4] = wxVariantBase(wxSize(-1,-1));
|
Params[4] = wxAny(wxSize(-1,-1));
|
||||||
Params[5] = wxVariantBase((long)0);
|
Params[5] = wxAny((long)0);
|
||||||
wxASSERT( info->Create(control, 6, Params ));
|
wxASSERT( info->Create(control, 6, Params ));
|
||||||
|
|
||||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
Params[1] = wxAny(wxWindowID(baseID++));
|
||||||
Params[2] = wxVariantBase(wxString(wxT("Another One")));
|
Params[2] = wxAny(wxString(wxT("Another One")));
|
||||||
Params[3] = wxVariantBase(wxPoint( 10, 50 ));
|
Params[3] = wxAny(wxPoint( 10, 50 ));
|
||||||
wxASSERT( info->Create(control, 6, Params ));
|
wxASSERT( info->Create(control, 6, Params ));
|
||||||
|
|
||||||
info = wxClassInfo::FindClass("wxStaticText");
|
info = wxClassInfo::FindClass("wxStaticText");
|
||||||
wxASSERT( info );
|
wxASSERT( info );
|
||||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
Params[0] = wxAny((wxWindow*)(panel));
|
||||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
Params[1] = wxAny(wxWindowID(baseID++));
|
||||||
Params[2] = wxVariantBase(wxString(wxT("A Static Text!")));
|
Params[2] = wxAny(wxString(wxT("A Static Text!")));
|
||||||
Params[3] = wxVariantBase(wxPoint( 10, 70 ));
|
Params[3] = wxAny(wxPoint( 10, 70 ));
|
||||||
Params[4] = wxVariantBase(wxSize(-1,-1));
|
Params[4] = wxAny(wxSize(-1,-1));
|
||||||
Params[5] = wxVariantBase((long)0);
|
Params[5] = wxAny((long)0);
|
||||||
wxASSERT( info->Create(control, 6, Params ));
|
wxASSERT( info->Create(control, 6, Params ));
|
||||||
|
|
||||||
info = wxClassInfo::FindClass("wxStaticBox");
|
info = wxClassInfo::FindClass("wxStaticBox");
|
||||||
wxASSERT( info );
|
wxASSERT( info );
|
||||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
Params[0] = wxAny((wxWindow*)(panel));
|
||||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
Params[1] = wxAny(wxWindowID(baseID++));
|
||||||
Params[2] = wxVariantBase(wxString(wxT("A Static Box")));
|
Params[2] = wxAny(wxString(wxT("A Static Box")));
|
||||||
Params[3] = wxVariantBase(wxPoint( 10, 90 ));
|
Params[3] = wxAny(wxPoint( 10, 90 ));
|
||||||
Params[4] = wxVariantBase(wxSize(100,80));
|
Params[4] = wxAny(wxSize(100,80));
|
||||||
Params[5] = wxVariantBase((long)0);
|
Params[5] = wxAny((long)0);
|
||||||
wxASSERT( info->Create(control, 6, Params ));
|
wxASSERT( info->Create(control, 6, Params ));
|
||||||
|
|
||||||
info = wxClassInfo::FindClass("wxTextCtrl");
|
info = wxClassInfo::FindClass("wxTextCtrl");
|
||||||
wxASSERT( info );
|
wxASSERT( info );
|
||||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
Params[0] = wxAny((wxWindow*)(panel));
|
||||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
Params[1] = wxAny(wxWindowID(baseID++));
|
||||||
Params[2] = wxVariantBase(wxString(wxT("A Text Control")));
|
Params[2] = wxAny(wxString(wxT("A Text Control")));
|
||||||
Params[3] = wxVariantBase(wxPoint( 10, 200 ));
|
Params[3] = wxAny(wxPoint( 10, 200 ));
|
||||||
Params[4] = wxVariantBase(wxSize(-1,-1));
|
Params[4] = wxAny(wxSize(-1,-1));
|
||||||
Params[5] = wxVariantBase((long)0);
|
Params[5] = wxAny((long)0);
|
||||||
wxASSERT( info->Create(control, 6, Params ));
|
wxASSERT( info->Create(control, 6, Params ));
|
||||||
|
|
||||||
// spins and gauges page
|
// spins and gauges page
|
||||||
@@ -471,12 +473,12 @@ wxDynamicObject* CreateFrameRTTI()
|
|||||||
info = wxClassInfo::FindClass("wxPanel");
|
info = wxClassInfo::FindClass("wxPanel");
|
||||||
wxASSERT( info );
|
wxASSERT( info );
|
||||||
panel = wxDynamicCast( info->CreateObject(), wxPanel );
|
panel = wxDynamicCast( info->CreateObject(), wxPanel );
|
||||||
Params[0] = wxVariantBase((wxWindow*)(notebook));
|
Params[0] = wxAny((wxWindow*)(notebook));
|
||||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
Params[1] = wxAny(wxWindowID(baseID++));
|
||||||
Params[2] = wxVariantBase(wxPoint(-1,-1));
|
Params[2] = wxAny(wxPoint(-1,-1));
|
||||||
Params[3] = wxVariantBase(wxSize(-1,-1));
|
Params[3] = wxAny(wxSize(-1,-1));
|
||||||
Params[4] = wxVariantBase((long)0);
|
Params[4] = wxAny((long)0);
|
||||||
Params[5] = wxVariantBase(wxString(wxT("Hello")));
|
Params[5] = wxAny(wxString(wxT("Hello")));
|
||||||
wxASSERT( info->Create(panel, 6, Params ));
|
wxASSERT( info->Create(panel, 6, Params ));
|
||||||
notebook->AddPage( panel, "Spins and Sliders" );
|
notebook->AddPage( panel, "Spins and Sliders" );
|
||||||
|
|
||||||
@@ -485,11 +487,11 @@ wxDynamicObject* CreateFrameRTTI()
|
|||||||
info = wxClassInfo::FindClass("wxSpinButton");
|
info = wxClassInfo::FindClass("wxSpinButton");
|
||||||
wxASSERT( info );
|
wxASSERT( info );
|
||||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
Params[0] = wxAny((wxWindow*)(panel));
|
||||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
Params[1] = wxAny(wxWindowID(baseID++));
|
||||||
Params[2] = wxVariantBase(wxPoint( 10, 10 ));
|
Params[2] = wxAny(wxPoint( 10, 10 ));
|
||||||
Params[3] = wxVariantBase(wxSize(-1,-1));
|
Params[3] = wxAny(wxSize(-1,-1));
|
||||||
Params[4] = wxVariantBase((long)wxSP_VERTICAL | wxSP_ARROW_KEYS);
|
Params[4] = wxAny((long)wxSP_VERTICAL | wxSP_ARROW_KEYS);
|
||||||
wxASSERT( info->Create(control, 5, Params ));
|
wxASSERT( info->Create(control, 5, Params ));
|
||||||
|
|
||||||
wxENSURE_CLASS_IS_LINKED(wxSpinCtrl);
|
wxENSURE_CLASS_IS_LINKED(wxSpinCtrl);
|
||||||
@@ -497,12 +499,12 @@ wxDynamicObject* CreateFrameRTTI()
|
|||||||
info = wxClassInfo::FindClass("wxSpinCtrl");
|
info = wxClassInfo::FindClass("wxSpinCtrl");
|
||||||
wxASSERT( info );
|
wxASSERT( info );
|
||||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
Params[0] = wxAny((wxWindow*)(panel));
|
||||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
Params[1] = wxAny(wxWindowID(baseID++));
|
||||||
Params[2] = wxVariantBase(wxString("20"));
|
Params[2] = wxAny(wxString("20"));
|
||||||
Params[3] = wxVariantBase(wxPoint( 40, 10 ));
|
Params[3] = wxAny(wxPoint( 40, 10 ));
|
||||||
Params[4] = wxVariantBase(wxSize(40,-1));
|
Params[4] = wxAny(wxSize(40,-1));
|
||||||
Params[5] = wxVariantBase((long) wxSP_ARROW_KEYS);
|
Params[5] = wxAny((long) wxSP_ARROW_KEYS);
|
||||||
wxASSERT( info->Create(control, 6, Params ));
|
wxASSERT( info->Create(control, 6, Params ));
|
||||||
|
|
||||||
// MSVC likes to exclude from link wxGauge...
|
// MSVC likes to exclude from link wxGauge...
|
||||||
@@ -510,23 +512,20 @@ wxDynamicObject* CreateFrameRTTI()
|
|||||||
wxENSURE_CLASS_IS_LINKED(wxCheckBox)
|
wxENSURE_CLASS_IS_LINKED(wxCheckBox)
|
||||||
wxENSURE_CLASS_IS_LINKED(wxSpinCtrl)
|
wxENSURE_CLASS_IS_LINKED(wxSpinCtrl)
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
|
||||||
// under wxMSW wxGauge is simply #defined to wxGauge95
|
|
||||||
info = wxClassInfo::FindClass("wxGauge95");
|
|
||||||
#else
|
|
||||||
info = wxClassInfo::FindClass("wxGauge");
|
info = wxClassInfo::FindClass("wxGauge");
|
||||||
#endif
|
|
||||||
wxASSERT( info );
|
wxASSERT( info );
|
||||||
control = wxDynamicCast( info->CreateObject(), wxControl );
|
control = wxDynamicCast( info->CreateObject(), wxControl );
|
||||||
Params[0] = wxVariantBase((wxWindow*)(panel));
|
Params[0] = wxAny((wxWindow*)(panel));
|
||||||
Params[1] = wxVariantBase(wxWindowID(baseID++));
|
Params[1] = wxAny(wxWindowID(baseID++));
|
||||||
Params[2] = wxVariantBase((int) 100);
|
Params[2] = wxAny((int) 100);
|
||||||
Params[3] = wxVariantBase(wxPoint( 10, 50 ));
|
Params[3] = wxAny(wxPoint( 10, 50 ));
|
||||||
Params[4] = wxVariantBase(wxSize(-1,-1));
|
Params[4] = wxAny(wxSize(-1,-1));
|
||||||
Params[5] = wxVariantBase((long) wxGA_HORIZONTAL);
|
Params[5] = wxAny((long) wxGA_HORIZONTAL);
|
||||||
wxASSERT( info->Create(control, 6, Params ));
|
wxASSERT( info->Create(control, 6, Params ));
|
||||||
wx_dynamic_cast(wxGauge*, control)->SetValue(20);
|
wx_dynamic_cast(wxGauge*, control)->SetValue(20);
|
||||||
|
|
||||||
|
#endif
|
||||||
return frameWrapper;
|
return frameWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,7 +542,7 @@ bool SaveFrameRTTI(const wxString &testFileName, wxDynamicObject *frame)
|
|||||||
MyDesignerPersister persister(frame);
|
MyDesignerPersister persister(frame);
|
||||||
|
|
||||||
// write the given wxObject into the XML document
|
// write the given wxObject into the XML document
|
||||||
wxVariantBaseArray empty;
|
wxStringToAnyHashMap empty;
|
||||||
writer.WriteObject( frame, frame->GetClassInfo(), &persister,
|
writer.WriteObject( frame, frame->GetClassInfo(), &persister,
|
||||||
wxString("myTestFrame"), empty );
|
wxString("myTestFrame"), empty );
|
||||||
|
|
||||||
@@ -587,12 +586,24 @@ bool GenerateFrameRTTICode(const wxString &inFileName, const wxString &outFileNa
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// read the XML file using the wxObjectCodeReaderCallback
|
// read the XML file using the wxObjectCodeReaderCallback
|
||||||
wxObjectCodeReaderCallback Callbacks(&tos);
|
|
||||||
|
wxString headerincludes;
|
||||||
|
wxString sourcecode;
|
||||||
|
wxObjectCodeReaderCallback Callbacks(headerincludes,sourcecode);
|
||||||
wxObjectXmlReader Reader(root);
|
wxObjectXmlReader Reader(root);
|
||||||
|
|
||||||
// ReadObject will return the ID of the object read??
|
// ReadObject will return the ID of the object read??
|
||||||
Reader.ReadObject( wxString("myTestFrame"), &Callbacks );
|
Reader.ReadObject( wxString("myTestFrame"), &Callbacks );
|
||||||
|
|
||||||
|
// header preamble
|
||||||
|
tos <<
|
||||||
|
"#include \"wx/wxprec.h\" \n#ifdef __BORLANDC__\n#pragma hdrstop\n#endif\n#ifndef WX_PRECOMP\n#include \"wx/wx.h\" \n#endif\n\n";
|
||||||
|
// add object includes
|
||||||
|
tos.WriteString( headerincludes );
|
||||||
|
|
||||||
|
tos << "\n\nvoid test()\n{";
|
||||||
|
tos.WriteString( sourcecode );
|
||||||
|
tos << "}";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user