Reduced unnecessary wxT usage
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62991 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -85,7 +85,7 @@ other wxWidgets controls:
|
||||
wxPropertyGrid is usually populated with lines like this:
|
||||
|
||||
@code
|
||||
pg->Append( new wxStringProperty(wxT("Label"),wxT("Name"),wxT("Initial Value")) );
|
||||
pg->Append( new wxStringProperty("Label", "Name", "Initial Value") );
|
||||
@endcode
|
||||
|
||||
Naturally, wxStringProperty is a property class. Only the first function argument (label)
|
||||
@@ -100,34 +100,34 @@ To demonstrate other common property classes, here's another code snippet:
|
||||
@code
|
||||
|
||||
// Add int property
|
||||
pg->Append( new wxIntProperty(wxT("IntProperty"), wxPG_LABEL, 12345678) );
|
||||
pg->Append( new wxIntProperty("IntProperty", wxPG_LABEL, 12345678) );
|
||||
|
||||
// Add float property (value type is actually double)
|
||||
pg->Append( new wxFloatProperty(wxT("FloatProperty"), wxPG_LABEL, 12345.678) );
|
||||
pg->Append( new wxFloatProperty("FloatProperty", wxPG_LABEL, 12345.678) );
|
||||
|
||||
// Add a bool property
|
||||
pg->Append( new wxBoolProperty(wxT("BoolProperty"), wxPG_LABEL, false) );
|
||||
pg->Append( new wxBoolProperty("BoolProperty", wxPG_LABEL, false) );
|
||||
|
||||
// A string property that can be edited in a separate editor dialog.
|
||||
pg->Append( new wxLongStringProperty(wxT("LongStringProperty"),
|
||||
pg->Append( new wxLongStringProperty("LongStringProperty",
|
||||
wxPG_LABEL,
|
||||
wxT("This is much longer string than the ")
|
||||
wxT("first one. Edit it by clicking the button.")));
|
||||
"This is much longer string than the "
|
||||
"first one. Edit it by clicking the button."));
|
||||
|
||||
// String editor with dir selector button.
|
||||
pg->Append( new wxDirProperty(wxT("DirProperty"), wxPG_LABEL, ::wxGetUserHome()) );
|
||||
pg->Append( new wxDirProperty("DirProperty", wxPG_LABEL, ::wxGetUserHome()) );
|
||||
|
||||
// wxArrayStringProperty embeds a wxArrayString.
|
||||
pg->Append( new wxArrayStringProperty(wxT("Label of ArrayStringProperty"),
|
||||
wxT("NameOfArrayStringProp")));
|
||||
pg->Append( new wxArrayStringProperty("Label of ArrayStringProperty",
|
||||
"NameOfArrayStringProp"));
|
||||
|
||||
// A file selector property.
|
||||
pg->Append( new wxFileProperty(wxT("FileProperty"), wxPG_LABEL, wxEmptyString) );
|
||||
pg->Append( new wxFileProperty("FileProperty", wxPG_LABEL, wxEmptyString) );
|
||||
|
||||
// Extra: set wild card for file property (format same as in wxFileDialog).
|
||||
pg->SetPropertyAttribute( wxT("FileProperty"),
|
||||
pg->SetPropertyAttribute( "FileProperty",
|
||||
wxPG_FILE_WILDCARD,
|
||||
wxT("All files (*.*)|*.*") );
|
||||
"All files (*.*)|*.*" );
|
||||
|
||||
@endcode
|
||||
|
||||
@@ -144,19 +144,19 @@ argument, using which you can refer to properties either by their pointer
|
||||
|
||||
@code
|
||||
// Add a file selector property.
|
||||
wxPGPropety* prop = pg->Append( new wxFileProperty(wxT("FileProperty"),
|
||||
wxPGPropety* prop = pg->Append( new wxFileProperty("FileProperty",
|
||||
wxPG_LABEL,
|
||||
wxEmptyString) );
|
||||
|
||||
// Valid: Set wild card by name
|
||||
pg->SetPropertyAttribute( wxT("FileProperty"),
|
||||
pg->SetPropertyAttribute( "FileProperty",
|
||||
wxPG_FILE_WILDCARD,
|
||||
wxT("All files (*.*)|*.*") );
|
||||
"All files (*.*)|*.*" );
|
||||
|
||||
// Also Valid: Set wild card by property pointer
|
||||
pg->SetPropertyAttribute( prop,
|
||||
wxPG_FILE_WILDCARD,
|
||||
wxT("All files (*.*)|*.*") );
|
||||
"All files (*.*)|*.*" );
|
||||
@endcode
|
||||
|
||||
Using pointer is faster, since it doesn't require hash map lookup. Anyway,
|
||||
@@ -186,21 +186,21 @@ or wxPropertyGridInterface::AppendIn.
|
||||
@code
|
||||
|
||||
// One way to add category (similar to how other properties are added)
|
||||
pg->Append( new wxPropertyCategory(wxT("Main")) );
|
||||
pg->Append( new wxPropertyCategory("Main") );
|
||||
|
||||
// All these are added to "Main" category
|
||||
pg->Append( new wxStringProperty(wxT("Name")) );
|
||||
pg->Append( new wxIntProperty(wxT("Age"),wxPG_LABEL,25) );
|
||||
pg->Append( new wxIntProperty(wxT("Height"),wxPG_LABEL,180) );
|
||||
pg->Append( new wxIntProperty(wxT("Weight")) );
|
||||
pg->Append( new wxStringProperty("Name") );
|
||||
pg->Append( new wxIntProperty("Age",wxPG_LABEL,25) );
|
||||
pg->Append( new wxIntProperty("Height",wxPG_LABEL,180) );
|
||||
pg->Append( new wxIntProperty("Weight") );
|
||||
|
||||
// Another one
|
||||
pg->Append( new wxPropertyCategory(wxT("Attributes")) );
|
||||
pg->Append( new wxPropertyCategory("Attributes") );
|
||||
|
||||
// All these are added to "Attributes" category
|
||||
pg->Append( new wxIntProperty(wxT("Intelligence")) );
|
||||
pg->Append( new wxIntProperty(wxT("Agility")) );
|
||||
pg->Append( new wxIntProperty(wxT("Strength")) );
|
||||
pg->Append( new wxIntProperty("Intelligence") );
|
||||
pg->Append( new wxIntProperty("Agility") );
|
||||
pg->Append( new wxIntProperty("Strength") );
|
||||
|
||||
@endcode
|
||||
|
||||
@@ -224,34 +224,34 @@ or wxPropertyGridInterface::AppendIn.
|
||||
Sample:
|
||||
|
||||
@code
|
||||
wxPGProperty* carProp = pg->Append(new wxStringProperty(wxT("Car"),
|
||||
wxPGProperty* carProp = pg->Append(new wxStringProperty("Car",
|
||||
wxPG_LABEL,
|
||||
wxT("<composed>")));
|
||||
"<composed>"));
|
||||
|
||||
pg->AppendIn(carProp, new wxStringProperty(wxT("Model"),
|
||||
pg->AppendIn(carProp, new wxStringProperty("Model",
|
||||
wxPG_LABEL,
|
||||
wxT("Lamborghini Diablo SV")));
|
||||
"Lamborghini Diablo SV"));
|
||||
|
||||
pg->AppendIn(carProp, new wxIntProperty(wxT("Engine Size (cc)"),
|
||||
pg->AppendIn(carProp, new wxIntProperty("Engine Size (cc)",
|
||||
wxPG_LABEL,
|
||||
5707) );
|
||||
|
||||
wxPGProperty* speedsProp = pg->AppendIn(carProp,
|
||||
new wxStringProperty(wxT("Speeds"),
|
||||
new wxStringProperty("Speeds",
|
||||
wxPG_LABEL,
|
||||
wxT("<composed>")));
|
||||
"<composed>"));
|
||||
|
||||
pg->AppendIn( speedsProp, new wxIntProperty(wxT("Max. Speed (mph)"),
|
||||
pg->AppendIn( speedsProp, new wxIntProperty("Max. Speed (mph)",
|
||||
wxPG_LABEL,290) );
|
||||
pg->AppendIn( speedsProp, new wxFloatProperty(wxT("0-100 mph (sec)"),
|
||||
pg->AppendIn( speedsProp, new wxFloatProperty("0-100 mph (sec)",
|
||||
wxPG_LABEL,3.9) );
|
||||
pg->AppendIn( speedsProp, new wxFloatProperty(wxT("1/4 mile (sec)"),
|
||||
pg->AppendIn( speedsProp, new wxFloatProperty("1/4 mile (sec)",
|
||||
wxPG_LABEL,8.6) );
|
||||
|
||||
// This is how child property can be referred to by name
|
||||
pg->SetPropertyValue( wxT("Car.Speeds.Max. Speed (mph)"), 300 );
|
||||
pg->SetPropertyValue( "Car.Speeds.Max. Speed (mph)", 300 );
|
||||
|
||||
pg->AppendIn(carProp, new wxIntProperty(wxT("Price ($)"),
|
||||
pg->AppendIn(carProp, new wxIntProperty("Price ($)",
|
||||
wxPG_LABEL,
|
||||
300000) );
|
||||
|
||||
@@ -282,11 +282,11 @@ A very simple example:
|
||||
// Using wxArrayString
|
||||
//
|
||||
wxArrayString arrDiet;
|
||||
arr.Add(wxT("Herbivore"));
|
||||
arr.Add(wxT("Carnivore"));
|
||||
arr.Add(wxT("Omnivore"));
|
||||
arr.Add("Herbivore");
|
||||
arr.Add("Carnivore");
|
||||
arr.Add("Omnivore");
|
||||
|
||||
pg->Append( new wxEnumProperty(wxT("Diet"),
|
||||
pg->Append( new wxEnumProperty("Diet",
|
||||
wxPG_LABEL,
|
||||
arrDiet) );
|
||||
|
||||
@@ -296,7 +296,7 @@ A very simple example:
|
||||
const wxChar* arrayDiet[] =
|
||||
{ wxT("Herbivore"), wxT("Carnivore"), wxT("Omnivore"), NULL };
|
||||
|
||||
pg->Append( new wxEnumProperty(wxT("Diet"),
|
||||
pg->Append( new wxEnumProperty("Diet",
|
||||
wxPG_LABEL,
|
||||
arrayDiet) );
|
||||
|
||||
@@ -310,9 +310,9 @@ Here's extended example using values as well:
|
||||
// Using wxArrayString and wxArrayInt
|
||||
//
|
||||
wxArrayString arrDiet;
|
||||
arr.Add(wxT("Herbivore"));
|
||||
arr.Add(wxT("Carnivore"));
|
||||
arr.Add(wxT("Omnivore"));
|
||||
arr.Add("Herbivore");
|
||||
arr.Add("Carnivore");
|
||||
arr.Add("Omnivore");
|
||||
|
||||
wxArrayInt arrIds;
|
||||
arrIds.Add(40);
|
||||
@@ -321,7 +321,7 @@ Here's extended example using values as well:
|
||||
|
||||
// Note that the initial value (the last argument) is the actual value,
|
||||
// not index or anything like that. Thus, our value selects "Omnivore".
|
||||
pg->Append( new wxEnumProperty(wxT("Diet"),
|
||||
pg->Append( new wxEnumProperty("Diet",
|
||||
wxPG_LABEL,
|
||||
arrDiet,
|
||||
arrIds,
|
||||
@@ -341,20 +341,20 @@ Here's extended example using values as well:
|
||||
@code
|
||||
|
||||
wxPGChoices chs;
|
||||
chs.Add(wxT("Herbivore"), 40);
|
||||
chs.Add(wxT("Carnivore"), 45);
|
||||
chs.Add(wxT("Omnivore"), 50);
|
||||
chs.Add("Herbivore", 40);
|
||||
chs.Add("Carnivore", 45);
|
||||
chs.Add("Omnivore", 50);
|
||||
|
||||
// Let's add an item with bitmap, too
|
||||
chs.Add(wxT("None of the above"), wxBitmap(), 60);
|
||||
chs.Add("None of the above", wxBitmap(), 60);
|
||||
|
||||
pg->Append( new wxEnumProperty(wxT("Primary Diet"),
|
||||
pg->Append( new wxEnumProperty("Primary Diet",
|
||||
wxPG_LABEL,
|
||||
chs) );
|
||||
|
||||
// Add same choices to another property as well - this is efficient due
|
||||
// to reference counting
|
||||
pg->Append( new wxEnumProperty(wxT("Secondary Diet"),
|
||||
pg->Append( new wxEnumProperty("Secondary Diet",
|
||||
wxPG_LABEL,
|
||||
chs) );
|
||||
@endcode
|
||||
@@ -378,7 +378,7 @@ wxFlagsProperty has similar construction:
|
||||
long flags_prop_values[] = { wxICONIZE, wxCAPTION, wxMINIMIZE_BOX,
|
||||
wxMAXIMIZE_BOX };
|
||||
|
||||
pg->Append( new wxFlagsProperty(wxT("Window Style"),
|
||||
pg->Append( new wxFlagsProperty("Window Style",
|
||||
wxPG_LABEL,
|
||||
flags_prop_labels,
|
||||
flags_prop_values,
|
||||
@@ -404,38 +404,38 @@ To use them, you have to include <wx/propgrid/advprops.h>.
|
||||
...
|
||||
|
||||
// Date property.
|
||||
pg->Append( new wxDateProperty(wxT("MyDateProperty"),
|
||||
pg->Append( new wxDateProperty("MyDateProperty",
|
||||
wxPG_LABEL,
|
||||
wxDateTime::Now()) );
|
||||
|
||||
// Image file property. Wild card is auto-generated from available
|
||||
// image handlers, so it is not set this time.
|
||||
pg->Append( new wxImageFileProperty(wxT("Label of ImageFileProperty"),
|
||||
wxT("NameOfImageFileProp")) );
|
||||
pg->Append( new wxImageFileProperty("Label of ImageFileProperty",
|
||||
"NameOfImageFileProp") );
|
||||
|
||||
// Font property has sub-properties. Note that we give window's font as
|
||||
// initial value.
|
||||
pg->Append( new wxFontProperty(wxT("Font"),
|
||||
pg->Append( new wxFontProperty("Font",
|
||||
wxPG_LABEL,
|
||||
GetFont()) );
|
||||
|
||||
// Colour property with arbitrary colour.
|
||||
pg->Append( new wxColourProperty(wxT("My Colour 1"),
|
||||
pg->Append( new wxColourProperty("My Colour 1",
|
||||
wxPG_LABEL,
|
||||
wxColour(242,109,0) ) );
|
||||
|
||||
// System colour property.
|
||||
pg->Append( new wxSystemColourProperty(wxT("My SysColour 1"),
|
||||
pg->Append( new wxSystemColourProperty("My SysColour 1",
|
||||
wxPG_LABEL,
|
||||
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)) );
|
||||
|
||||
// System colour property with custom colour.
|
||||
pg->Append( new wxSystemColourProperty(wxT("My SysColour 2"),
|
||||
pg->Append( new wxSystemColourProperty("My SysColour 2",
|
||||
wxPG_LABEL,
|
||||
wxColour(0,200,160) ) );
|
||||
|
||||
// Cursor property
|
||||
pg->Append( new wxCursorProperty(wxT("My Cursor"),
|
||||
pg->Append( new wxCursorProperty("My Cursor",
|
||||
wxPG_LABEL,
|
||||
wxCURSOR_ARROW));
|
||||
|
||||
@@ -680,7 +680,7 @@ message.
|
||||
// the value to be validated.
|
||||
wxVariant pendingValue = event.GetValue();
|
||||
|
||||
if ( property->GetName() == wxT("Font") )
|
||||
if ( property->GetName() == "Font" )
|
||||
{
|
||||
// Make sure value is not unspecified
|
||||
if ( !pendingValue.IsNull() )
|
||||
@@ -689,7 +689,7 @@ message.
|
||||
font << pendingValue;
|
||||
|
||||
// Let's just allow Arial font
|
||||
if ( font.GetFaceName() != wxT("Arial") )
|
||||
if ( font.GetFaceName() != "Arial" )
|
||||
{
|
||||
event.Veto();
|
||||
event.SetValidationFailureBehavior(wxPG_VFB_STAY_IN_PROPERTY |
|
||||
@@ -741,7 +741,7 @@ colour selection dialog.
|
||||
|
||||
@code
|
||||
|
||||
wxPGProperty* colProp = new wxColourProperty(wxT("Text Colour"));
|
||||
wxPGProperty* colProp = new wxColourProperty("Text Colour");
|
||||
pg->Append(colProp);
|
||||
pg->SetPropertyEditor(colProp, wxPGEditor_TextCtrlAndButton);
|
||||
|
||||
@@ -843,7 +843,7 @@ unique (base) name.
|
||||
For example, if you have a wxFlagsProperty, you can
|
||||
set its all items to use check box using the following:
|
||||
@code
|
||||
pg->SetPropertyAttribute(wxT("MyFlagsProperty"),wxPG_BOOL_USE_CHECKBOX,true,wxPG_RECURSE);
|
||||
pg->SetPropertyAttribute("MyFlagsProperty", wxPG_BOOL_USE_CHECKBOX, true, wxPG_RECURSE);
|
||||
@endcode
|
||||
|
||||
Following will set all individual bool properties in your control to
|
||||
|
Reference in New Issue
Block a user