Allow changing wxPropertyGridManager wxPG_EX_NO_TOOLBAR_DIVIDER style
Currently this style can be set only at toolbar creation and cannot be changed afterwards.
This commit is contained in:
@@ -146,7 +146,7 @@ wxPG_EX_INIT_NOCAT = 0x00001000,
|
||||
wxPG_EX_NO_FLAT_TOOLBAR = 0x00002000,
|
||||
|
||||
/**
|
||||
Shows alphabetic/categoric mode buttons from tool bar.
|
||||
Shows alphabetic/categoric mode buttons on wxPropertyGridManager tool bar.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_EX_MODE_BUTTONS = 0x00008000,
|
||||
@@ -185,7 +185,7 @@ wxPG_EX_AUTO_UNSPECIFIED_VALUES = 0x00200000,
|
||||
wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES = 0x00400000,
|
||||
|
||||
/**
|
||||
Hides page selection buttons from tool bar.
|
||||
Hides page selection buttons from wxPropertyGridManager tool bar.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_EX_HIDE_PAGE_BUTTONS = 0x01000000,
|
||||
@@ -219,12 +219,12 @@ wxPG_EX_MULTIPLE_SELECTION = 0x02000000,
|
||||
*/
|
||||
wxPG_EX_ENABLE_TLP_TRACKING = 0x04000000,
|
||||
|
||||
/** Don't show divider above toolbar, on Windows.
|
||||
/** Don't show divider above wxPropertyGridManager toolbar (wxMSW only).
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_EX_NO_TOOLBAR_DIVIDER = 0x04000000,
|
||||
|
||||
/** Show a separator below the toolbar.
|
||||
/** Show a separator below the wxPropertyGridManager toolbar.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_EX_TOOLBAR_SEPARATOR = 0x08000000,
|
||||
@@ -235,14 +235,23 @@ wxPG_EX_TOOLBAR_SEPARATOR = 0x08000000,
|
||||
*/
|
||||
wxPG_EX_ALWAYS_ALLOW_FOCUS = 0x00100000,
|
||||
|
||||
/** A mask which can be used to filter (out) all extra styles applicable to wxPropertyGrid.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_EX_WINDOW_PG_STYLE_MASK = wxPG_EX_INIT_NOCAT|wxPG_EX_HELP_AS_TOOLTIPS|wxPG_EX_NATIVE_DOUBLE_BUFFERING|
|
||||
wxPG_EX_AUTO_UNSPECIFIED_VALUES|wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES|
|
||||
wxPG_EX_MULTIPLE_SELECTION|wxPG_EX_ENABLE_TLP_TRACKING|wxPG_EX_ALWAYS_ALLOW_FOCUS,
|
||||
|
||||
/** A mask which can be used to filter (out) all extra styles applicable to wxPropertyGridManager.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_EX_WINDOW_PGMAN_STYLE_MASK = wxPG_EX_NO_FLAT_TOOLBAR|wxPG_EX_MODE_BUTTONS|wxPG_EX_HIDE_PAGE_BUTTONS|
|
||||
wxPG_EX_NO_TOOLBAR_DIVIDER|wxPG_EX_TOOLBAR_SEPARATOR,
|
||||
|
||||
/** A mask which can be used to filter (out) all extra styles.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_EX_WINDOW_STYLE_MASK = wxPG_EX_INIT_NOCAT|wxPG_EX_NO_FLAT_TOOLBAR|wxPG_EX_MODE_BUTTONS|
|
||||
wxPG_EX_HELP_AS_TOOLTIPS|wxPG_EX_NATIVE_DOUBLE_BUFFERING|wxPG_EX_AUTO_UNSPECIFIED_VALUES|
|
||||
wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES|wxPG_EX_HIDE_PAGE_BUTTONS|wxPG_EX_MULTIPLE_SELECTION|
|
||||
wxPG_EX_ENABLE_TLP_TRACKING|wxPG_EX_NO_TOOLBAR_DIVIDER|wxPG_EX_TOOLBAR_SEPARATOR|
|
||||
wxPG_EX_ALWAYS_ALLOW_FOCUS
|
||||
wxPG_EX_WINDOW_STYLE_MASK = wxPG_EX_WINDOW_PG_STYLE_MASK|wxPG_EX_WINDOW_PGMAN_STYLE_MASK
|
||||
};
|
||||
|
||||
/** Combines various styles.
|
||||
|
@@ -673,6 +673,9 @@ bool wxPropertyGridManager::SetFont( const wxFont& font )
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// Which flags can affect the toolbar
|
||||
#define wxPG_EX_WINDOW_TOOLBAR_STYLE_MASK (wxPG_EX_NO_FLAT_TOOLBAR|wxPG_EX_MODE_BUTTONS|wxPG_EX_NO_TOOLBAR_DIVIDER)
|
||||
|
||||
void wxPropertyGridManager::SetExtraStyle( long exStyle )
|
||||
{
|
||||
// Pass only relevant flags to wxPropertyGrid.
|
||||
@@ -683,9 +686,14 @@ void wxPropertyGridManager::SetExtraStyle( long exStyle )
|
||||
exStyle &= ~wxPG_EX_WINDOW_PG_STYLE_MASK;
|
||||
exStyle |= m_pPropGrid->GetExtraStyle() & wxPG_EX_WINDOW_PG_STYLE_MASK;
|
||||
|
||||
#if wxUSE_TOOLBAR
|
||||
bool toolbarStyleChanged =
|
||||
(GetExtraStyle() & wxPG_EX_WINDOW_TOOLBAR_STYLE_MASK) != (exStyle & wxPG_EX_WINDOW_TOOLBAR_STYLE_MASK);
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
wxWindow::SetExtraStyle( exStyle );
|
||||
#if wxUSE_TOOLBAR
|
||||
if ( (exStyle & (wxPG_EX_NO_FLAT_TOOLBAR|wxPG_EX_MODE_BUTTONS)) && m_pToolbar )
|
||||
if ( toolbarStyleChanged && m_pToolbar )
|
||||
RecreateControls();
|
||||
#endif
|
||||
}
|
||||
@@ -1479,13 +1487,12 @@ void wxPropertyGridManager::RecreateControls()
|
||||
{
|
||||
bool tbModified = false;
|
||||
|
||||
long toolBarFlags = HasExtraStyle(wxPG_EX_NO_FLAT_TOOLBAR) ? 0 : wxTB_FLAT;
|
||||
if ( HasExtraStyle(wxPG_EX_NO_TOOLBAR_DIVIDER) )
|
||||
toolBarFlags |= wxTB_NODIVIDER;
|
||||
// Has toolbar.
|
||||
if ( !m_pToolbar )
|
||||
{
|
||||
long toolBarFlags = HasExtraStyle(wxPG_EX_NO_FLAT_TOOLBAR)? 0: wxTB_FLAT;
|
||||
if ( HasExtraStyle(wxPG_EX_NO_TOOLBAR_DIVIDER) )
|
||||
toolBarFlags |= wxTB_NODIVIDER;
|
||||
|
||||
m_pToolbar = new wxToolBar(this, wxID_ANY,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
@@ -1514,6 +1521,11 @@ void wxPropertyGridManager::RecreateControls()
|
||||
m_categorizedModeToolId = -1;
|
||||
m_alphabeticModeToolId = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pToolbar->SetWindowStyle(toolBarFlags);
|
||||
tbModified = true;
|
||||
}
|
||||
|
||||
if ( HasExtraStyle(wxPG_EX_MODE_BUTTONS) )
|
||||
{
|
||||
|
Reference in New Issue
Block a user