Added Description Box Height to saveable/restoreable editable state
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56074 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -725,6 +725,10 @@ protected:
|
|||||||
|
|
||||||
void SetDescribedProperty( wxPGProperty* p );
|
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 );
|
virtual bool ProcessEvent( wxEvent& event );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -794,6 +794,9 @@ public:
|
|||||||
PageState = 0x08,
|
PageState = 0x08,
|
||||||
/** Include splitter position. Stored for each page. */
|
/** Include splitter position. Stored for each page. */
|
||||||
SplitterPosState = 0x10,
|
SplitterPosState = 0x10,
|
||||||
|
/** Include description box size.
|
||||||
|
Only applies to wxPropertyGridManager. */
|
||||||
|
DescBoxState = 0x20,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Include all supported user editable state information.
|
Include all supported user editable state information.
|
||||||
@@ -802,7 +805,8 @@ public:
|
|||||||
ExpandedState |
|
ExpandedState |
|
||||||
ScrollPosState |
|
ScrollPosState |
|
||||||
PageState |
|
PageState |
|
||||||
SplitterPosState
|
SplitterPosState |
|
||||||
|
DescBoxState
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1435,6 +1439,27 @@ public:
|
|||||||
|
|
||||||
protected:
|
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).
|
// Returns page state data for given (sub) page (-1 means current page).
|
||||||
virtual wxPropertyGridPageState* GetPageState( int pageIndex ) const
|
virtual wxPropertyGridPageState* GetPageState( int pageIndex ) const
|
||||||
{
|
{
|
||||||
|
@@ -520,11 +520,19 @@ public:
|
|||||||
PageState = 0x08,
|
PageState = 0x08,
|
||||||
/** Include splitter position. Stored for each page. */
|
/** Include splitter position. Stored for each page. */
|
||||||
SplitterPosState = 0x10,
|
SplitterPosState = 0x10,
|
||||||
|
/** Include description box size.
|
||||||
|
Only applies to wxPropertyGridManager. */
|
||||||
|
DescBoxState = 0x20,
|
||||||
|
|
||||||
/** Include all supported user editable state information. This is
|
/**
|
||||||
usually the default value. */
|
Include all supported user editable state information.
|
||||||
AllStates = SelectionState | ExpandedState | ScrollPosState |
|
This is usually the default value. */
|
||||||
PageState | SplitterPosState
|
AllStates = SelectionState |
|
||||||
|
ExpandedState |
|
||||||
|
ScrollPosState |
|
||||||
|
PageState |
|
||||||
|
SplitterPosState |
|
||||||
|
DescBoxState
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1396,6 +1396,29 @@ void wxPropertyGridManager::OnToolbarClick( wxCommandEvent &event )
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
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 )
|
void wxPropertyGridManager::SetDescription( const wxString& label, const wxString& content )
|
||||||
{
|
{
|
||||||
if ( m_pTxtHelpCaption )
|
if ( m_pTxtHelpCaption )
|
||||||
|
@@ -1012,6 +1012,11 @@ wxString wxPropertyGridInterface::SaveEditableState( int includedStates ) const
|
|||||||
else
|
else
|
||||||
result += wxS("0;");
|
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.RemoveLast(); // Remove last semicolon
|
||||||
result += wxS("|");
|
result += wxS("|");
|
||||||
}
|
}
|
||||||
@@ -1149,6 +1154,21 @@ bool wxPropertyGridInterface::RestoreEditableState( const wxString& src, int res
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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
|
else
|
||||||
{
|
{
|
||||||
res = false;
|
res = false;
|
||||||
|
Reference in New Issue
Block a user