]> git.saurik.com Git - wxWidgets.git/commitdiff
Removed macros to create enum and flag props with custom, static choice sets. Now...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Fri, 19 Sep 2008 17:39:09 +0000 (17:39 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Fri, 19 Sep 2008 17:39:09 +0000 (17:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55744 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/doxygen/overviews/propgrid.h
include/wx/propgrid/props.h
samples/propgrid/propgrid.cpp
samples/propgrid/tests.cpp

index c24203017bdbab110dd3bd69f48bc390f138fce8..c5d06a06563010e5dc164d88a945dddb7b76b5a4 100644 (file)
@@ -402,11 +402,11 @@ Here's extended example using values as well:
     pg->Append( new wxEnumProperty(wxT("Secondary Diet"),
                                    wxPG_LABEL,
                                    chs) );
-
 @endcode
 
-You can later change choices of property by using wxPGProperty::InsertChoice(),
-wxPGProperty::DeleteChoice(), and wxPGProperty::SetChoices().
+You can later change choices of property by using wxPGProperty::AddChoice(),
+wxPGProperty::InsertChoice(), wxPGProperty::DeleteChoice(), and
+wxPGProperty::SetChoices().
 
 <b>wxEditEnumProperty</b> is works exactly like wxEnumProperty, except
 is uses non-readonly combobox as default editor, and value is stored as
index b323220dca76280a0ed4e3bfa8dd09cecfea4381..b21d743621e0359d0f2ba53d37c3e6d9171946ce 100644 (file)
@@ -73,64 +73,6 @@ WX_PG_IMPLEMENT_STRING_PROPERTY_WITH_VALIDATOR(NAME,FLAGS) \
 wxValidator* NAME::DoGetValidator () const \
 { return (wxValidator*) NULL; }
 
-// -----------------------------------------------------------------------
-
-#define WX_PG_DECLARE_CUSTOM_FLAGS_PROPERTY_WITH_DECL(CLASSNAME,DECL) \
-DECL CLASSNAME : public wxFlagsProperty \
-{ \
-    WX_PG_DECLARE_PROPERTY_CLASS(CLASSNAME) \
-public: \
-    CLASSNAME( const wxString& label = wxPG_LABEL, \
-               const wxString& name = wxPG_LABEL, \
-               long value = -1 ); \
-    virtual ~CLASSNAME(); \
-};
-
-#define WX_PG_DECLARE_CUSTOM_FLAGS_PROPERTY(CLASSNAME) \
-WX_PG_DECLARE_CUSTOM_FLAGS_PROPERTY_WITH_DECL(CLASSNAME, class)
-
-// This will create interface for wxFlagsProperty derived class
-// named CLASSNAME.
-#define WX_PG_IMPLEMENT_CUSTOM_FLAGS_PROPERTY(CLASSNAME,LABELS,VALUES,DEFVAL) \
-WX_PG_IMPLEMENT_PROPERTY_CLASS(CLASSNAME,wxFlagsProperty,long_##CLASSNAME,\
-                               long,TextCtrl) \
-CLASSNAME::CLASSNAME( const wxString& label, \
-                      const wxString& name, \
-                      long value ) \
-    : wxFlagsProperty(label,name,LABELS,VALUES,value!=-1?value:DEFVAL) \
-{ \
-    m_flags |= wxPG_PROP_STATIC_CHOICES; \
-} \
-CLASSNAME::~CLASSNAME() { }
-
-
-// -----------------------------------------------------------------------
-
-#define WX_PG_DECLARE_CUSTOM_ENUM_PROPERTY_WITH_DECL(CLASSNAME, DECL) \
-class CLASSNAME : public wxEnumProperty \
-{ \
-    WX_PG_DECLARE_PROPERTY_CLASS(CLASSNAME) \
-public: \
-    CLASSNAME( const wxString& label = wxPG_LABEL, \
-               const wxString& name = wxPG_LABEL, \
-               int value = -1 ); \
-    virtual ~CLASSNAME(); \
-};
-
-#define WX_PG_DECLARE_CUSTOM_ENUM_PROPERTY(CLASSNAME) \
-WX_PG_DECLARE_CUSTOM_ENUM_PROPERTY_WITH_DECL(CLASSNAME, class)
-
-#define WX_PG_IMPLEMENT_CUSTOM_ENUM_PROPERTY(CLASSNAME,LABELS,VALUES,DEFVAL) \
-WX_PG_IMPLEMENT_PROPERTY_CLASS(CLASSNAME, wxEnumProperty, long_##CLASSNAME, \
-                               int, Choice) \
-CLASSNAME::CLASSNAME( const wxString& label, const wxString& name, int value ) \
-    : wxEnumProperty(label,name,LABELS,VALUES,value!=-1?value:DEFVAL) \
-{ \
-    m_flags |= wxPG_PROP_STATIC_CHOICES; \
-} \
-CLASSNAME::~CLASSNAME() { }
-
-
 // -----------------------------------------------------------------------
 
 #define WX_PG_DECLARE_CUSTOM_COLOUR_PROPERTY_WITH_DECL(CLASSNAME, DECL) \
index d6ab769b8439670bf1e1210ded4ab846e5b30d4a..06529f7fa44f4f105f2c910ff9634ea89da1e0b4 100644 (file)
@@ -1349,6 +1349,7 @@ void FormMain::PopulateWithExamples ()
     wxPropertyGridManager* pgman = m_pPropGridManager;
     wxPropertyGridPage* pg = pgman->GetPage(wxT("Examples"));
     wxPGProperty* pid;
+    wxPGProperty* prop;
 
     //pg->Append( new wxPropertyCategory(wxT("Examples (low priority)"),wxT("Examples")) );
     //pg->SetPropertyHelpString ( wxT("Examples"), wxT("This category has example of (almost) every built-in property class.") );
@@ -1403,7 +1404,7 @@ void FormMain::PopulateWithExamples ()
 
     // A file selector property. Note that argument between name
     // and initial value is wildcard (format same as in wxFileDialog).
-    wxPGProperty* prop = new wxFileProperty( wxT("FileProperty"), wxT("TextFile") );
+    prop = new wxFileProperty( wxT("FileProperty"), wxT("TextFile") );
     pg->Append( prop );
 
     prop->SetAttribute(wxPG_FILE_WILDCARD,wxT("Text Files (*.txt)|*.txt"));
@@ -1482,10 +1483,13 @@ void FormMain::PopulateWithExamples ()
                                   240) );
     pg->GetProperty(wxT("EnumProperty 2"))->AddChoice(wxT("Testing Extra"), 360);
 
