Item(2)->SetValue( vector.z );
}
-void wxVectorProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
+wxVariant wxVectorProperty::ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const
{
wxVector3f vector;
vector << thisValue;
case 1: vector.y = childValue.GetDouble(); break;
case 2: vector.z = childValue.GetDouble(); break;
}
- thisValue << vector;
+ wxVariant newVariant;
+ newVariant << vector;
+ return newVariant;
}
Item(2)->SetValue( WXVARIANT(triangle.c) );
}
-void wxTriangleProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
+wxVariant wxTriangleProperty::ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const
{
wxTriangle triangle;
triangle << thisValue;
case 1: triangle.b = vector; break;
case 2: triangle.c = vector; break;
}
- thisValue << triangle;
+ wxVariant newVariant;
+ newVariant << triangle;
+ return newVariant;
}
ID_SELECTSTYLE,
ID_SAVESTATE,
ID_RESTORESTATE,
- ID_RUNMINIMAL
+ ID_RUNMINIMAL,
+ ID_ENABLELABELEDITING
};
// -----------------------------------------------------------------------
EVT_PG_DOUBLE_CLICK( PGID, FormMain::OnPropertyGridItemDoubleClick )
// This occurs when propgridmanager's page changes.
EVT_PG_PAGE_CHANGED( PGID, FormMain::OnPropertyGridPageChange )
+ // This occurs when user starts editing a property label
+ EVT_PG_LABEL_EDIT_BEGIN( PGID,
+ FormMain::OnPropertyGridLabelEditBegin )
+ // This occurs when user stops editing a property label
+ EVT_PG_LABEL_EDIT_ENDING( PGID,
+ FormMain::OnPropertyGridLabelEditEnding )
// This occurs when property's editor button (if any) is clicked.
EVT_BUTTON( PGID, FormMain::OnPropertyGridButtonClick )
EVT_MENU( ID_SETBGCOLOURRECUR, FormMain::OnSetBackgroundColour )
EVT_MENU( ID_CLEARMODIF, FormMain::OnClearModifyStatusClick )
EVT_MENU( ID_FREEZE, FormMain::OnFreezeClick )
+ EVT_MENU( ID_ENABLELABELEDITING, FormMain::OnEnableLabelEditing )
EVT_MENU( ID_DUMPLIST, FormMain::OnDumpList )
EVT_MENU( ID_COLOURSCHEME1, FormMain::OnColourScheme )
SetSize ( m_pPropGridManager->GetPropertyValueAsInt(property), -1, -1, -1, wxSIZE_USE_EXISTING );
else if ( name == wxT("Y") )
// wxPGVariantToInt is safe long int value getter
- SetSize ( -1, wxPGVariantToInt(value), -1, -1, wxSIZE_USE_EXISTING );
+ SetSize ( -1, value.GetLong(), -1, -1, wxSIZE_USE_EXISTING );
else if ( name == wxT("Width") )
SetSize ( -1, -1, m_pPropGridManager->GetPropertyValueAsInt(property), -1, wxSIZE_USE_EXISTING );
else if ( name == wxT("Height") )
- SetSize ( -1, -1, -1, wxPGVariantToInt(value), wxSIZE_USE_EXISTING );
+ SetSize ( -1, -1, -1, value.GetLong(), wxSIZE_USE_EXISTING );
else if ( name == wxT("Label") )
{
SetTitle ( m_pPropGridManager->GetPropertyValueAsString(property) );
// -----------------------------------------------------------------------
+void FormMain::OnPropertyGridLabelEditBegin( wxPropertyGridEvent& event )
+{
+ wxLogDebug("wxPG_EVT_LABEL_EDIT_BEGIN(%s)",
+ event.GetProperty()->GetLabel().c_str());
+}
+
+// -----------------------------------------------------------------------
+
+void FormMain::OnPropertyGridLabelEditEnding( wxPropertyGridEvent& event )
+{
+ wxLogDebug("wxPG_EVT_LABEL_EDIT_ENDING(%s)",
+ event.GetProperty()->GetLabel().c_str());
+}
+
+// -----------------------------------------------------------------------
+
void FormMain::OnPropertyGridHighlight( wxPropertyGridEvent& WXUNUSED(event) )
{
}
void wxMyPropertyGridPage::OnPropertyChange( wxPropertyGridEvent& event )
{
wxPGProperty* p = event.GetProperty();
- wxLogDebug(wxT("wxMyPropertyGridPage::OnPropertyChange('%s', to value '%s')"),
+ wxLogVerbose(wxT("wxMyPropertyGridPage::OnPropertyChange('%s', to value '%s')"),
p->GetName().c_str(),
p->GetDisplayedString().c_str());
}
void wxMyPropertyGridPage::OnPropertyChanging( wxPropertyGridEvent& event )
{
wxPGProperty* p = event.GetProperty();
- wxLogDebug(wxT("wxMyPropertyGridPage::OnPropertyChanging('%s', to value '%s')"),
+ wxLogVerbose(wxT("wxMyPropertyGridPage::OnPropertyChanging('%s', to value '%s')"),
p->GetName().c_str(),
event.GetValue().GetString().c_str());
}
if ( extraStyle == -1 )
// default extra style
- extraStyle = wxPG_EX_MODE_BUTTONS;
+ extraStyle = wxPG_EX_MODE_BUTTONS |
+ wxPG_EX_MULTIPLE_SELECTION;
//| wxPG_EX_AUTO_UNSPECIFIED_VALUES
//| wxPG_EX_GREY_LABEL_WHEN_DISABLED
//| wxPG_EX_NATIVE_DOUBLE_BUFFERING
// event handling will obviously be broken.
PGID, /*wxID_ANY*/
wxDefaultPosition,
- wxDefaultSize,
+ wxSize(100, 100), // FIXME: wxDefaultSize gives assertion in propgrid.
+ // But calling SetInitialSize in manager changes the code
+ // order to the grid gets created immediately, before SetExtraStyle
+ // is called.
style );
m_propGrid = pgman->GetGrid();
wxPG_TOOLBAR |
wxPG_DESCRIPTION,
// extra style
- wxPG_EX_MODE_BUTTONS
+ wxPG_EX_MODE_BUTTONS |
+ wxPG_EX_MULTIPLE_SELECTION
//| wxPG_EX_AUTO_UNSPECIFIED_VALUES
//| wxPG_EX_GREY_LABEL_WHEN_DISABLED
//| wxPG_EX_NATIVE_DOUBLE_BUFFERING
menuTry->Append(ID_SELECTSTYLE, wxT("Set Window Style"),
wxT("Select window style flags used by the grid."));
+ menuTry->Append(ID_ENABLELABELEDITING, "Enable label editing",
+ "This calls wxPropertyGrid::MakeColumnEditable(0)");
menuTry->AppendSeparator();
menuTry->AppendRadioItem( ID_COLOURSCHEME1, wxT("Standard Colour Scheme") );
menuTry->AppendRadioItem( ID_COLOURSCHEME2, wxT("White Colour Scheme") );
wxLogDebug(wxT("FormMain::OnContextMenu(%i,%i)"),
event.GetPosition().x,event.GetPosition().y);
+ wxUnusedVar(event);
+
//event.Skip();
}
// -----------------------------------------------------------------------
+void FormMain::OnEnableLabelEditing( wxCommandEvent& WXUNUSED(event) )
+{
+ m_propGrid->MakeColumnEditable(0);
+}
+
+// -----------------------------------------------------------------------
+
void FormMain::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxString msg;
wxT("Jaakko Salli"), wxVERSION_STRING
);
- wxMessageBox(msg, _T("About"), wxOK | wxICON_INFORMATION, this);
+ wxMessageBox(msg, wxT("About"), wxOK | wxICON_INFORMATION, this);
}
// -----------------------------------------------------------------------
ADD_FLAG(wxPG_LIMITED_EDITING)
ADD_FLAG(wxPG_TOOLBAR)
ADD_FLAG(wxPG_DESCRIPTION)
+ ADD_FLAG(wxPG_NO_INTERNAL_BORDER)
wxMultiChoiceDialog dlg( this, wxT("Select window styles to use"),
wxT("wxPropertyGrid Window Style"), chs );
dlg.SetSelections(sel);
ADD_FLAG(wxPG_EX_NATIVE_DOUBLE_BUFFERING)
ADD_FLAG(wxPG_EX_AUTO_UNSPECIFIED_VALUES)
ADD_FLAG(wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES)
+ ADD_FLAG(wxPG_EX_HIDE_PAGE_BUTTONS)
+ ADD_FLAG(wxPG_EX_MULTIPLE_SELECTION)
+ ADD_FLAG(wxPG_EX_ENABLE_TLP_TRACKING)
+ ADD_FLAG(wxPG_EX_NO_TOOLBAR_DIVIDER)
+ ADD_FLAG(wxPG_EX_TOOLBAR_SEPARATOR)
wxMultiChoiceDialog dlg( this, wxT("Select extra window styles to use"),
wxT("wxPropertyGrid Extra Style"), chs );
dlg.SetSelections(sel);
//wxLocale Locale;
//Locale.Init(wxLANGUAGE_FINNISH);
- FormMain* frame = Form1 = new FormMain( wxT("wxPropertyGrid Sample"), wxPoint(0,0), wxSize(300,500) );
- frame->Show(true);
+ FormMain* frame = Form1 = new FormMain( wxT("wxPropertyGrid Sample"), wxPoint(0,0), wxSize(300,500) );
+ frame->Show(true);
//
// Parse command-line
}
}
- return true;
+ return true;
}
// -----------------------------------------------------------------------