Remove (most) occurrences of wxT() macro from the samples

Also replace wxChar* with wxString.

Closes https://github.com/wxWidgets/wxWidgets/pull/945
This commit is contained in:
Blake-Eryx
2018-09-23 01:15:08 +02:00
committed by Vadim Zeitlin
parent e768046774
commit f58ea62596
93 changed files with 4362 additions and 4358 deletions

View File

@@ -102,14 +102,14 @@ void ClassListDialog::CreateControls()
wxBoxSizer* filters = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(filters, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
filters->Add(new wxCheckBox(this, ID_SHOW_ONLY_XTI,
wxT("Show only classes with eXtended infos")));
"Show only classes with eXtended infos"));
filters->AddSpacer(10);
filters->Add(new wxCheckBox(this, ID_SHOW_PROPERTIES_RECURSIVELY,
wxT("Show properties of parent classes")));
"Show properties of parent classes"));
// show how many have we filtered out
m_pClassCountText = new wxStaticText( this, wxID_STATIC,
wxT("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
wxDefaultPosition, wxDefaultSize, 0 );
m_pClassCountText->SetFont(wxFontInfo(8).Family(wxFONTFAMILY_SWISS).Bold());
itemBoxSizer2->Add(m_pClassCountText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
@@ -154,7 +154,7 @@ void ClassListDialog::CreateControls()
itemBoxSizer5->Add(m_pChoiceBook, 0, wxGROW|wxALL, 5);
m_pTextCtrl = new wxTextCtrl( this, ID_TEXTCTRL, wxT(""), wxDefaultPosition, wxSize(500, -1), wxTE_MULTILINE|wxTE_READONLY );
m_pTextCtrl = new wxTextCtrl( this, ID_TEXTCTRL, "", wxDefaultPosition, wxSize(500, -1), wxTE_MULTILINE|wxTE_READONLY );
itemBoxSizer5->Add(m_pTextCtrl, 3, wxGROW|wxALL, 5);
wxStdDialogButtonSizer* itemStdDialogButtonSizer17 = new wxStdDialogButtonSizer;
@@ -187,7 +187,7 @@ int ClassListDialog::AddClassesWithParent(const wxClassInfo *parent, const wxTre
int ret = AddClassesWithParent(ci, child);
m_pParentTreeCtrl->SetItemText(child,
m_pParentTreeCtrl->GetItemText(child) +
wxString::Format(wxT(" [%d]"), ret));
wxString::Format(" [%d]", ret));
count += ret+1;
}
@@ -241,12 +241,12 @@ void ClassListDialog::InitControls()
m_pSizeListBox->Append(arr[i]);
// add root item to parent-mode treectrl
wxTreeItemId id = m_pParentTreeCtrl->AddRoot(wxT("wxObject"));
wxTreeItemId id = m_pParentTreeCtrl->AddRoot("wxObject");
// recursively add all leaves to the treectrl
int count = AddClassesWithParent(CLASSINFO(wxObject), id);
m_pParentTreeCtrl->SetItemText(id, m_pParentTreeCtrl->GetItemText(id) +
wxString::Format(wxT(" [%d]"), count));
wxString::Format(" [%d]", count));
// initially expand the root item
m_pParentTreeCtrl->Expand(id);
@@ -281,13 +281,13 @@ void ClassListDialog::UpdateFilterText()
// how many are we showing
m_pClassCountText->SetLabel(
wxString::Format(
wxT("Showing %d classes on a total of %d registered classes in wxXTI."),
"Showing %d classes on a total of %d registered classes in wxXTI.",
m_nCount, m_nTotalCount));
}
void ClassListDialog::UpdateClassInfo(const wxString &itemName)
{
wxString classname = itemName.BeforeFirst(wxT(' '));
wxString classname = itemName.BeforeFirst(' ');
wxCheckBox *cb = static_cast<wxCheckBox*>(FindWindow(ID_SHOW_PROPERTIES_RECURSIVELY));
m_pTextCtrl->SetValue(
@@ -367,68 +367,68 @@ void ClassListDialog::OnChoiceBookPageChange( wxChoicebookEvent& event )
wxString DumpStr(const wxString &str)
{
if (str.empty())
return wxT("none");
return "none";
return str;
}
wxString DumpTypeInfo(const wxTypeInfo *ti)
{
if (!ti)
return wxT("none");
return "none";
return DumpStr(ti->GetTypeName());
}
wxString DumpPropertyAccessor(const wxPropertyAccessor *acc, int indent)
{
wxString ind = wxT("\n") + wxString(indent, wxT(' '));
wxString ind = "\n" + wxString(indent, ' ');
wxString infostr;
if (!acc)
return ind + wxT("no property accessors");
return ind + "no property accessors";
if (acc->HasSetter())
infostr << ind << wxT("setter name: ") << acc->GetSetterName();
infostr << ind << "setter name: " << acc->GetSetterName();
if (acc->HasCollectionGetter())
infostr << ind << wxT("collection getter name: ") << acc->GetCollectionGetterName();
infostr << ind << "collection getter name: " << acc->GetCollectionGetterName();
if (acc->HasGetter())
infostr << ind << wxT("getter name: ") << acc->GetGetterName();
infostr << ind << "getter name: " << acc->GetGetterName();
if (acc->HasAdder())
infostr << ind << wxT("adder name: ") << acc->GetAdderName();
infostr << ind << "adder name: " << acc->GetAdderName();
return infostr;
}
wxString DumpPropertyInfo(const wxPropertyInfo *prop, int indent)
{
wxString ind = wxT("\n") + wxString(indent, wxT(' '));
wxString ind = "\n" + wxString(indent, ' ');
wxString infostr;
if (!prop)
return ind + wxT("none");
return ind + "none";
infostr << ind << wxT("flags: ");
infostr << ind << "flags: ";
if (prop->GetFlags() & wxPROP_DEPRECATED)
infostr << wxT("wxPROP_DEPRECATED,");
infostr << "wxPROP_DEPRECATED,";
if (prop->GetFlags() & wxPROP_OBJECT_GRAPH)
infostr << wxT("wxPROP_OBJECT_GRAPH,");
infostr << "wxPROP_OBJECT_GRAPH,";
if (prop->GetFlags() & wxPROP_ENUM_STORE_LONG)
infostr << wxT("wxPROP_ENUM_STORE_LONG,");
infostr << "wxPROP_ENUM_STORE_LONG,";
if (prop->GetFlags() & wxPROP_DONT_STREAM)
infostr << wxT("wxPROP_DONT_STREAM,");
infostr << "wxPROP_DONT_STREAM,";
if (prop->GetFlags() == 0)
infostr << wxT("none");
infostr << "none";
else
infostr.RemoveLast(); // remove last comma
infostr << ind << wxT("help string: ") << DumpStr(prop->GetHelpString());
infostr << ind << wxT("group string: ") << DumpStr(prop->GetGroupString());
infostr << ind << "help string: " << DumpStr(prop->GetHelpString());
infostr << ind << "group string: " << DumpStr(prop->GetGroupString());
infostr << ind << wxT("collection element type: ") << DumpTypeInfo(prop->GetCollectionElementTypeInfo());
infostr << ind << wxT("type: ") << DumpTypeInfo(prop->GetTypeInfo());
infostr << ind << "collection element type: " << DumpTypeInfo(prop->GetCollectionElementTypeInfo());
infostr << ind << "type: " << DumpTypeInfo(prop->GetTypeInfo());
infostr << ind << wxT("default value: ") << DumpStr(wxAnyGetAsString(prop->GetDefaultValue()));
infostr << ind << "default value: " << DumpStr(wxAnyGetAsString(prop->GetDefaultValue()));
infostr << DumpPropertyAccessor(prop->GetAccessor(), indent+1);
return infostr;
@@ -436,14 +436,14 @@ wxString DumpPropertyInfo(const wxPropertyInfo *prop, int indent)
wxString DumpHandlerInfo(const wxHandlerInfo *phdlr, int indent)
{
wxString ind = wxT("\n") + wxString(indent, wxT(' '));
wxString ind = "\n" + wxString(indent, ' ');
wxString infostr;
if (!phdlr)
return ind + wxT("none");
return ind + "none";
infostr << ind << wxT("event class: ") <<
(phdlr->GetEventClassInfo() ? phdlr->GetEventClassInfo()->GetClassName() : wxT("none"));
infostr << ind << "event class: " <<
(phdlr->GetEventClassInfo() ? phdlr->GetEventClassInfo()->GetClassName() : "none");
return infostr;
}
@@ -456,12 +456,12 @@ int DumpProperties(const wxClassInfo *info, wxString& infostr, bool recursive)
prop;
prop = prop->GetNext(), pcount++)
{
infostr << wxT("\n\n [") << pcount+1 << wxT("] Property: ") << prop->GetName();
infostr << "\n\n [" << pcount+1 << "] Property: " << prop->GetName();
infostr << DumpPropertyInfo(prop, 4);
}
if (pcount == 0)
infostr << wxT("\n None");
infostr << "\n None";
if (recursive)
{
@@ -474,7 +474,7 @@ int DumpProperties(const wxClassInfo *info, wxString& infostr, bool recursive)
if (ppcount)
{
pcount += ppcount;
infostr << wxT("\n\n ") << parent[i]->GetClassName() << wxT(" PARENT'S PROPERTIES:");
infostr << "\n\n " << parent[i]->GetClassName() << " PARENT'S PROPERTIES:";
infostr << str;
}
}
@@ -491,12 +491,12 @@ int DumpHandlers(const wxClassInfo *info, wxString& infostr, bool recursive)
h;
h = h->GetNext(), hcount++)
{
infostr << wxT("\n\n [") << hcount+1 << wxT("] Handler: ") << h->GetName();
infostr << "\n\n [" << hcount+1 << "] Handler: " << h->GetName();
infostr << DumpHandlerInfo(h, 4);
}
if (hcount == 0)
infostr << wxT("\n None");
infostr << "\n None";
if (recursive)
{
@@ -509,7 +509,7 @@ int DumpHandlers(const wxClassInfo *info, wxString& infostr, bool recursive)
if (hhcount)
{
hcount += hhcount;
infostr << wxT("\n\n ") << parent[i]->GetClassName() << wxT(" PARENT'S HANDLERS:");
infostr << "\n\n " << parent[i]->GetClassName() << " PARENT'S HANDLERS:";
infostr << str;
}
}
@@ -527,32 +527,32 @@ wxString DumpClassInfo(const wxClassInfo *info, bool recursive)
// basic stuff:
infostr << wxT("\n BASIC RTTI INFO ABOUT ") << info->GetClassName();
infostr << wxT("\n =================================================");
infostr << wxT("\n Base class #1: ") << DumpStr(info->GetBaseClassName1());
infostr << wxT("\n Base class #2: ") << DumpStr(info->GetBaseClassName2());
infostr << wxT("\n Include file: ") << DumpStr(info->GetIncludeName());
infostr << wxT("\n Size: ") << info->GetSize();
infostr << wxT("\n Dynamic: ") << (info->IsDynamic() ? wxT("true") : wxT("false"));
infostr << "\n BASIC RTTI INFO ABOUT " << info->GetClassName();
infostr << "\n =================================================";
infostr << "\n Base class #1: " << DumpStr(info->GetBaseClassName1());
infostr << "\n Base class #2: " << DumpStr(info->GetBaseClassName2());
infostr << "\n Include file: " << DumpStr(info->GetIncludeName());
infostr << "\n Size: " << info->GetSize();
infostr << "\n Dynamic: " << (info->IsDynamic() ? "true" : "false");
// advanced stuff:
infostr << wxT("\n\n\n ADVANCED RTTI INFO ABOUT ") << info->GetClassName();
infostr << wxT("\n =================================================\n");
infostr << wxT("\n PROPERTIES");
infostr << wxT("\n -----------------------------------------");
infostr << "\n\n\n ADVANCED RTTI INFO ABOUT " << info->GetClassName();
infostr << "\n =================================================\n";
infostr << "\n PROPERTIES";
infostr << "\n -----------------------------------------";
int pcount = DumpProperties(info, infostr, recursive);
infostr << wxT("\n\n HANDLERS");
infostr << wxT("\n -----------------------------------------");
infostr << "\n\n HANDLERS";
infostr << "\n -----------------------------------------";
int hcount = DumpHandlers(info, infostr, recursive);
if (pcount+hcount == 0)
infostr << wxT("\n\n no advanced info\n");
infostr << "\n\n no advanced info\n";
else
{
infostr << wxT("\n\n Total count of properties: ") << pcount;
infostr << wxT("\n Total count of handlers: ") << hcount << wxT("\n");
infostr << "\n\n Total count of properties: " << pcount;
infostr << "\n Total count of handlers: " << hcount << "\n";
}
return infostr;

View File

@@ -61,7 +61,7 @@ struct wxObjectCodeReaderCallback::wxObjectCodeReaderCallbackInternal
wxString GetObjectName( int objectID )
{
if ( objectID == wxNullObjectID )
return wxT("NULL");
return "NULL";
if ( m_objectNames.find(objectID) == m_objectNames.end() )
{
@@ -95,8 +95,8 @@ void wxObjectCodeReaderCallback::AllocateObject(int objectID, wxClassInfo *class
m_headerincludes += include;
}
wxString objectName = wxString::Format( wxT("LocalObject_%d"), objectID );
m_source += ( wxString::Format( wxT("\t%s *%s = new %s;\n"),
wxString objectName = wxString::Format( "LocalObject_%d", objectID );
m_source += ( wxString::Format( "\t%s *%s = new %s;\n",
classInfo->GetClassName(),
objectName.c_str(),
classInfo->GetClassName()) );
@@ -105,7 +105,7 @@ void wxObjectCodeReaderCallback::AllocateObject(int objectID, wxClassInfo *class
void wxObjectCodeReaderCallback::DestroyObject(int objectID, wxClassInfo *WXUNUSED(classInfo))
{
m_source += ( wxString::Format( wxT("\tdelete %s;\n"),
m_source += ( wxString::Format( "\tdelete %s;\n",
m_data->GetObjectName( objectID).c_str() ) );
}
@@ -150,7 +150,7 @@ wxString wxObjectCodeReaderCallback::ValueAsCode( const wxAny &param )
const wxCustomTypeInfo* cti = wx_dynamic_cast(const wxCustomTypeInfo*, type);
if ( cti )
{
value.Printf( wxT("%s(%s)"), cti->GetTypeName().c_str(),
value.Printf( "%s(%s)", cti->GetTypeName().c_str(),
wxAnyGetAsString(param).c_str() );
}
else
@@ -172,13 +172,13 @@ wxString wxObjectCodeReaderCallback::ValueAsCode( const wxAny &param )
ci->CallOnAny(param,&cw);
value.Printf( wxT("%s(%s)"), ctype->GetClassInfo()->GetClassName(),
value.Printf( "%s(%s)", ctype->GetClassInfo()->GetClassName(),
cw.GetConstructorString() );
}
}
else
{
value.Printf( wxT("%s"), wxAnyGetAsString(param).c_str() );
value.Printf( "%s", wxAnyGetAsString(param).c_str() );
}
return value;
@@ -194,26 +194,26 @@ void wxObjectCodeReaderCallback::CreateObject(int objectID,
)
{
int i;
m_source += ( wxString::Format( wxT("\t%s->Create("),
m_source += ( wxString::Format( "\t%s->Create(",
m_data->GetObjectName(objectID).c_str() ) );
for (i = 0; i < paramCount; i++)
{
if ( objectIDValues[i] != wxInvalidObjectID )
{
wxString str =
wxString::Format( wxT("%s"),
wxString::Format( "%s",
m_data->GetObjectName( objectIDValues[i] ).c_str() );
m_source += ( str );
}
else
{
m_source += (
wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) );
wxString::Format( "%s", ValueAsCode(params[i]).c_str() ) );
}
if (i < paramCount - 1)
m_source += ( wxT(", "));
m_source += ( ", ");
}
m_source += ( wxT(");\n") );
m_source += ( ");\n" );
}
void wxObjectCodeReaderCallback::ConstructObject(int objectID,
@@ -225,8 +225,8 @@ void wxObjectCodeReaderCallback::ConstructObject(int objectID,
wxStringToAnyHashMap &WXUNUSED(metadata)
)
{
wxString objectName = wxString::Format( wxT("LocalObject_%d"), objectID );
m_source += ( wxString::Format( wxT("\t%s *%s = new %s("),
wxString objectName = wxString::Format( "LocalObject_%d", objectID );
m_source += ( wxString::Format( "\t%s *%s = new %s(",
classInfo->GetClassName(),
objectName.c_str(),
classInfo->GetClassName()) );
@@ -236,17 +236,17 @@ void wxObjectCodeReaderCallback::ConstructObject(int objectID,
for (i = 0; i < paramCount; i++)
{
if ( objectIDValues[i] != wxInvalidObjectID )
m_source += ( wxString::Format( wxT("%s"),
m_source += ( wxString::Format( "%s",
m_data->GetObjectName( objectIDValues[i] ).c_str() ) );
else
{
m_source += (
wxString::Format( wxT("%s"), ValueAsCode(params[i]).c_str() ) );
wxString::Format( "%s", ValueAsCode(params[i]).c_str() ) );
}
if (i < paramCount - 1)
m_source += ( wxT(", ") );
m_source += ( ", " );
}
m_source += ( wxT(");\n") );
m_source += ( ");\n" );
}
void wxObjectCodeReaderCallback::SetProperty(int objectID,
@@ -254,7 +254,7 @@ void wxObjectCodeReaderCallback::SetProperty(int objectID,
const wxPropertyInfo* propertyInfo,
const wxAny &value)
{
m_source += ( wxString::Format( wxT("\t%s->%s(%s);\n"),
m_source += ( wxString::Format( "\t%s->%s(%s);\n",
m_data->GetObjectName(objectID).c_str(),
propertyInfo->GetAccessor()->GetSetterName().c_str(),
ValueAsCode(value).c_str()) );
@@ -266,12 +266,12 @@ void wxObjectCodeReaderCallback::SetPropertyAsObject(int objectID,
int valueObjectId)
{
if ( propertyInfo->GetTypeInfo()->GetKind() == wxT_OBJECT )
m_source += ( wxString::Format( wxT("\t%s->%s(*%s);\n"),
m_source += ( wxString::Format( "\t%s->%s(*%s);\n",
m_data->GetObjectName(objectID).c_str(),
propertyInfo->GetAccessor()->GetSetterName().c_str(),
m_data->GetObjectName( valueObjectId).c_str() ) );
else
m_source += ( wxString::Format( wxT("\t%s->%s(%s);\n"),
m_source += ( wxString::Format( "\t%s->%s(%s);\n",
m_data->GetObjectName(objectID).c_str(),
propertyInfo->GetAccessor()->GetSetterName().c_str(),
m_data->GetObjectName( valueObjectId).c_str() ) );
@@ -282,7 +282,7 @@ void wxObjectCodeReaderCallback::AddToPropertyCollection( int objectID,
const wxPropertyInfo* propertyInfo,
const wxAny &value)
{
m_source += ( wxString::Format( wxT("\t%s->%s(%s);\n"),
m_source += ( wxString::Format( "\t%s->%s(%s);\n",
m_data->GetObjectName(objectID).c_str(),
propertyInfo->GetAccessor()->GetAdderName().c_str(),
ValueAsCode(value).c_str()) );
@@ -317,8 +317,8 @@ void wxObjectCodeReaderCallback::SetConnect(int eventSourceObjectID,
wxString code =
wxString::Format(
wxT("\t%s->Connect( %s->GetId(), %d, ")
wxT("(wxObjectEventFunction)(wxEventFunction) & %s::%s, NULL, %s );"),
"\t%s->Connect( %s->GetId(), %d, "
"(wxObjectEventFunction)(wxEventFunction) & %s::%s, NULL, %s );",
ehsource.c_str(), ehsource.c_str(), eventType, ehsinkClass.c_str(),
handlerName.c_str(), ehsink.c_str() );

View File

@@ -140,7 +140,7 @@ bool MyApp::OnInit()
RegisterFrameRTTI();
// create the main application window
MyFrame *frame = new MyFrame(wxT("Extended RTTI sample"));
MyFrame *frame = new MyFrame("Extended RTTI sample");
// and show it (the frames, unlike simple controls, are not shown when
// created initially)
@@ -168,24 +168,24 @@ MyFrame::MyFrame(const wxString& title)
// the "About" item should be in the help menu
wxMenu *helpMenu = new wxMenu;
helpMenu->Append(Minimal_About, wxT("&About\tF1"), wxT("Show about dialog"));
helpMenu->Append(Minimal_About, "&About\tF1", "Show about dialog");
fileMenu->Append(Minimal_Persist, wxT("Persist a wxFrame to XML..."),
wxT("Creates a wxFrame using wxXTI and saves its description as XML"));
fileMenu->Append(Minimal_Depersist, wxT("Depersist XML file..."),
wxT("Loads the description of wxFrame from XML"));
fileMenu->Append(Minimal_GenerateCode, wxT("Generate code for a wxFrame saved to XML..."),
wxT("Generates the C++ code which belong to a persisted wxFrame"));
fileMenu->Append(Minimal_Persist, "Persist a wxFrame to XML...",
"Creates a wxFrame using wxXTI and saves its description as XML");
fileMenu->Append(Minimal_Depersist, "Depersist XML file...",
"Loads the description of wxFrame from XML");
fileMenu->Append(Minimal_GenerateCode, "Generate code for a wxFrame saved to XML...",
"Generates the C++ code which belong to a persisted wxFrame");
fileMenu->AppendSeparator();
fileMenu->Append(Minimal_DumpClasses, wxT("Dump registered classes..."),
wxT("Dumps the description of all wxWidgets classes registered in XTI"));
fileMenu->Append(Minimal_DumpClasses, "Dump registered classes...",
"Dumps the description of all wxWidgets classes registered in XTI");
fileMenu->AppendSeparator();
fileMenu->Append(Minimal_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program"));
fileMenu->Append(Minimal_Quit, "E&xit\tAlt-X", "Quit this program");
// now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(fileMenu, wxT("&File"));
menuBar->Append(helpMenu, wxT("&Help"));
menuBar->Append(fileMenu, "&File");
menuBar->Append(helpMenu, "&Help");
// ... and attach this menu bar to the frame
SetMenuBar(menuBar);
@@ -194,7 +194,7 @@ MyFrame::MyFrame(const wxString& title)
#if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets!"));
SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR
}
@@ -280,13 +280,13 @@ public:
// this approach would be used if the handler would not
// be connected really in the designer, so we have to supply
// the information
const wxObject* but = wxAnyGetAsObjectPtr( m_frame->GetProperty(wxT("Button")) );
const wxObject* but = wxAnyGetAsObjectPtr( m_frame->GetProperty("Button") );
if ( object == but &&
propInfo == wxCLASSINFO( wxButton )->FindPropertyInfo(wxT("OnClick")) )
propInfo == wxCLASSINFO( wxButton )->FindPropertyInfo("OnClick") )
{
eventSink = m_frame;
handlerInfo = m_frame->GetClassInfo()->
FindHandlerInfo(wxT("ButtonClickHandler"));
FindHandlerInfo("ButtonClickHandler");
return true;
}
return false;
@@ -315,16 +315,16 @@ void RegisterFrameRTTI()
// set up the RTTI info for a class (MyXTIFrame) which
// is not defined anywhere in this program
wxDynamicClassInfo *dyninfo =
wx_dynamic_cast( wxDynamicClassInfo *, wxClassInfo::FindClass(wxT("MyXTIFrame")));
wx_dynamic_cast( wxDynamicClassInfo *, wxClassInfo::FindClass("MyXTIFrame"));
if ( dyninfo == NULL )
{
dyninfo = new wxDynamicClassInfo(wxT("myxtiframe.h"),
wxT("MyXTIFrame"),
dyninfo = new wxDynamicClassInfo("myxtiframe.h",
"MyXTIFrame",
CLASSINFO(wxFrame) );
// this class has a property named "Button" and the relative handler:
dyninfo->AddProperty(wxT("Button"), wxGetTypeInfo((wxButton**) NULL));
dyninfo->AddHandler(wxT("ButtonClickHandler"),
dyninfo->AddProperty("Button", wxGetTypeInfo((wxButton**) NULL));
dyninfo->AddHandler("ButtonClickHandler",
NULL /* no instance of the handler method */, CLASSINFO( wxEvent ) );
}
}
@@ -337,13 +337,13 @@ wxDynamicObject* CreateFrameRTTI()
// 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:
wxFrame* frame;
wxClassInfo *info = wxClassInfo::FindClass(wxT("MyXTIFrame"));
wxClassInfo *info = wxClassInfo::FindClass("MyXTIFrame");
wxASSERT( info );
wxDynamicObject* frameWrapper =
wx_dynamic_cast(wxDynamicObject*, info->CreateObject() );
Params[0] = wxAny((wxWindow*)(NULL));
Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("This is a frame created from XTI")));
Params[2] = wxAny(wxString("This is a frame created from XTI"));
Params[3] = wxAny(wxPoint(-1,-1));
Params[4] = wxAny(wxSize(400,300));
Params[5] = wxAny((long)wxDEFAULT_FRAME_STYLE);
@@ -374,7 +374,7 @@ wxDynamicObject* CreateFrameRTTI()
Params[2] = wxAny(wxPoint(-1,-1));
Params[3] = wxAny(wxSize(-1,-1));
Params[4] = wxAny((long)0);
Params[5] = wxAny(wxString(wxT("Hello")));
Params[5] = wxAny(wxString("Hello"));
wxASSERT( info->Create(panel, 6, Params ));
notebook->AddPage( panel, "Buttons" );
@@ -384,12 +384,12 @@ wxDynamicObject* CreateFrameRTTI()
button = wxDynamicCast( info->CreateObject(), wxButton );
Params[0] = wxAny((wxWindow*)(panel));
Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("Click Me!")));
Params[2] = wxAny(wxString("Click Me!"));
Params[3] = wxAny(wxPoint( 10, 10 ));
Params[4] = wxAny(wxSize(-1,-1));
Params[5] = wxAny((long)0);
wxASSERT( info->Create(button, 6, Params ));
frameWrapper->SetProperty( wxT("Button"), wxAny( button ) );
frameWrapper->SetProperty( "Button", wxAny( button ) );
// other controls page
@@ -401,7 +401,7 @@ wxDynamicObject* CreateFrameRTTI()
Params[2] = wxAny(wxPoint(-1,-1));
Params[3] = wxAny(wxSize(-1,-1));
Params[4] = wxAny((long)0);
Params[5] = wxAny(wxString(wxT("Hello")));
Params[5] = wxAny(wxString("Hello"));
wxASSERT( info->Create(panel, 6, Params ));
notebook->AddPage( panel, "Other Standard controls" );
@@ -411,7 +411,7 @@ wxDynamicObject* CreateFrameRTTI()
control = wxDynamicCast( info->CreateObject(), wxControl );
Params[0] = wxAny((wxWindow*)(panel));
Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("A Checkbox")));
Params[2] = wxAny(wxString("A Checkbox"));
Params[3] = wxAny(wxPoint( 10, 10 ));
Params[4] = wxAny(wxSize(-1,-1));
Params[5] = wxAny((long)0);
@@ -422,7 +422,7 @@ wxDynamicObject* CreateFrameRTTI()
control = wxDynamicCast( info->CreateObject(), wxControl );
Params[0] = wxAny((wxWindow*)(panel));
Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("A Radiobutton")));
Params[2] = wxAny(wxString("A Radiobutton"));
Params[3] = wxAny(wxPoint( 10, 30 ));
Params[4] = wxAny(wxSize(-1,-1));
Params[5] = wxAny((long)0);
@@ -430,7 +430,7 @@ wxDynamicObject* CreateFrameRTTI()
control = wxDynamicCast( info->CreateObject(), wxControl );
Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("Another One")));
Params[2] = wxAny(wxString("Another One"));
Params[3] = wxAny(wxPoint( 10, 50 ));
wxASSERT( info->Create(control, 6, Params ));
@@ -439,7 +439,7 @@ wxDynamicObject* CreateFrameRTTI()
control = wxDynamicCast( info->CreateObject(), wxControl );
Params[0] = wxAny((wxWindow*)(panel));
Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("A Static Text!")));
Params[2] = wxAny(wxString("A Static Text!"));
Params[3] = wxAny(wxPoint( 10, 70 ));
Params[4] = wxAny(wxSize(-1,-1));
Params[5] = wxAny((long)0);
@@ -450,7 +450,7 @@ wxDynamicObject* CreateFrameRTTI()
control = wxDynamicCast( info->CreateObject(), wxControl );
Params[0] = wxAny((wxWindow*)(panel));
Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("A Static Box")));
Params[2] = wxAny(wxString("A Static Box"));
Params[3] = wxAny(wxPoint( 10, 90 ));
Params[4] = wxAny(wxSize(100,80));
Params[5] = wxAny((long)0);
@@ -461,7 +461,7 @@ wxDynamicObject* CreateFrameRTTI()
control = wxDynamicCast( info->CreateObject(), wxControl );
Params[0] = wxAny((wxWindow*)(panel));
Params[1] = wxAny(wxWindowID(baseID++));
Params[2] = wxAny(wxString(wxT("A Text Control")));
Params[2] = wxAny(wxString("A Text Control"));
Params[3] = wxAny(wxPoint( 10, 200 ));
Params[4] = wxAny(wxSize(-1,-1));
Params[5] = wxAny((long)0);
@@ -477,7 +477,7 @@ wxDynamicObject* CreateFrameRTTI()
Params[2] = wxAny(wxPoint(-1,-1));
Params[3] = wxAny(wxSize(-1,-1));
Params[4] = wxAny((long)0);
Params[5] = wxAny(wxString(wxT("Hello")));
Params[5] = wxAny(wxString("Hello"));
wxASSERT( info->Create(panel, 6, Params ));
notebook->AddPage( panel, "Spins and Sliders" );
@@ -619,7 +619,7 @@ void MyFrame::OnPersist(wxCommandEvent& WXUNUSED(event))
wxDynamicObject *frame = CreateFrameRTTI();
if (!frame)
{
wxLogError(wxT("Cannot create the XTI frame!"));
wxLogError("Cannot create the XTI frame!");
return;
}
@@ -628,8 +628,8 @@ void MyFrame::OnPersist(wxCommandEvent& WXUNUSED(event))
trueFrame->Show();
// ask the user where to save it
wxFileDialog dlg(this, wxT("Where should the frame be saved?"),
wxEmptyString, wxT("test.xml"), wxT("XML files (*.xml)|*.xml"),
wxFileDialog dlg(this, "Where should the frame be saved?",
wxEmptyString, "test.xml", "XML files (*.xml)|*.xml",
wxFD_SAVE);
if (dlg.ShowModal() == wxID_CANCEL)
return;
@@ -637,7 +637,7 @@ void MyFrame::OnPersist(wxCommandEvent& WXUNUSED(event))
// then save it to a test XML file
if (!SaveFrameRTTI(dlg.GetPath(), frame))
{
wxLogError(wxT("Cannot save the XTI frame into '%s'"), dlg.GetPath());
wxLogError("Cannot save the XTI frame into '%s'", dlg.GetPath());
return;
}
@@ -648,8 +648,8 @@ void MyFrame::OnPersist(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnDepersist(wxCommandEvent& WXUNUSED(event))
{
// ask the user which file to load
wxFileDialog dlg(this, wxT("Which file contains the frame to depersist?"),
wxEmptyString, wxT("test.xml"), wxT("XML files (*.xml)|*.xml"),
wxFileDialog dlg(this, "Which file contains the frame to depersist?",
wxEmptyString, "test.xml", "XML files (*.xml)|*.xml",
wxFD_OPEN);
if (dlg.ShowModal() == wxID_CANCEL)
return;
@@ -657,7 +657,7 @@ void MyFrame::OnDepersist(wxCommandEvent& WXUNUSED(event))
wxObject *frame = LoadFrameRTTI(dlg.GetPath());
if (!frame)
{
wxLogError(wxT("Could not depersist the wxFrame from '%s'"), dlg.GetPath());
wxLogError("Could not depersist the wxFrame from '%s'", dlg.GetPath());
return;
}
@@ -672,21 +672,21 @@ void MyFrame::OnDepersist(wxCommandEvent& WXUNUSED(event))
if ( trueFrame )
trueFrame->Show();
else
wxLogError(wxT("Could not show the frame"));
wxLogError("Could not show the frame");
}
void MyFrame::OnGenerateCode(wxCommandEvent& WXUNUSED(event))
{
// ask the user which file to load
wxFileDialog dlg(this, wxT("Which file contains the frame to work on?"),
wxEmptyString, wxT("test.xml"), wxT("XML files (*.xml)|*.xml"),
wxFileDialog dlg(this, "Which file contains the frame to work on?",
wxEmptyString, "test.xml", "XML files (*.xml)|*.xml",
wxFD_OPEN);
if (dlg.ShowModal() == wxID_CANCEL)
return;
// ask the user which file to load
wxFileDialog dlg2(this, wxT("Where should the C++ code be saved?"),
wxEmptyString, wxT("test.cpp"), wxT("Source files (*.cpp)|*.cpp"),
wxFileDialog dlg2(this, "Where should the C++ code be saved?",
wxEmptyString, "test.cpp", "Source files (*.cpp)|*.cpp",
wxFD_SAVE);
if (dlg2.ShowModal() == wxID_CANCEL)
return;
@@ -694,7 +694,7 @@ void MyFrame::OnGenerateCode(wxCommandEvent& WXUNUSED(event))
// do generate code
if (!GenerateFrameRTTICode(dlg.GetPath(), dlg2.GetPath()))
{
wxLogError(wxT("Could not generate the code for the frame!"));
wxLogError("Could not generate the code for the frame!");
return;
}
@@ -704,7 +704,7 @@ void MyFrame::OnGenerateCode(wxCommandEvent& WXUNUSED(event))
wxStringOutputStream str;
f.Read(str);
wxDialog dlg(this, wxID_ANY, wxT("Generated code"),
wxDialog dlg(this, wxID_ANY, "Generated code",
wxDefaultPosition, wxDefaultSize,
wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE);
wxPanel *panel = new wxPanel(&dlg);
@@ -734,12 +734,12 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxMessageBox(wxString::Format(
wxT("Welcome to %s!\n")
wxT("\n")
wxT("This sample demonstrates wxWidgets eXtended RTTI (XTI) system."),
"Welcome to %s!\n"
"\n"
"This sample demonstrates wxWidgets eXtended RTTI (XTI) system.",
wxVERSION_STRING
),
wxT("About wxWidgets XTI sample"),
"About wxWidgets XTI sample",
wxOK | wxICON_INFORMATION,
this);
}