Refactor propgrid sample
Simplify implementation by creating panel and sizer holding wxPG instance only once in FormMain ctor.
This commit is contained in:
@@ -482,7 +482,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
|
||||
}
|
||||
|
||||
// Recreate grid
|
||||
CreateGrid( -1, -1 );
|
||||
ReplaceGrid( -1, -1 );
|
||||
pgman = m_pPropGridManager;
|
||||
}
|
||||
|
||||
@@ -502,7 +502,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
|
||||
}
|
||||
|
||||
// Recreate grid
|
||||
CreateGrid( -1, -1 );
|
||||
ReplaceGrid( -1, -1 );
|
||||
pgman = m_pPropGridManager;
|
||||
}
|
||||
|
||||
@@ -812,7 +812,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
|
||||
// Test multiple selection
|
||||
RT_START_TEST(MULTIPLE_SELECTION)
|
||||
if ( !(pgman->GetExtraStyle() & wxPG_EX_MULTIPLE_SELECTION) )
|
||||
CreateGrid( -1, wxPG_EX_MULTIPLE_SELECTION);
|
||||
ReplaceGrid( -1, wxPG_EX_MULTIPLE_SELECTION);
|
||||
pgman = m_pPropGridManager;
|
||||
|
||||
pg = pgman->GetGrid();
|
||||
@@ -942,7 +942,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
|
||||
pg->EndLabelEdit(0);
|
||||
|
||||
// Recreate grid
|
||||
CreateGrid( -1, -1 );
|
||||
ReplaceGrid( -1, -1 );
|
||||
pgman = m_pPropGridManager;
|
||||
}
|
||||
|
||||
@@ -1231,7 +1231,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
|
||||
enumProp->DeleteChoice(ind);
|
||||
|
||||
// Recreate the original grid
|
||||
CreateGrid( -1, -1 );
|
||||
ReplaceGrid( -1, -1 );
|
||||
pgman = m_pPropGridManager;
|
||||
}
|
||||
|
||||
@@ -1364,7 +1364,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
|
||||
RT_FAILURE();
|
||||
|
||||
// Recreate the original grid
|
||||
CreateGrid( -1, -1 );
|
||||
ReplaceGrid( -1, -1 );
|
||||
pgman = m_pPropGridManager;
|
||||
|
||||
// Grid clear
|
||||
@@ -1375,33 +1375,24 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
|
||||
RT_FAILURE();
|
||||
|
||||
// Recreate the original grid
|
||||
CreateGrid( -1, -1 );
|
||||
ReplaceGrid( -1, -1 );
|
||||
pgman = m_pPropGridManager;
|
||||
}
|
||||
|
||||
{
|
||||
RT_START_TEST(SetSplitterPosition)
|
||||
|
||||
InitPanel();
|
||||
|
||||
const int trySplitterPos = 50;
|
||||
|
||||
int style = wxPG_AUTO_SORT; // wxPG_SPLITTER_AUTO_CENTER;
|
||||
pgman = m_pPropGridManager =
|
||||
new wxPropertyGridManager(m_panel, wxID_ANY,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
style );
|
||||
ReplaceGrid(style, -1);
|
||||
pgman = m_pPropGridManager;
|
||||
|
||||
PopulateGrid();
|
||||
pgman->SetSplitterPosition(trySplitterPos);
|
||||
|
||||
if ( pgman->GetGrid()->GetSplitterPosition() != trySplitterPos )
|
||||
RT_FAILURE_MSG(wxString::Format("Splitter position was %i (should have been %i)",(int)pgman->GetGrid()->GetSplitterPosition(),trySplitterPos));
|
||||
|
||||
m_topSizer->Add( m_pPropGridManager, wxSizerFlags(1).Expand());
|
||||
FinalizePanel();
|
||||
|
||||
wxSize origSz = GetSize();
|
||||
|
||||
wxSize sz = origSz;
|
||||
@@ -1414,7 +1405,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
|
||||
SetSize(origSz);
|
||||
|
||||
// Recreate the original grid
|
||||
CreateGrid( -1, -1 );
|
||||
ReplaceGrid( -1, -1 );
|
||||
pgman = m_pPropGridManager;
|
||||
}
|
||||
|
||||
@@ -1525,7 +1516,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
|
||||
}
|
||||
|
||||
// Recreate the original grid
|
||||
CreateGrid( -1, -1 );
|
||||
ReplaceGrid( -1, -1 );
|
||||
pgman = m_pPropGridManager;
|
||||
}
|
||||
|
||||
@@ -1773,7 +1764,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
|
||||
RT_START_TEST(MultipleColumns)
|
||||
|
||||
// Test with multiple columns
|
||||
CreateGrid( -1, -1 );
|
||||
ReplaceGrid( -1, -1 );
|
||||
FinalizeFramePosition();
|
||||
pgman = m_pPropGridManager;
|
||||
for ( i=3; i<12; i+=2 )
|
||||
@@ -1797,7 +1788,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
|
||||
{
|
||||
int flag = 1<<i;
|
||||
RT_MSG(wxString::Format("Style: 0x%X",flag));
|
||||
CreateGrid( flag, -1 );
|
||||
ReplaceGrid( flag, -1 );
|
||||
pgman = m_pPropGridManager;
|
||||
Update();
|
||||
wxMilliSleep(500);
|
||||
@@ -1809,14 +1800,14 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
|
||||
{
|
||||
int flag = 1<<i;
|
||||
RT_MSG(wxString::Format("ExStyle: 0x%X",flag));
|
||||
CreateGrid( -1, flag );
|
||||
ReplaceGrid( -1, flag );
|
||||
pgman = m_pPropGridManager;
|
||||
Update();
|
||||
wxMilliSleep(500);
|
||||
}
|
||||
|
||||
// Recreate the original grid
|
||||
CreateGrid( -1, -1 );
|
||||
ReplaceGrid( -1, -1 );
|
||||
pgman = m_pPropGridManager;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user