void SetDescribedProperty( wxPGProperty* p );
+ // Reimplement these to handle "descboxheight" state item
+ virtual bool SetEditableStateItem( const wxString& name, wxVariant value );
+ virtual wxVariant GetEditableStateItem( const wxString& name ) const;
+
virtual bool ProcessEvent( wxEvent& event );
private:
PageState = 0x08,
/** Include splitter position. Stored for each page. */
SplitterPosState = 0x10,
+ /** Include description box size.
+ Only applies to wxPropertyGridManager. */
+ DescBoxState = 0x20,
/**
Include all supported user editable state information.
ExpandedState |
ScrollPosState |
PageState |
- SplitterPosState
+ SplitterPosState |
+ DescBoxState
};
/**
protected:
+ /**
+ In derived class, implement to set editable state component with
+ given name to given value.
+ */
+ virtual bool SetEditableStateItem( const wxString& name, wxVariant value )
+ {
+ wxUnusedVar(name);
+ wxUnusedVar(value);
+ return false;
+ }
+
+ /**
+ In derived class, implement to return editable state component with
+ given name.
+ */
+ virtual wxVariant GetEditableStateItem( const wxString& name ) const
+ {
+ wxUnusedVar(name);
+ return wxNullVariant;
+ }
+
// Returns page state data for given (sub) page (-1 means current page).
virtual wxPropertyGridPageState* GetPageState( int pageIndex ) const
{
PageState = 0x08,
/** Include splitter position. Stored for each page. */
SplitterPosState = 0x10,
-
- /** Include all supported user editable state information. This is
- usually the default value. */
- AllStates = SelectionState | ExpandedState | ScrollPosState |
- PageState | SplitterPosState
+ /** Include description box size.
+ Only applies to wxPropertyGridManager. */
+ DescBoxState = 0x20,
+
+ /**
+ Include all supported user editable state information.
+ This is usually the default value. */
+ AllStates = SelectionState |
+ ExpandedState |
+ ScrollPosState |
+ PageState |
+ SplitterPosState |
+ DescBoxState
};
/**
// -----------------------------------------------------------------------
+bool wxPropertyGridManager::SetEditableStateItem( const wxString& name, wxVariant value )
+{
+ if ( name == wxS("descboxheight") )
+ {
+ SetDescBoxHeight(value.GetLong(), true);
+ return true;
+ }
+ return false;
+}
+
+// -----------------------------------------------------------------------
+
+wxVariant wxPropertyGridManager::GetEditableStateItem( const wxString& name ) const
+{
+ if ( name == wxS("descboxheight") )
+ {
+ return (long) GetDescBoxHeight();
+ }
+ return wxNullVariant;
+}
+
+// -----------------------------------------------------------------------
+
void wxPropertyGridManager::SetDescription( const wxString& label, const wxString& content )
{
if ( m_pTxtHelpCaption )
else
result += wxS("0;");
}
+ if ( includedStates & DescBoxState )
+ {
+ wxVariant v = GetEditableStateItem(wxS("descboxheight"));
+ result += wxString::Format(wxS("descboxheight=%i;"), (int)v.GetLong());
+ }
result.RemoveLast(); // Remove last semicolon
result += wxS("|");
}
}
}
}
+ else if ( key == wxS("descboxheight") )
+ {
+ if ( restoreStates & DescBoxState )
+ {
+ long descBoxHeight;
+ if ( values.size() == 1 && values[0].ToLong(&descBoxHeight) )
+ {
+ SetEditableStateItem(wxS("descboxheight"), descBoxHeight);
+ }
+ else
+ {
+ res = false;
+ }
+ }
+ }
else
{
res = false;