Use wxT macro with string literals in propgrid sample.

This fix is to unify string literals in the sample.
This commit is contained in:
Artur Wieczorek
2015-05-10 20:06:46 +02:00
parent d4440703b2
commit cc799c10ac
4 changed files with 122 additions and 122 deletions

View File

@@ -106,8 +106,8 @@ wxPGWindowList wxSampleMultiButtonEditor::CreateControls( wxPropertyGrid* propGr
wxPGMultiButton* buttons = new wxPGMultiButton( propGrid, sz );
// Add two regular buttons
buttons->Add( "..." );
buttons->Add( "A" );
buttons->Add( wxT("...") );
buttons->Add( wxT("A") );
// Add a bitmap button
buttons->Add( wxArtProvider::GetBitmap(wxART_FOLDER) );
@@ -136,19 +136,19 @@ bool wxSampleMultiButtonEditor::OnEvent( wxPropertyGrid* propGrid,
if ( event.GetId() == buttons->GetButtonId(0) )
{
// Do something when the first button is pressed
wxLogDebug("First button pressed");
wxLogDebug(wxT("First button pressed"));
return false; // Return false since value did not change
}
if ( event.GetId() == buttons->GetButtonId(1) )
{
// Do something when the second button is pressed
wxMessageBox("Second button pressed");
wxMessageBox(wxT("Second button pressed"));
return false; // Return false since value did not change
}
if ( event.GetId() == buttons->GetButtonId(2) )
{
// Do something when the third button is pressed
wxMessageBox("Third button pressed");
wxMessageBox(wxT("Third button pressed"));
return false; // Return false since value did not change
}
}
@@ -780,7 +780,7 @@ void FormMain::OnPropertyGridPageChange( wxPropertyGridEvent& WXUNUSED(event) )
void FormMain::OnPropertyGridLabelEditBegin( wxPropertyGridEvent& event )
{
wxLogMessage("wxPG_EVT_LABEL_EDIT_BEGIN(%s)",
wxLogMessage(wxT("wxPG_EVT_LABEL_EDIT_BEGIN(%s)"),
event.GetProperty()->GetLabel().c_str());
}
@@ -788,7 +788,7 @@ void FormMain::OnPropertyGridLabelEditBegin( wxPropertyGridEvent& event )
void FormMain::OnPropertyGridLabelEditEnding( wxPropertyGridEvent& event )
{
wxLogMessage("wxPG_EVT_LABEL_EDIT_ENDING(%s)",
wxLogMessage(wxT("wxPG_EVT_LABEL_EDIT_ENDING(%s)"),
event.GetProperty()->GetLabel().c_str());
}
@@ -884,12 +884,12 @@ void FormMain::OnPropertyGridColBeginDrag( wxPropertyGridEvent& event )
{
if ( m_itemVetoDragging->IsChecked() )
{
wxLogMessage("Splitter %i resize was vetoed", event.GetColumn());
wxLogMessage(wxT("Splitter %i resize was vetoed"), event.GetColumn());
event.Veto();
}
else
{
wxLogMessage("Splitter %i resize began", event.GetColumn());
wxLogMessage(wxT("Splitter %i resize began"), event.GetColumn());
}
}
@@ -899,14 +899,14 @@ void FormMain::OnPropertyGridColDragging( wxPropertyGridEvent& event )
{
wxUnusedVar(event);
// For now, let's not spam the log output
//wxLogMessage("Splitter %i is being resized", event.GetColumn());
//wxLogMessage(wxT("Splitter %i is being resized"), event.GetColumn());
}
// -----------------------------------------------------------------------
void FormMain::OnPropertyGridColEndDrag( wxPropertyGridEvent& event )
{
wxLogMessage("Splitter %i resize ended", event.GetColumn());
wxLogMessage(wxT("Splitter %i resize ended"), event.GetColumn());
}
// -----------------------------------------------------------------------
@@ -1065,15 +1065,15 @@ void FormMain::PopulateWithStandardItems ()
pg->SetPropertyAttribute(wxT("Height"), wxPG_ATTR_UNITS, wxT("Pixels") );
// Set value to unspecified so that Hint attribute will be demonstrated
pg->SetPropertyValueUnspecified("Height");
pg->SetPropertyAttribute("Height", wxPG_ATTR_HINT,
"Enter new height for window" );
pg->SetPropertyValueUnspecified(wxT("Height"));
pg->SetPropertyAttribute(wxT("Height"), wxPG_ATTR_HINT,
wxT("Enter new height for window") );
// Difference between hint and help string is that the hint is shown in
// an empty value cell, while help string is shown either in the
// description text box, as a tool tip, or on the status bar.
pg->SetPropertyHelpString("Height",
"This property uses attributes \"Units\" and \"Hint\"." );
pg->SetPropertyHelpString(wxT("Height"),
wxT("This property uses attributes \"Units\" and \"Hint\".") );
pg->Append( new wxIntProperty(wxT("Width"),wxPG_LABEL,640) );
pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_MIN, (long)10 );
@@ -1081,10 +1081,10 @@ void FormMain::PopulateWithStandardItems ()
pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_UNITS, wxT("Pixels") );
pg->SetPropertyValueUnspecified(wxT("Width"));
pg->SetPropertyAttribute("Width", wxPG_ATTR_HINT,
"Enter new width for window" );
pg->SetPropertyHelpString("Width",
"This property uses attributes \"Units\" and \"Hint\"." );
pg->SetPropertyAttribute(wxT("Width"), wxPG_ATTR_HINT,
wxT("Enter new width for window") );
pg->SetPropertyHelpString(wxT("Width"),
wxT("This property uses attributes \"Units\" and \"Hint\".") );
pg->Append( new wxIntProperty(wxT("X"),wxPG_LABEL,10) );
pg->SetPropertyAttribute(wxT("X"), wxPG_ATTR_UNITS, wxT("Pixels") );
@@ -1212,7 +1212,7 @@ void FormMain::PopulateWithExamples ()
pg->SetPropertyHelpString( wxT("BoolProperty with CheckBox"),
wxT("Property attribute wxPG_BOOL_USE_CHECKBOX has been set to true.") );
prop = pg->Append( new wxFloatProperty("FloatProperty",
prop = pg->Append( new wxFloatProperty(wxT("FloatProperty"),
wxPG_LABEL,
1234500.23) );
prop->SetAttribute(wxPG_ATTR_MIN, -100.12);
@@ -1261,12 +1261,12 @@ void FormMain::PopulateWithExamples ()
wxT("wxPropertyGrid::SetPropertyEditor method has been used to change ")
wxT("editor of this property to wxPGEditor_ComboBox)"));
pid = pg->Append( new wxColourProperty("ColourPropertyWithAlpha",
pid = pg->Append( new wxColourProperty(wxT("ColourPropertyWithAlpha"),
wxPG_LABEL,
wxColour(15, 200, 95, 128)) );
pg->SetPropertyAttribute("ColourPropertyWithAlpha", wxPG_COLOUR_HAS_ALPHA, true);
pg->SetPropertyHelpString("ColourPropertyWithAlpha",
"Attribute \"HasAlpha\" is set to true for this property.");
pg->SetPropertyAttribute(wxT("ColourPropertyWithAlpha"), wxPG_COLOUR_HAS_ALPHA, true);
pg->SetPropertyHelpString(wxT("ColourPropertyWithAlpha"),
wxT("Attribute \"HasAlpha\" is set to true for this property."));
//
// This demonstrates using alternative editor for colour property
@@ -1301,7 +1301,7 @@ void FormMain::PopulateWithExamples ()
soc.Add( wxT("Look, it continues"), 200 );
soc.Add( wxT("Even More"), 240 );
soc.Add( wxT("And More"), 280 );
soc.Add( "", 300 );
soc.Add( wxT(""), 300 );
soc.Add( wxT("True End of the List"), 320 );
// Test custom colours ([] operator of wxPGChoices returns
@@ -1325,10 +1325,10 @@ void FormMain::PopulateWithExamples ()
soc, 240 ) );
// Test Hint attribute in EnumProperty
pg->GetProperty("EnumProperty 3")->SetAttribute(wxPG_ATTR_HINT, "Dummy Hint");
pg->GetProperty(wxT("EnumProperty 3"))->SetAttribute(wxPG_ATTR_HINT, wxT("Dummy Hint"));
pg->SetPropertyHelpString("EnumProperty 3",
"This property uses \"Hint\" attribute.");
pg->SetPropertyHelpString(wxT("EnumProperty 3"),
wxT("This property uses \"Hint\" attribute."));
// 'soc' plus one exclusive extra choice "4th only"
pg->Append( new wxEnumProperty(wxT("EnumProperty 4"),wxPG_LABEL,
@@ -1362,22 +1362,22 @@ void FormMain::PopulateWithExamples ()
//
// Demonstrate "AutoComplete" attribute
pg->Append( new wxStringProperty( "StringProperty AutoComplete",
pg->Append( new wxStringProperty( wxT("StringProperty AutoComplete"),
wxPG_LABEL ) );
wxArrayString autoCompleteStrings;
autoCompleteStrings.Add("One choice");
autoCompleteStrings.Add("Another choice");
autoCompleteStrings.Add("Another choice, yeah");
autoCompleteStrings.Add("Yet another choice");
autoCompleteStrings.Add("Yet another choice, bear with me");
pg->SetPropertyAttribute( "StringProperty AutoComplete",
autoCompleteStrings.Add(wxT("One choice"));
autoCompleteStrings.Add(wxT("Another choice"));
autoCompleteStrings.Add(wxT("Another choice, yeah"));
autoCompleteStrings.Add(wxT("Yet another choice"));
autoCompleteStrings.Add(wxT("Yet another choice, bear with me"));
pg->SetPropertyAttribute( wxT("StringProperty AutoComplete"),
wxPG_ATTR_AUTOCOMPLETE,
autoCompleteStrings );
pg->SetPropertyHelpString( "StringProperty AutoComplete",
"AutoComplete attribute has been set for this property "
"(try writing something beginning with 'a', 'o' or 'y').");
pg->SetPropertyHelpString( wxT("StringProperty AutoComplete"),
wxT("AutoComplete attribute has been set for this property ")
wxT("(try writing something beginning with 'a', 'o' or 'y')."));
// Add string property with arbitrarily wide bitmap in front of it. We
// intentionally lower-than-typical row height here so that the ugly
@@ -1440,13 +1440,13 @@ void FormMain::PopulateWithExamples ()
eech.Add(wxT("Choice 1"));
eech.Add(wxT("Choice 2"));
eech.Add(wxT("Choice 3"));
pg->Append( new wxEditEnumProperty("EditEnumProperty",
pg->Append( new wxEditEnumProperty(wxT("EditEnumProperty"),
wxPG_LABEL,
eech,
"Choice not in the list") );
wxT("Choice not in the list")) );
// Test Hint attribute in EditEnumProperty
pg->GetProperty("EditEnumProperty")->SetAttribute(wxPG_ATTR_HINT, "Dummy Hint");
pg->GetProperty(wxT("EditEnumProperty"))->SetAttribute(wxPG_ATTR_HINT, wxT("Dummy Hint"));
//wxString v_;
//wxTextValidator validator1(wxFILTER_NUMERIC,&v_);
@@ -1611,10 +1611,10 @@ void FormMain::PopulateWithLibraryConfig ()
wxFont italicFont = pgman->GetGrid()->GetCaptionFont();
italicFont.SetStyle(wxFONTSTYLE_ITALIC);
wxString italicFontHelp = "Font of this property's wxPGCell has "
"been modified. Obtain property's cell "
"with wxPGProperty::"
"GetOrCreateCell(column).";
wxString italicFontHelp = wxT("Font of this property's wxPGCell has ")
wxT("been modified. Obtain property's cell ")
wxT("with wxPGProperty::")
wxT("GetOrCreateCell(column).");
#define ADD_WX_LIB_CONF_GROUP(A) \
cat = pg->AppendIn( pid, new wxPropertyCategory(A) ); \
@@ -1630,8 +1630,8 @@ void FormMain::PopulateWithLibraryConfig ()
pg->SetPropertyCell( pid, 0, wxPG_LABEL, bmp );
// Both of following lines would set a label for the second column
pg->SetPropertyCell( pid, 1, "Is Enabled" );
pid->SetValue("Is Enabled");
pg->SetPropertyCell( pid, 1, wxT("Is Enabled") );
pid->SetValue(wxT("Is Enabled"));
ADD_WX_LIB_CONF_GROUP(wxT("Global Settings"))
ADD_WX_LIB_CONF( wxUSE_GUI )
@@ -1839,10 +1839,10 @@ void FormMain::FinalizePanel( bool wasCreated )
{
// Button for tab traversal testing
m_topSizer->Add( new wxButton(m_panel, wxID_ANY,
wxS("Should be able to move here with Tab")),
wxT("Should be able to move here with Tab")),
0, wxEXPAND );
m_topSizer->Add( new wxButton(m_panel, ID_SHOWPOPUP,
wxS("Show Popup")),
wxT("Show Popup")),
0, wxEXPAND );
m_panel->SetSizer( m_topSizer );
@@ -1937,7 +1937,7 @@ void FormMain::CreateGrid( int style, int extraStyle )
//
// Set somewhat different unspecified value appearance
wxPGCell cell;
cell.SetText("Unspecified");
cell.SetText(wxT("Unspecified"));
cell.SetFgCol(*wxLIGHT_GREY);
m_propGrid->SetUnspecifiedValueAppearance(cell);
@@ -2033,24 +2033,24 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size
menuTools1->AppendSeparator();
menuTools1->Append(ID_SETBGCOLOUR, wxT("Set Bg Colour") );
menuTools1->Append(ID_SETBGCOLOURRECUR, wxT("Set Bg Colour (Recursively)") );
menuTools1->Append(ID_UNSPECIFY, "Set Value to Unspecified");
menuTools1->Append(ID_UNSPECIFY, wxT("Set Value to Unspecified"));
menuTools1->AppendSeparator();
m_itemEnable = menuTools1->Append(ID_ENABLE, wxT("Enable"),
wxT("Toggles item's enabled state.") );
m_itemEnable->Enable( false );
menuTools1->Append(ID_HIDE, "Hide", "Hides a property" );
menuTools1->Append(ID_SETREADONLY, "Set as Read-Only",
"Set property as read-only" );
menuTools1->Append(ID_HIDE, wxT("Hide"), wxT("Hides a property") );
menuTools1->Append(ID_SETREADONLY, wxT("Set as Read-Only"),
wxT("Set property as read-only") );
menuTools2->Append(ID_ITERATE1, wxT("Iterate Over Properties") );
menuTools2->Append(ID_ITERATE2, wxT("Iterate Over Visible Items") );
menuTools2->Append(ID_ITERATE3, wxT("Reverse Iterate Over Properties") );
menuTools2->Append(ID_ITERATE4, wxT("Iterate Over Categories") );
menuTools2->AppendSeparator();
menuTools2->Append(ID_ONEXTENDEDKEYNAV, "Extend Keyboard Navigation",
"This will set Enter to navigate to next property, "
"and allows arrow keys to navigate even when in "
"editor control.");
menuTools2->Append(ID_ONEXTENDEDKEYNAV, wxT("Extend Keyboard Navigation"),
wxT("This will set Enter to navigate to next property, ")
wxT("and allows arrow keys to navigate even when in ")
wxT("editor control."));
menuTools2->AppendSeparator();
menuTools2->Append(ID_SETPROPERTYVALUE, wxT("Set Property Value") );
menuTools2->Append(ID_CLEARMODIF, wxT("Clear Modified Status"), wxT("Clears wxPG_MODIFIED flag from all properties.") );
@@ -2079,7 +2079,7 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size
menuTools2->Append(ID_FITCOLUMNS, wxT("Fit Columns") );
m_itemVetoDragging =
menuTools2->AppendCheckItem(ID_VETOCOLDRAG,
"Veto Column Dragging");
wxT("Veto Column Dragging"));
menuTools2->AppendSeparator();
menuTools2->Append(ID_CHANGEFLAGSITEMS, wxT("Change Children of FlagsProp") );
menuTools2->AppendSeparator();
@@ -2091,11 +2091,11 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size
menuTry->Append(ID_SELECTSTYLE, wxT("Set Window Style"),
wxT("Select window style flags used by the grid."));
menuTry->Append(ID_ENABLELABELEDITING, "Enable label editing",
"This calls wxPropertyGrid::MakeColumnEditable(0)");
menuTry->Append(ID_ENABLELABELEDITING, wxT("Enable label editing"),
wxT("This calls wxPropertyGrid::MakeColumnEditable(0)"));
menuTry->AppendCheckItem(ID_SHOWHEADER,
"Enable header",
"This calls wxPropertyGridManager::ShowHeader()");
wxT("Enable header"),
wxT("This calls wxPropertyGridManager::ShowHeader()"));
menuTry->AppendSeparator();
menuTry->AppendRadioItem( ID_COLOURSCHEME1, wxT("Standard Colour Scheme") );
menuTry->AppendRadioItem( ID_COLOURSCHEME2, wxT("White Colour Scheme") );
@@ -2141,7 +2141,7 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size
#if wxUSE_LOGWINDOW
// Create log window
m_logWindow = new wxLogWindow(this, "Log Messages", false);
m_logWindow = new wxLogWindow(this, wxT("Log Messages"), false);
m_logWindow->GetFrame()->Move(GetPosition().x + GetSize().x + 10,
GetPosition().y);
m_logWindow->Show();
@@ -2559,7 +2559,7 @@ FormMain::OnSetBackgroundColour( wxCommandEvent& event )
return;
}
wxColour col = ::wxGetColourFromUser(this, *wxWHITE, "Choose colour");
wxColour col = ::wxGetColourFromUser(this, *wxWHITE, wxT("Choose colour"));
if ( col.IsOk() )
{
@@ -2688,7 +2688,7 @@ void FormMain::OnEnableLabelEditing( wxCommandEvent& WXUNUSED(event) )
void FormMain::OnShowHeader( wxCommandEvent& event )
{
m_pPropGridManager->ShowHeader(event.IsChecked());
m_pPropGridManager->SetColumnTitle(2, _("Units"));
m_pPropGridManager->SetColumnTitle(2, wxT("Units"));
}
// -----------------------------------------------------------------------
@@ -3223,20 +3223,20 @@ struct PropertyGridPopup : wxPopupWindow
m_grid = new wxPropertyGrid(m_panel, ID_POPUPGRID, wxDefaultPosition, wxSize(400,400), wxPG_SPLITTER_AUTO_CENTER);
m_grid->SetColumnCount(3);
wxPGProperty *prop=m_grid->Append(new wxStringProperty("test_name", wxPG_LABEL, "test_value"));
m_grid->SetPropertyAttribute(prop, wxPG_ATTR_UNITS, "type");
wxPGProperty *prop1 = m_grid->AppendIn(prop, new wxStringProperty("sub_name1", wxPG_LABEL, "sub_value1"));
wxPGProperty *prop=m_grid->Append(new wxStringProperty(wxT("test_name"), wxPG_LABEL, wxT("test_value")));
m_grid->SetPropertyAttribute(prop, wxPG_ATTR_UNITS, wxT("type"));
wxPGProperty *prop1 = m_grid->AppendIn(prop, new wxStringProperty(wxT("sub_name1"), wxPG_LABEL, wxT("sub_value1")));
m_grid->AppendIn(prop1, new wxSystemColourProperty(wxT("Cell Colour"),wxPG_LABEL, m_grid->GetGrid()->GetCellBackgroundColour()));
wxPGProperty *prop2 = m_grid->AppendIn(prop, new wxStringProperty("sub_name2", wxPG_LABEL, "sub_value2"));
m_grid->AppendIn(prop2, new wxStringProperty("sub_name21", wxPG_LABEL, "sub_value21"));
wxPGProperty *prop2 = m_grid->AppendIn(prop, new wxStringProperty(wxT("sub_name2"), wxPG_LABEL, wxT("sub_value2")));
m_grid->AppendIn(prop2, new wxStringProperty(wxT("sub_name21"), wxPG_LABEL, wxT("sub_value21")));
wxArrayDouble arrdbl;
arrdbl.Add(-1.0); arrdbl.Add(-0.5); arrdbl.Add(0.0); arrdbl.Add(0.5); arrdbl.Add(1.0);
m_grid->AppendIn(prop, new wxArrayDoubleProperty(wxT("ArrayDoubleProperty"),wxPG_LABEL,arrdbl) );
m_grid->AppendIn(prop, new wxFontProperty(wxT("Font"),wxPG_LABEL));
m_grid->AppendIn(prop2, new wxStringProperty("sub_name22", wxPG_LABEL, "sub_value22"));
m_grid->AppendIn(prop2, new wxStringProperty("sub_name23", wxPG_LABEL, "sub_value23"));
m_grid->AppendIn(prop2, new wxStringProperty(wxT("sub_name22"), wxPG_LABEL, wxT("sub_value22")));
m_grid->AppendIn(prop2, new wxStringProperty(wxT("sub_name23"), wxPG_LABEL, wxT("sub_value23")));
prop2->SetExpanded(false);
::SetMinSize(m_grid);
@@ -3251,13 +3251,13 @@ struct PropertyGridPopup : wxPopupWindow
void OnCollapse(wxPropertyGridEvent& WXUNUSED(event))
{
wxLogMessage("OnCollapse");
wxLogMessage(wxT("OnCollapse"));
Fit();
}
void OnExpand(wxPropertyGridEvent& WXUNUSED(event))
{
wxLogMessage("OnExpand");
wxLogMessage(wxT("OnExpand"));
Fit();
}