// Created: 2007-05-16
// RCS-ID: $Id$
// Copyright: (c) Jaakko Salli
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
void FormMain::AddTestProperties( wxPropertyGridPage* pg )
{
pg->Append( new MyColourProperty(wxT("CustomColourProperty"), wxPG_LABEL, *wxGREEN) );
- pg->GetProperty(wxT("CustomColourProperty"))->SetFlag(wxPG_PROP_AUTO_UNSPECIFIED);
+ pg->GetProperty(wxT("CustomColourProperty"))->SetAutoUnspecified(true);
pg->SetPropertyEditor( wxT("CustomColourProperty"), wxPGEditor_ComboBox );
pg->SetPropertyHelpString(wxT("CustomColourProperty"),
const int spacing = 8;
wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* rowsizer = new wxBoxSizer( wxHORIZONTAL );
- wxTextCtrl* ed = new wxTextCtrl(dlg,11,text,
- wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE|wxTE_READONLY);
+ wxTextCtrl* ed = new wxTextCtrl(dlg, 11, text,
+ wxDefaultPosition, wxDefaultSize,
+ wxTE_MULTILINE);
rowsizer->Add( ed, 1, wxEXPAND|wxALL, spacing );
topsizer->Add( rowsizer, 1, wxEXPAND, 0 );
rowsizer = new wxBoxSizer( wxHORIZONTAL );
const int spacing = 8;
wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* rowsizer = new wxBoxSizer( wxHORIZONTAL );
- wxTextCtrl* ed = new wxTextCtrl(dlg,11,wxEmptyString,
- wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE|wxTE_READONLY);
+ wxTextCtrl* ed = new wxTextCtrl(dlg, 11, wxEmptyString,
+ wxDefaultPosition, wxDefaultSize,
+ wxTE_MULTILINE);
rowsizer->Add( ed, 1, wxEXPAND|wxALL, spacing );
topsizer->Add( rowsizer, 1, wxEXPAND, 0 );
rowsizer = new wxBoxSizer( wxHORIZONTAL );
pgman = m_pPropGridManager;
}
+ {
+ //
+ // Test wxAny<->wxVariant conversion
+ RT_START_TEST(WXVARIANT_TO_WXANY_CONVERSION)
+
+ wxPGProperty* prop;
+ wxAny any;
+
+#if wxUSE_DATETIME
+ prop = pgman->GetProperty("DateProperty");
+ wxDateTime testTime = wxDateTime::Now();
+ any = testTime;
+ prop->SetValue(any);
+ if ( wxANY_AS(prop->GetValue().GetAny(), wxDateTime) != testTime )
+ RT_FAILURE();
+#endif
+
+ prop = pgman->GetProperty("IntProperty");
+ int testInt = 25537983;
+ any = testInt;
+ prop->SetValue(any);
+ if ( wxANY_AS(prop->GetValue().GetAny(), int) != testInt )
+ RT_FAILURE();
+#ifdef wxLongLong_t
+ if ( wxANY_AS(prop->GetValue().GetAny(), wxLongLong_t) != testInt )
+ RT_FAILURE();
+#endif
+
+ prop = pgman->GetProperty("StringProperty");
+ wxString testString = "asd934jfyn3";
+ any = testString;
+ prop->SetValue(any);
+ if ( wxANY_AS(prop->GetValue().GetAny(), wxString) != testString )
+ RT_FAILURE();
+
+ // Test with a type generated with IMPLEMENT_VARIANT_OBJECT()
+ prop = pgman->GetProperty("ColourProperty");
+ wxColour testCol = *wxCYAN;
+ any = testCol;
+ prop->SetValue(any);
+ if ( wxANY_AS(prop->GetValue().GetAny(), wxColour) != testCol )
+ RT_FAILURE();
+
+ // Test with a type with custom wxVariantData defined by
+ // wxPG headers.
+ prop = pgman->GetProperty("Position");
+ wxPoint testPoint(199, 199);
+ any = testPoint;
+ prop->SetValue(any);
+ if ( wxANY_AS(prop->GetValue().GetAny(), wxPoint) != testPoint )
+ RT_FAILURE();
+ }
+
{
RT_START_TEST(GetPropertyValues)
RT_ASSERT( !pg->IsPropertySelected(prop3) )
}
+ {
+ //
+ // Test label editing
+ RT_START_TEST(LABEL_EDITING)
+
+ wxPropertyGrid* pg = pgman->GetGrid();
+
+ // Just mostly test that these won't crash
+ pg->MakeColumnEditable(0, true);
+ pg->MakeColumnEditable(2, true);
+ pg->MakeColumnEditable(0, false);
+ pg->MakeColumnEditable(2, false);
+ pg->SelectProperty(wxT("Height"));
+ pg->BeginLabelEdit(0);
+ pg->BeginLabelEdit(0);
+ pg->EndLabelEdit(0);
+ pg->EndLabelEdit(0);
+
+ // Recreate grid
+ CreateGrid( -1, -1 );
+ pgman = m_pPropGridManager;
+ }
+
{
RT_START_TEST(Attributes)
wxASSERT(wxPG_EX_INIT_NOCAT == 0x00001000);
- for ( i=12; i<26; i++ )
+ for ( i=12; i<27; i++ )
{
int flag = 1<<i;
RT_MSG(wxString::Format(wxT("ExStyle: 0x%X"),flag));