Fix static build using extended RTTI
Fix declaration of 'o' hides previous local declaration warnings. Change two wxCONSTRUCTOR_5 definitions using wxBitmapBundle instead of wxBitmap (this does not give build errors). wxGenericCalendarCtrl is missing all XTI implementations, so just use RTTI. And fix building the xti sample. Note the shared build still fails due to WXDLLIMPEXP related issues. Closes #22300. Closes #22301.
This commit is contained in:
committed by
Vadim Zeitlin
parent
0ba4cf8ac9
commit
5bea1dc18a
@@ -372,6 +372,10 @@ private:
|
|||||||
|
|
||||||
class WXDLLIMPEXP_BASE wxObject
|
class WXDLLIMPEXP_BASE wxObject
|
||||||
{
|
{
|
||||||
|
#if wxUSE_EXTENDED_RTTI
|
||||||
|
wxDECLARE_DYNAMIC_CLASS(wxObject);
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxObject() { m_refData = NULL; }
|
wxObject() { m_refData = NULL; }
|
||||||
virtual ~wxObject() { UnRef(); }
|
virtual ~wxObject() { UnRef(); }
|
||||||
@@ -394,8 +398,6 @@ public:
|
|||||||
|
|
||||||
bool IsKindOf(const wxClassInfo *info) const;
|
bool IsKindOf(const wxClassInfo *info) const;
|
||||||
|
|
||||||
virtual wxClassInfo *GetClassInfo() const;
|
|
||||||
|
|
||||||
// Turn on the correct set of new and delete operators
|
// Turn on the correct set of new and delete operators
|
||||||
|
|
||||||
#ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT
|
#ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT
|
||||||
@@ -440,10 +442,14 @@ public:
|
|||||||
// check if this object references the same data as the other one
|
// check if this object references the same data as the other one
|
||||||
bool IsSameAs(const wxObject& o) const { return m_refData == o.m_refData; }
|
bool IsSameAs(const wxObject& o) const { return m_refData == o.m_refData; }
|
||||||
|
|
||||||
|
#if !wxUSE_EXTENDED_RTTI
|
||||||
|
virtual wxClassInfo* GetClassInfo() const;
|
||||||
|
|
||||||
// RTTI information, usually declared by wxDECLARE_DYNAMIC_CLASS() or
|
// RTTI information, usually declared by wxDECLARE_DYNAMIC_CLASS() or
|
||||||
// similar, but done manually for the hierarchy root. Note that it's public
|
// similar, but done manually for the hierarchy root. Note that it's public
|
||||||
// for compatibility reasons, but shouldn't be accessed directly.
|
// for compatibility reasons, but shouldn't be accessed directly.
|
||||||
static wxClassInfo ms_classInfo;
|
static wxClassInfo ms_classInfo;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// ensure that our data is not shared with anybody else: if we have no
|
// ensure that our data is not shared with anybody else: if we have no
|
||||||
|
|||||||
@@ -455,6 +455,10 @@ private:
|
|||||||
wxDECLARE_NO_ASSIGN_CLASS(name); \
|
wxDECLARE_NO_ASSIGN_CLASS(name); \
|
||||||
wxDECLARE_DYNAMIC_CLASS(name)
|
wxDECLARE_DYNAMIC_CLASS(name)
|
||||||
|
|
||||||
|
#define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(name) \
|
||||||
|
wxDECLARE_NO_ASSIGN_DEF_COPY(name); \
|
||||||
|
wxDECLARE_DYNAMIC_CLASS(name)
|
||||||
|
|
||||||
#define wxDECLARE_DYNAMIC_CLASS_NO_COPY(name) \
|
#define wxDECLARE_DYNAMIC_CLASS_NO_COPY(name) \
|
||||||
wxDECLARE_NO_COPY_CLASS(name); \
|
wxDECLARE_NO_COPY_CLASS(name); \
|
||||||
wxDECLARE_DYNAMIC_CLASS(name)
|
wxDECLARE_DYNAMIC_CLASS(name)
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ wxString DumpHandlerInfo(const wxHandlerInfo *phdlr, int indent)
|
|||||||
return ind + "none";
|
return ind + "none";
|
||||||
|
|
||||||
infostr << ind << "event class: " <<
|
infostr << ind << "event class: " <<
|
||||||
(phdlr->GetEventClassInfo() ? phdlr->GetEventClassInfo()->GetClassName() : "none");
|
(phdlr->GetEventClassInfo() ? wxString(phdlr->GetEventClassInfo()->GetClassName()) : "none");
|
||||||
|
|
||||||
return infostr;
|
return infostr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -277,13 +277,13 @@ public:
|
|||||||
// this approach would be used if 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
|
||||||
const wxObject* but = wxAnyGetAsObjectPtr( m_frame->GetProperty("Button") );
|
const wxObject* but = wxAnyGetAsObjectPtr( m_frame->GetProperty(wxT("Button")) );
|
||||||
if ( object == but &&
|
if ( object == but &&
|
||||||
propInfo == wxCLASSINFO( wxButton )->FindPropertyInfo("OnClick") )
|
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;
|
||||||
@@ -315,13 +315,13 @@ void RegisterFrameRTTI()
|
|||||||
wx_dynamic_cast( wxDynamicClassInfo *, wxClassInfo::FindClass("MyXTIFrame"));
|
wx_dynamic_cast( wxDynamicClassInfo *, wxClassInfo::FindClass("MyXTIFrame"));
|
||||||
if ( dyninfo == NULL )
|
if ( dyninfo == NULL )
|
||||||
{
|
{
|
||||||
dyninfo = new wxDynamicClassInfo("myxtiframe.h",
|
dyninfo = new wxDynamicClassInfo(wxT("myxtiframe.h"),
|
||||||
"MyXTIFrame",
|
wxT("MyXTIFrame"),
|
||||||
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 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -386,7 +386,7 @@ wxDynamicObject* CreateFrameRTTI()
|
|||||||
Params[4] = wxAny(wxSize(-1,-1));
|
Params[4] = wxAny(wxSize(-1,-1));
|
||||||
Params[5] = wxAny((long)0);
|
Params[5] = wxAny((long)0);
|
||||||
wxASSERT( info->Create(button, 6, Params ));
|
wxASSERT( info->Create(button, 6, Params ));
|
||||||
frameWrapper->SetProperty( "Button", wxAny( button ) );
|
frameWrapper->SetProperty( wxT("Button"), wxAny( button ) );
|
||||||
|
|
||||||
// other controls page
|
// other controls page
|
||||||
|
|
||||||
@@ -701,10 +701,10 @@ void MyFrame::OnGenerateCode(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxStringOutputStream str;
|
wxStringOutputStream str;
|
||||||
f.Read(str);
|
f.Read(str);
|
||||||
|
|
||||||
wxDialog dlg(this, wxID_ANY, "Generated code",
|
wxDialog dlg3(this, wxID_ANY, "Generated code",
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE);
|
wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE);
|
||||||
wxPanel *panel = new wxPanel(&dlg);
|
wxPanel *panel = new wxPanel(&dlg3);
|
||||||
wxSizer *sz = new wxBoxSizer(wxVERTICAL);
|
wxSizer *sz = new wxBoxSizer(wxVERTICAL);
|
||||||
sz->Add(new wxTextCtrl(panel, wxID_ANY, str.GetString(),
|
sz->Add(new wxTextCtrl(panel, wxID_ANY, str.GetString(),
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
@@ -712,7 +712,7 @@ void MyFrame::OnGenerateCode(wxCommandEvent& WXUNUSED(event))
|
|||||||
1, wxGROW|wxALL, 5);
|
1, wxGROW|wxALL, 5);
|
||||||
sz->Add(new wxButton(panel, wxID_OK), 0, wxALIGN_RIGHT|wxALL, 5);
|
sz->Add(new wxButton(panel, wxID_OK), 0, wxALIGN_RIGHT|wxALL, 5);
|
||||||
panel->SetSizerAndFit(sz);
|
panel->SetSizerAndFit(sz);
|
||||||
dlg.ShowModal();
|
dlg3.ShowModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ wxEND_PROPERTIES_TABLE()
|
|||||||
wxEMPTY_HANDLERS_TABLE(wxBitmapButton)
|
wxEMPTY_HANDLERS_TABLE(wxBitmapButton)
|
||||||
|
|
||||||
wxCONSTRUCTOR_5( wxBitmapButton, wxWindow*, Parent, wxWindowID, Id, \
|
wxCONSTRUCTOR_5( wxBitmapButton, wxWindow*, Parent, wxWindowID, Id, \
|
||||||
wxBitmap, Bitmap, wxPoint, Position, wxSize, Size )
|
wxBitmapBundle, BitmapBundle, wxPoint, Position, wxSize, Size )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO PROPERTIES :
|
TODO PROPERTIES :
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ wxEND_PROPERTIES_TABLE()
|
|||||||
wxEMPTY_HANDLERS_TABLE(wxStaticBitmap)
|
wxEMPTY_HANDLERS_TABLE(wxStaticBitmap)
|
||||||
|
|
||||||
wxCONSTRUCTOR_5( wxStaticBitmap, wxWindow*, Parent, wxWindowID, Id, \
|
wxCONSTRUCTOR_5( wxStaticBitmap, wxWindow*, Parent, wxWindowID, Id, \
|
||||||
wxBitmap, Bitmap, wxPoint, Position, wxSize, Size )
|
wxBitmapBundle, BitmapBundle, wxPoint, Position, wxSize, Size )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO PROPERTIES :
|
TODO PROPERTIES :
|
||||||
|
|||||||
@@ -504,25 +504,25 @@ void wxObjectRuntimeReaderCallback::CreateObject(int objectID,
|
|||||||
const wxClassInfo **objectClassInfos,
|
const wxClassInfo **objectClassInfos,
|
||||||
wxStringToAnyHashMap &WXUNUSED(metadata))
|
wxStringToAnyHashMap &WXUNUSED(metadata))
|
||||||
{
|
{
|
||||||
wxObject *o;
|
wxObject *o1;
|
||||||
o = m_data->GetObject(objectID);
|
o1 = m_data->GetObject(objectID);
|
||||||
for ( int i = 0; i < paramCount; ++i )
|
for ( int i = 0; i < paramCount; ++i )
|
||||||
{
|
{
|
||||||
if ( objectIdValues[i] != wxInvalidObjectID )
|
if ( objectIdValues[i] != wxInvalidObjectID )
|
||||||
{
|
{
|
||||||
wxObject *o;
|
wxObject *o2;
|
||||||
o = m_data->GetObject(objectIdValues[i]);
|
o2 = m_data->GetObject(objectIdValues[i]);
|
||||||
// if this is a dynamic object and we are asked for another class
|
// if this is a dynamic object and we are asked for another class
|
||||||
// than wxDynamicObject we cast it down manually.
|
// than wxDynamicObject we cast it down manually.
|
||||||
wxDynamicObject *dyno = wx_dynamic_cast( wxDynamicObject *, o);
|
wxDynamicObject *dyno = wx_dynamic_cast( wxDynamicObject *, o2);
|
||||||
if ( dyno!=NULL && (objectClassInfos[i] != dyno->GetClassInfo()) )
|
if ( dyno!=NULL && (objectClassInfos[i] != dyno->GetClassInfo()) )
|
||||||
{
|
{
|
||||||
o = dyno->GetSuperClassInstance();
|
o2 = dyno->GetSuperClassInstance();
|
||||||
}
|
}
|
||||||
params[i] = objectClassInfos[i]->ObjectPtrToAny(o);
|
params[i] = objectClassInfos[i]->ObjectPtrToAny(o2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
classInfo->Create(o, paramCount, params);
|
classInfo->Create(o1, paramCount, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxObjectRuntimeReaderCallback::ConstructObject(int objectID,
|
void wxObjectRuntimeReaderCallback::ConstructObject(int objectID,
|
||||||
@@ -533,25 +533,25 @@ void wxObjectRuntimeReaderCallback::ConstructObject(int objectID,
|
|||||||
const wxClassInfo **objectClassInfos,
|
const wxClassInfo **objectClassInfos,
|
||||||
wxStringToAnyHashMap &WXUNUSED(metadata))
|
wxStringToAnyHashMap &WXUNUSED(metadata))
|
||||||
{
|
{
|
||||||
wxObject *o;
|
wxObject *o1;
|
||||||
for ( int i = 0; i < paramCount; ++i )
|
for ( int i = 0; i < paramCount; ++i )
|
||||||
{
|
{
|
||||||
if ( objectIdValues[i] != wxInvalidObjectID )
|
if ( objectIdValues[i] != wxInvalidObjectID )
|
||||||
{
|
{
|
||||||
wxObject *o;
|
wxObject *o2;
|
||||||
o = m_data->GetObject(objectIdValues[i]);
|
o2 = m_data->GetObject(objectIdValues[i]);
|
||||||
// if this is a dynamic object and we are asked for another class
|
// if this is a dynamic object and we are asked for another class
|
||||||
// than wxDynamicObject we cast it down manually.
|
// than wxDynamicObject we cast it down manually.
|
||||||
wxDynamicObject *dyno = wx_dynamic_cast( wxDynamicObject *, o);
|
wxDynamicObject *dyno = wx_dynamic_cast( wxDynamicObject *, o2);
|
||||||
if ( dyno!=NULL && (objectClassInfos[i] != dyno->GetClassInfo()) )
|
if ( dyno!=NULL && (objectClassInfos[i] != dyno->GetClassInfo()) )
|
||||||
{
|
{
|
||||||
o = dyno->GetSuperClassInstance();
|
o2 = dyno->GetSuperClassInstance();
|
||||||
}
|
}
|
||||||
params[i] = objectClassInfos[i]->ObjectPtrToAny(o);
|
params[i] = objectClassInfos[i]->ObjectPtrToAny(o2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
o = classInfo->ConstructObject(paramCount, params);
|
o1 = classInfo->ConstructObject(paramCount, params);
|
||||||
m_data->SetObject(objectID, o);
|
m_data->SetObject(objectID, o1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
#ifdef wxHAS_NATIVE_CALENDARCTRL
|
#ifdef wxHAS_NATIVE_CALENDARCTRL
|
||||||
|
|
||||||
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxGenericCalendarCtrl, wxControl, "wx/calctrl.h");
|
wxIMPLEMENT_DYNAMIC_CLASS(wxGenericCalendarCtrl, wxControl);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user