-    // Add a second time to test that the caching works
-    pg->Append( new wxEnumProperty(wxT("EnumProperty 3"),wxPG_LABEL,
-        soc, 360 ) );
-    pg->SetPropertyHelpString(wxT("EnumProperty 3"),
+    // Add a second time to test that the caching works. Also use
+    // short form of constructor list + SetChoices.
+    prop = new wxEnumProperty(wxT("EnumProperty 3"), wxPG_LABEL);
+    pg->Append( prop );
+    prop->SetChoices(soc);
+    prop->SetValue(360);
+    pg->SetPropertyHelpString(prop,
         wxT("Should have same choices as EnumProperty 2"));
 
     pg->Append( new wxEnumProperty(wxT("EnumProperty 4"),wxPG_LABEL,
index 0c8085141fb24a564962e044729fcd5d3d7d37a6..217229f64061a0b59e2a89e583ae70c2f61d796a 100644 (file)
 #include "sampleprops.h"
 
 
-// -----------------------------------------------------------------------
-// Declare custom test properties
-// -----------------------------------------------------------------------
-
-WX_PG_DECLARE_CUSTOM_FLAGS_PROPERTY(wxTestCustomFlagsProperty)
-
-WX_PG_DECLARE_CUSTOM_ENUM_PROPERTY(wxTestCustomEnumProperty)
-
-
 // -----------------------------------------------------------------------
 // wxTestCustomFlagsProperty
 // -----------------------------------------------------------------------
@@ -73,18 +64,6 @@ static const long _fs_framestyle_values[] = {
     wxFRAME_SHAPED
 };
 
-
-WX_PG_IMPLEMENT_CUSTOM_FLAGS_PROPERTY(wxTestCustomFlagsProperty,
-                                      _fs_framestyle_labels,
-                                      _fs_framestyle_values,
-                                      wxDEFAULT_FRAME_STYLE)
-
-WX_PG_IMPLEMENT_CUSTOM_ENUM_PROPERTY(wxTestCustomEnumProperty,
-                                      _fs_framestyle_labels,
-                                      _fs_framestyle_values,
-                                      wxCAPTION)
-
-
 // Colour labels. Last (before NULL, if any) must be Custom.
 static const wxChar* mycolprop_labels[] = {
     wxT("Black"),
@@ -243,11 +222,6 @@ public:
 
 void FormMain::AddTestProperties( wxPropertyGridPage* pg )
 {
-    pg->Append( new wxTestCustomFlagsProperty(wxT("Custom FlagsProperty"), wxPG_LABEL ) );
-    pg->SetPropertyEditor( wxT("Custom FlagsProperty"), wxPG_EDITOR(TextCtrlAndButton) );
-
-    pg->Append( new wxTestCustomEnumProperty(wxT("Custom EnumProperty"), wxPG_LABEL ) );
-
     pg->Append( new wxMyColourProperty(wxT("CustomColourProperty1")) );
 
     pg->SetPropertyHelpString(wxT("CustomColourProperty1"),