]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/propgrid/propgrid.cpp
For wxGTK2, link with X11 explicitly, since we use many X11 functions directly.
[wxWidgets.git] / samples / propgrid / propgrid.cpp
index 22d474fb4e91c4f0b40d76e7ec71c9ed61a3e3d7..4d36f39bfe04b8fd600f6e2ee87db7e2c0cde1ac 100644 (file)
@@ -322,7 +322,7 @@ public:
         wxString s = ::wxGetSingleChoice(wxT("Message"),
                                          wxT("Caption"),
                                          m_choices.GetLabels());
         wxString s = ::wxGetSingleChoice(wxT("Message"),
                                          wxT("Caption"),
                                          m_choices.GetLabels());
-        if ( s.length() )
+        if ( !s.empty() )
         {
             SetValue(s);
             return true;
         {
             SetValue(s);
             return true;
@@ -650,7 +650,7 @@ void FormMain::OnPropertyGridChanging( wxPropertyGridEvent& event )
             event.Veto();
 
             // Since we ask a question, it is better if we omit any validation
             event.Veto();
 
             // Since we ask a question, it is better if we omit any validation
-            // failure behavior.
+            // failure behaviour.
             event.SetValidationFailureBehavior(0);
         }
     }
             event.SetValidationFailureBehavior(0);
         }
     }
@@ -1098,7 +1098,7 @@ void FormMain::PopulateWithStandardItems ()
     pg->SetPropertyAttribute(wxT("Y"), wxPG_ATTR_UNITS, wxT("Pixels") );
     pg->SetPropertyHelpString(wxT("Y"), wxT("This property uses \"Units\" attribute.") );
 
     pg->SetPropertyAttribute(wxT("Y"), wxPG_ATTR_UNITS, wxT("Pixels") );
     pg->SetPropertyHelpString(wxT("Y"), wxT("This property uses \"Units\" attribute.") );
 
-    const wxChar* disabledHelpString = wxT("This property is simply disabled. Inorder to have label disabled as well, ")
+    const wxChar* disabledHelpString = wxT("This property is simply disabled. In order to have label disabled as well, ")
                                        wxT("you need to set wxPG_EX_GREY_LABEL_WHEN_DISABLED using SetExtraStyle.");
 
     pg->Append( new wxPropertyCategory(wxT("Environment"),wxPG_LABEL) );
                                        wxT("you need to set wxPG_EX_GREY_LABEL_WHEN_DISABLED using SetExtraStyle.");
 
     pg->Append( new wxPropertyCategory(wxT("Environment"),wxPG_LABEL) );
@@ -1259,13 +1259,19 @@ void FormMain::PopulateWithExamples ()
 #endif
 
     pid = pg->Append( new wxColourProperty(wxT("ColourProperty"),wxPG_LABEL,*wxRED) );
 #endif
 
     pid = pg->Append( new wxColourProperty(wxT("ColourProperty"),wxPG_LABEL,*wxRED) );
-    //pg->SetPropertyAttribute(pid,wxPG_COLOUR_ALLOW_CUSTOM,false);
     pg->SetPropertyEditor( wxT("ColourProperty"), wxPGEditor_ComboBox );
     pg->GetProperty(wxT("ColourProperty"))->SetAutoUnspecified(true);
     pg->SetPropertyHelpString( wxT("ColourProperty"),
         wxT("wxPropertyGrid::SetPropertyEditor method has been used to change ")
         wxT("editor of this property to wxPGEditor_ComboBox)"));
 
     pg->SetPropertyEditor( wxT("ColourProperty"), wxPGEditor_ComboBox );
     pg->GetProperty(wxT("ColourProperty"))->SetAutoUnspecified(true);
     pg->SetPropertyHelpString( wxT("ColourProperty"),
         wxT("wxPropertyGrid::SetPropertyEditor method has been used to change ")
         wxT("editor of this property to wxPGEditor_ComboBox)"));
 
+    pid = pg->Append( new wxColourProperty("ColourPropertyWithAlpha",
+                                           wxPG_LABEL,
+                                           wxColour(15, 200, 95, 128)) );
+    pg->SetPropertyAttribute("ColourPropertyWithAlpha", "HasAlpha", true);
+    pg->SetPropertyHelpString("ColourPropertyWithAlpha",
+        "Attribute \"HasAlpha\" is set to true for this property.");
+
     //
     // This demonstrates using alternative editor for colour property
     // to trigger colour dialog directly from button.
     //
     // This demonstrates using alternative editor for colour property
     // to trigger colour dialog directly from button.
@@ -1926,7 +1932,7 @@ void FormMain::CreateGrid( int style, int extraStyle )
 
     pgman->SetExtraStyle(extraStyle);
 
 
     pgman->SetExtraStyle(extraStyle);
 
-    // This is the default validation failure behavior
+    // This is the default validation failure behaviour
     m_pPropGridManager->SetValidationFailureBehavior( wxPG_VFB_MARK_CELL |
                                                       wxPG_VFB_SHOW_MESSAGEBOX );
 
     m_pPropGridManager->SetValidationFailureBehavior( wxPG_VFB_MARK_CELL |
                                                       wxPG_VFB_SHOW_MESSAGEBOX );