Adding wxpropgrid library to wxSmithKWIC and change the path from
..\wxSmith\propgrid\contrib\include
to
..\..\..\sdk\wxpropgrid\include
wxsangularmeter.cpp:
void wxsAngularMeter::OnAddExtraProperties(wxsPropertyGridManager *Grid)
{
#if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
Grid->SelectPage(0);
#else
Grid->SetTargetPage(0);
#endif
#if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
m_SectorCountId = Grid->Insert(wxT("Needle Colour"), new wxIntProperty(_("Number Of Sectors"), wxPG_LABEL,
#else
m_SectorCountId = Grid->Insert(wxT("Needle Colour"), wxIntProperty(_("Number Of Sectors"), wxPG_LABEL,
#endif
(int)m_arrSectors.Count()));
for(int i = 0; i < (int)m_arrSectors.Count(); i++)
{
InsertPropertyForSector(Grid, i);
}
wxsWidget::OnAddExtraProperties(Grid);
}
void wxsAngularMeter::OnExtraPropertyChanged(wxsPropertyGridManager *Grid, wxPGId id)
{
#if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
Grid->SelectPage(0);
#else
Grid->SetTargetPage(0);
#endif
.....
// We have to remove some entries
for(int i = NewValue; i < OldValue; i++)
{
#if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
Grid->DeleteProperty(m_arrSectors[i]->id);
#else
Grid->Delete(m_arrSectors[i]->id);
#endif
delete m_arrSectors[i];
}
....
}
void wxsAngularMeter::InsertPropertyForSector(wxsPropertyGridManager *Grid, int Position)
{
SectorDesc *Desc = m_arrSectors[Position];
wxString SectorName = wxString::Format(_("Sector %d Colour"), Position + 1);
wxString SectorDataName = wxString::Format(_("sector_%d_colour"), Position + 1);
#if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
Desc->id = Grid->Insert(wxT("Needle Colour"), new wxSystemColourProperty(SectorName, wxPG_LABEL, Desc->colour));
#else
Desc->id = Grid->Insert(wxT("Needle Colour"), wxSystemColourProperty(SectorName, wxPG_LABEL, Desc->colour));
#endif
}
bool wxsAngularMeter::HandleChangeInSector(wxsPropertyGridManager *Grid, wxPGId id, int Position)
{
......
if( Grid->GetPropertyValueType( id) == _T("wxColourPropertyValue"))
{
wxColourPropertyValue* pcolval = wxDynamicCast(Grid->GetPropertyValueAsWxObjectPtr(id), wxColourPropertyValue);
Desc->colour = pcolval->m_colour;
}
Changed = true;
....
wxsangularregulator.cpp:
void wxsAngularRegulator::OnAddExtraProperties(wxsPropertyGridManager *Grid)
{
#if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
Grid->SelectPage(0);
#else
Grid->SetTargetPage(0);
#endif
#if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
m_TagCountId = Grid->Insert(wxT("External Circle Colour"), new wxIntProperty(_("Number Of Tags"), wxPG_LABEL,
#else
m_TagCountId = Grid->Insert(wxT("External Circle Colour"), wxIntProperty(_("Number Of Tags"), wxPG_LABEL,
#endif
(int)m_arrTags.Count()));
....
}
void wxsAngularRegulator::OnExtraPropertyChanged(wxsPropertyGridManager *Grid, wxPGId id)
{
#if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
Grid->SelectPage(0);
#else
Grid->SetTargetPage(0);
#endif
.....
// We have to remove some entries
for(int i = NewValue;i < OldValue;i++)
{
#if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
Grid->DeleteProperty(m_arrTags[i]->id);
#else
Grid->Delete(m_arrTags[i]->id);
#endif
delete m_arrTags[i];
}
...
}
void wxsAngularRegulator::InsertPropertyForTag(wxsPropertyGridManager *Grid, int Position)
{
TagDesc *Desc = m_arrTags[Position];
wxString sTagName = wxString::Format(_("Tag %d Value"), Position + 1);
#if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
Desc->id = Grid->Insert(wxT("External Circle Colour"), new wxIntProperty(sTagName, wxPG_LABEL, Desc->val));
#else
Desc->id = Grid->Insert(wxT("External Circle Colour"), wxIntProperty(sTagName, wxPG_LABEL, Desc->val));
#endif
}