In wxPropertyGridPageState use Boolean member variables to store Boolean values.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77888 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Artur Wieczorek
2014-09-25 17:29:50 +00:00
parent 329b59e263
commit 89364e95b9
4 changed files with 41 additions and 20 deletions

View File

@@ -1062,7 +1062,12 @@ public:
wxPropertyGridHitTestResult HitTest( const wxPoint& pt ) const;
/** Returns true if any property has been modified by the user. */
bool IsAnyModified() const { return (m_pState->m_anyModified>0); }
bool IsAnyModified() const
#ifdef WXWIN_COMPATIBILITY_3_0
{ return m_pState->m_anyModified != (unsigned char)false; }
#else
{ return m_pState->m_anyModified; }
#endif
/**
It is recommended that you call this function any time your code causes

View File

@@ -470,7 +470,7 @@ public:
if ( m_vhCalcPending )
{
RecalculateVirtualHeight();
m_vhCalcPending = 0;
m_vhCalcPending = false;
}
}
@@ -653,7 +653,7 @@ public:
*/
void VirtualHeightChanged()
{
m_vhCalcPending = 1;
m_vhCalcPending = true;
}
/** Base append. */
@@ -737,6 +737,7 @@ protected:
/** Indicates total virtual height of visible properties. */
unsigned int m_virtualHeight;
#ifdef WXWIN_COMPATIBILITY_3_0
/** 1 if m_lastCaption is also the bottommost caption. */
unsigned char m_lastCaptionBottomnest;
@@ -750,6 +751,21 @@ protected:
unsigned char m_anyModified;
unsigned char m_vhCalcPending;
#else
/** True if m_lastCaption is also the bottommost caption. */
bool m_lastCaptionBottomnest;
/** True: items appended/inserted, so stuff needs to be done before drawing;
If m_virtualHeight == 0, then calcylatey's must be done.
Otherwise just sort.
*/
bool m_itemsAdded;
/** True if any value is modified. */
bool m_anyModified;
bool m_vhCalcPending;
#endif // WXWIN_COMPATIBILITY_3_0
/** True if splitter has been pre-set by the application. */
bool m_isSplitterPreSet;

View File

@@ -608,7 +608,7 @@ void wxPropertyGrid::SetWindowStyleFlag( long style )
if ( !IsFrozen() )
PrepareAfterItemsAdded();
else
m_pState->m_itemsAdded = 1;
m_pState->m_itemsAdded = true;
}
#if wxPG_SUPPORT_TOOLTIPS
if ( !(old_style & wxPG_TOOLTIPS) && (style & wxPG_TOOLTIPS) )
@@ -1547,7 +1547,7 @@ void wxPropertyGrid::PrepareAfterItemsAdded()
{
if ( !m_pState || !m_pState->m_itemsAdded ) return;
m_pState->m_itemsAdded = 0;
m_pState->m_itemsAdded = false;
if ( m_windowStyle & wxPG_AUTO_SORT )
Sort(wxPG_SORT_TOP_LEVEL_ONLY);
@@ -2683,12 +2683,12 @@ bool wxPropertyGrid::EnableCategories( bool enable )
{
if ( m_windowStyle & wxPG_AUTO_SORT )
{
m_pState->m_itemsAdded = 1; // force
m_pState->m_itemsAdded = true; // force
PrepareAfterItemsAdded();
}
}
else
m_pState->m_itemsAdded = 1;
m_pState->m_itemsAdded = true;
// No need for RecalculateVirtualSize() here - it is already called in
// wxPropertyGridPageState method above.
@@ -2764,7 +2764,7 @@ void wxPropertyGrid::SwitchState( wxPropertyGridPageState* pNewState )
Refresh();
}
else
m_pState->m_itemsAdded = 1;
m_pState->m_itemsAdded = true;
}
// -----------------------------------------------------------------------
@@ -3325,7 +3325,7 @@ bool wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags )
wxPGProperty* selected = GetSelection();
m_pState->m_anyModified = 1;
m_pState->m_anyModified = true;
// Maybe need to update control
wxASSERT( m_chgInfo_changedProperty != NULL );

View File

@@ -209,10 +209,10 @@ wxPropertyGridPageState::wxPropertyGridPageState()
m_currentCategory = NULL;
m_width = 0;
m_virtualHeight = 0;
m_lastCaptionBottomnest = 1;
m_itemsAdded = 0;
m_anyModified = 0;
m_vhCalcPending = 0;
m_lastCaptionBottomnest = true;
m_itemsAdded = false;
m_anyModified = false;
m_vhCalcPending = false;
m_colWidths.push_back( wxPG_DEFAULT_SPLITTERX );
m_colWidths.push_back( wxPG_DEFAULT_SPLITTERX );
m_fSplitterX = wxPG_DEFAULT_SPLITTERX;
@@ -311,11 +311,11 @@ void wxPropertyGridPageState::DoClear()
m_dictName.clear();
m_currentCategory = NULL;
m_lastCaptionBottomnest = 1;
m_itemsAdded = 0;
m_lastCaptionBottomnest = true;
m_itemsAdded = false;
m_virtualHeight = 0;
m_vhCalcPending = 0;
m_vhCalcPending = false;
}
}
@@ -746,7 +746,7 @@ bool wxPropertyGridPageState::PrepareAfterItemsAdded()
wxPropertyGrid* pg = GetGrid();
m_itemsAdded = 0;
m_itemsAdded = false;
if ( pg->HasFlag(wxPG_AUTO_SORT) )
DoSort(wxPG_SORT_TOP_LEVEL_ONLY);
@@ -1823,7 +1823,7 @@ wxPGProperty* wxPropertyGridPageState::DoInsert( wxPGProperty* parent, int index
// This is a category caption item.
// Last caption is not the bottom one (this info required by append)
m_lastCaptionBottomnest = 0;
m_lastCaptionBottomnest = false;
}
// Only add name to hashmap if parent is root or category
@@ -1835,7 +1835,7 @@ wxPGProperty* wxPropertyGridPageState::DoInsert( wxPGProperty* parent, int index
property->UpdateParentValues();
m_itemsAdded = 1;
m_itemsAdded = true;
return property;
}
@@ -2024,7 +2024,7 @@ void wxPropertyGridPageState::DoDelete( wxPGProperty* item, bool doDelete )
item->OnDetached(this, pg);
}
m_itemsAdded = 1; // Not a logical assignment (but required nonetheless).
m_itemsAdded = true; // Not a logical assignment (but required nonetheless).
VirtualHeightChanged();
}