Use HasExtraStyle() function to examine extra wxPG flags.

This dedicated function to check the extra flag is used instead of doing explicit check of the value returned by GetExtraStyle() function.
This commit is contained in:
Artur Wieczorek
2015-05-21 20:07:58 +02:00
parent 716656ae47
commit a39311bc2d
3 changed files with 20 additions and 20 deletions

View File

@@ -1001,12 +1001,12 @@ wxPropertyGridPage* wxPropertyGridManager::InsertPage( int index,
if ( !m_pToolbar ) if ( !m_pToolbar )
RecreateControls(); RecreateControls();
if ( !(GetExtraStyle()&wxPG_EX_HIDE_PAGE_BUTTONS) ) if ( !HasExtraStyle(wxPG_EX_HIDE_PAGE_BUTTONS) )
{ {
wxASSERT( m_pToolbar ); wxASSERT( m_pToolbar );
// Add separator before first page. // Add separator before first page.
if ( GetPageCount() < 2 && (GetExtraStyle()&wxPG_EX_MODE_BUTTONS) && if ( GetPageCount() < 2 && HasExtraStyle(wxPG_EX_MODE_BUTTONS) &&
m_pToolbar->GetToolsCount() < 3 ) m_pToolbar->GetToolsCount() < 3 )
m_pToolbar->AddSeparator(); m_pToolbar->AddSeparator();
@@ -1167,11 +1167,11 @@ bool wxPropertyGridManager::RemovePage( int page )
{ {
wxASSERT( m_pToolbar ); wxASSERT( m_pToolbar );
int toolPos = GetExtraStyle() & wxPG_EX_MODE_BUTTONS ? 3 : 0; int toolPos = HasExtraStyle(wxPG_EX_MODE_BUTTONS) ? 3 : 0;
toolPos += page; toolPos += page;
// Delete separator as well, for consistency // Delete separator as well, for consistency
if ( (GetExtraStyle() & wxPG_EX_MODE_BUTTONS) && if ( HasExtraStyle(wxPG_EX_MODE_BUTTONS) &&
GetPageCount() == 1 ) GetPageCount() == 1 )
m_pToolbar->DeleteToolByPos(2); m_pToolbar->DeleteToolByPos(2);
@@ -1313,7 +1313,7 @@ void wxPropertyGridManager::RecalculatePositions( int width, int height )
m_pToolbar->SetSize(0, 0, width, -1); m_pToolbar->SetSize(0, 0, width, -1);
propgridY += m_pToolbar->GetSize().y; propgridY += m_pToolbar->GetSize().y;
if (GetExtraStyle() & wxPG_EX_TOOLBAR_SEPARATOR) if ( HasExtraStyle(wxPG_EX_TOOLBAR_SEPARATOR) )
propgridY += 1; propgridY += 1;
} }
#endif #endif
@@ -1404,7 +1404,7 @@ void wxPropertyGridManager::OnPaint( wxPaintEvent& WXUNUSED(event) )
// Update everything inside the box // Update everything inside the box
wxRect r = GetUpdateRegion().GetBox(); wxRect r = GetUpdateRegion().GetBox();
if (GetExtraStyle() & wxPG_EX_TOOLBAR_SEPARATOR) if ( HasExtraStyle(wxPG_EX_TOOLBAR_SEPARATOR) )
{ {
if (m_pToolbar && m_pPropGrid) if (m_pToolbar && m_pPropGrid)
{ {
@@ -1459,8 +1459,8 @@ void wxPropertyGridManager::RecreateControls()
// Has toolbar. // Has toolbar.
if ( !m_pToolbar ) if ( !m_pToolbar )
{ {
long toolBarFlags = ((GetExtraStyle()&wxPG_EX_NO_FLAT_TOOLBAR)?0:wxTB_FLAT); long toolBarFlags = HasExtraStyle(wxPG_EX_NO_FLAT_TOOLBAR)? 0: wxTB_FLAT;
if (GetExtraStyle() & wxPG_EX_NO_TOOLBAR_DIVIDER) if ( HasExtraStyle(wxPG_EX_NO_TOOLBAR_DIVIDER) )
toolBarFlags |= wxTB_NODIVIDER; toolBarFlags |= wxTB_NODIVIDER;
m_pToolbar = new wxToolBar(this, wxID_ANY, m_pToolbar = new wxToolBar(this, wxID_ANY,
@@ -1492,7 +1492,7 @@ void wxPropertyGridManager::RecreateControls()
m_alphabeticModeToolId = -1; m_alphabeticModeToolId = -1;
} }
if ( (GetExtraStyle()&wxPG_EX_MODE_BUTTONS) ) if ( HasExtraStyle(wxPG_EX_MODE_BUTTONS) )
{ {
// Add buttons if they don't already exist. // Add buttons if they don't already exist.
if (m_categorizedModeToolId == -1) if (m_categorizedModeToolId == -1)
@@ -1573,7 +1573,7 @@ void wxPropertyGridManager::RecreateControls()
m_pToolbar->Realize(); m_pToolbar->Realize();
} }
if ( (GetExtraStyle() & wxPG_EX_MODE_BUTTONS) ) if ( HasExtraStyle(wxPG_EX_MODE_BUTTONS) )
{ {
// Toggle correct mode button. // Toggle correct mode button.
// TODO: This doesn't work in wxMSW (when changing, // TODO: This doesn't work in wxMSW (when changing,

View File

@@ -637,7 +637,7 @@ void wxPGProperty::InitAfterAdded( wxPropertyGridPageState* pageState,
child->InitAfterAdded(pageState, pageState->GetGrid()); child->InitAfterAdded(pageState, pageState->GetGrid());
} }
if ( propgrid && (propgrid->GetExtraStyle() & wxPG_EX_AUTO_UNSPECIFIED_VALUES) ) if ( propgrid && propgrid->HasExtraStyle(wxPG_EX_AUTO_UNSPECIFIED_VALUES) )
SetFlagRecursively(wxPG_PROP_AUTO_UNSPECIFIED, true); SetFlagRecursively(wxPG_PROP_AUTO_UNSPECIFIED, true);
} }
} }

View File

@@ -547,7 +547,7 @@ wxPropertyGrid::~wxPropertyGrid()
ReleaseMouse(); ReleaseMouse();
// Call with NULL to disconnect event handling // Call with NULL to disconnect event handling
if ( GetExtraStyle() & wxPG_EX_ENABLE_TLP_TRACKING ) if ( HasExtraStyle(wxPG_EX_ENABLE_TLP_TRACKING) )
{ {
OnTLPChanging(NULL); OnTLPChanging(NULL);
@@ -715,7 +715,7 @@ bool wxPropertyGrid::DoAddToSelection( wxPGProperty* prop, int selFlags )
{ {
wxCHECK( prop, false ); wxCHECK( prop, false );
if ( !(GetExtraStyle() & wxPG_EX_MULTIPLE_SELECTION) ) if ( !HasExtraStyle(wxPG_EX_MULTIPLE_SELECTION) )
return DoSelectProperty(prop, selFlags); return DoSelectProperty(prop, selFlags);
wxArrayPGProperty& selection = m_pState->m_selection; wxArrayPGProperty& selection = m_pState->m_selection;
@@ -824,7 +824,7 @@ bool wxPropertyGrid::AddToSelectionFromInputEvent( wxPGProperty* prop,
// Set to 2 if also add all items in between // Set to 2 if also add all items in between
int addToExistingSelection = 0; int addToExistingSelection = 0;
if ( GetExtraStyle() & wxPG_EX_MULTIPLE_SELECTION ) if ( HasExtraStyle(wxPG_EX_MULTIPLE_SELECTION) )
{ {
if ( mouseEvent ) if ( mouseEvent )
{ {
@@ -1858,7 +1858,7 @@ wxPGProperty* wxPropertyGrid::DoGetItemAtY( int y ) const
void wxPropertyGrid::OnPaint( wxPaintEvent& WXUNUSED(event) ) void wxPropertyGrid::OnPaint( wxPaintEvent& WXUNUSED(event) )
{ {
wxDC* dcPtr = NULL; wxDC* dcPtr = NULL;
if ( !(GetExtraStyle() & wxPG_EX_NATIVE_DOUBLE_BUFFERING) ) if ( !HasExtraStyle(wxPG_EX_NATIVE_DOUBLE_BUFFERING) )
{ {
if ( m_doubleBuffer ) if ( m_doubleBuffer )
{ {
@@ -4346,7 +4346,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
if ( p ) if ( p )
pHelpString = &p->GetHelpString(); pHelpString = &p->GetHelpString();
if ( !(GetExtraStyle() & wxPG_EX_HELP_AS_TOOLTIPS) ) if ( !HasExtraStyle(wxPG_EX_HELP_AS_TOOLTIPS) )
{ {
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
@@ -4650,7 +4650,7 @@ void wxPropertyGrid::OnResize( wxSizeEvent& event )
m_width = width; m_width = width;
m_height = height; m_height = height;
if ( !(GetExtraStyle() & wxPG_EX_NATIVE_DOUBLE_BUFFERING) ) if ( !HasExtraStyle(wxPG_EX_NATIVE_DOUBLE_BUFFERING) )
{ {
int dblh = (m_lineHeight*2); int dblh = (m_lineHeight*2);
if ( !m_doubleBuffer ) if ( !m_doubleBuffer )
@@ -5107,7 +5107,7 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y,
if ( m_propHover && !m_propHover->IsCategory() ) if ( m_propHover && !m_propHover->IsCategory() )
{ {
if ( GetExtraStyle() & wxPG_EX_HELP_AS_TOOLTIPS ) if ( HasExtraStyle(wxPG_EX_HELP_AS_TOOLTIPS) )
{ {
// Show help string as a tooltip // Show help string as a tooltip
wxString tipString = m_propHover->GetHelpString(); wxString tipString = m_propHover->GetHelpString();
@@ -5196,7 +5196,7 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y,
// //
// Multi select by dragging // Multi select by dragging
// //
if ( (GetExtraStyle() & wxPG_EX_MULTIPLE_SELECTION) && if ( HasExtraStyle(wxPG_EX_MULTIPLE_SELECTION) &&
event.LeftIsDown() && event.LeftIsDown() &&
m_propHover && m_propHover &&
GetSelection() && GetSelection() &&
@@ -5891,7 +5891,7 @@ void wxPropertyGrid::OnIdle( wxIdleEvent& WXUNUSED(event) )
// //
// Check if top-level parent has changed // Check if top-level parent has changed
if ( GetExtraStyle() & wxPG_EX_ENABLE_TLP_TRACKING ) if ( HasExtraStyle(wxPG_EX_ENABLE_TLP_TRACKING) )
{ {
wxWindow* tlp = ::wxGetTopLevelParent(this); wxWindow* tlp = ::wxGetTopLevelParent(this);
if ( tlp != m_tlp ) if ( tlp != m_tlp )