Use getter functions to get access to some properties of wxPropertyGridPageState, cont.
Use existing DoGetRoot(), GetRoot(), GetVirtualWidth() functions instead of getting direct access to the corresponding member variables.
This commit is contained in:
@@ -1126,7 +1126,7 @@ wxPGProperty* wxPropertyGridManager::GetPageRoot( int index ) const
|
|||||||
NULL,
|
NULL,
|
||||||
wxT("invalid page index") );
|
wxT("invalid page index") );
|
||||||
|
|
||||||
return m_arrPages[index]->GetStatePtr()->m_properties;
|
return m_arrPages[index]->GetRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
@@ -1868,7 +1868,7 @@ void wxPropertyGridManager::SetSplitterLeft( bool subProps, bool allPages )
|
|||||||
|
|
||||||
for ( i=0; i<GetPageCount(); i++ )
|
for ( i=0; i<GetPageCount(); i++ )
|
||||||
{
|
{
|
||||||
int maxW = m_pState->GetColumnFitWidth(dc, m_arrPages[i]->m_properties, 0, subProps );
|
int maxW = m_pState->GetColumnFitWidth(dc, m_arrPages[i]->DoGetRoot(), 0, subProps );
|
||||||
maxW += m_pPropGrid->GetMarginWidth();
|
maxW += m_pPropGrid->GetMarginWidth();
|
||||||
if ( maxW > highest )
|
if ( maxW > highest )
|
||||||
highest = maxW;
|
highest = maxW;
|
||||||
@@ -1895,7 +1895,7 @@ void wxPropertyGridManager::SetPageSplitterLeft(int page, bool subProps)
|
|||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
dc.SetFont(m_pPropGrid->GetFont());
|
dc.SetFont(m_pPropGrid->GetFont());
|
||||||
|
|
||||||
int maxW = m_pState->GetColumnFitWidth(dc, m_arrPages[page]->m_properties, 0, subProps );
|
int maxW = m_pState->GetColumnFitWidth(dc, m_arrPages[page]->DoGetRoot(), 0, subProps );
|
||||||
maxW += m_pPropGrid->GetMarginWidth();
|
maxW += m_pPropGrid->GetMarginWidth();
|
||||||
SetPageSplitterPosition( page, maxW );
|
SetPageSplitterPosition( page, maxW );
|
||||||
|
|
||||||
@@ -1978,7 +1978,7 @@ void wxPropertyGridManager::OnResize( wxSizeEvent& WXUNUSED(event) )
|
|||||||
if ( page != m_pPropGrid->GetState() )
|
if ( page != m_pPropGrid->GetState() )
|
||||||
{
|
{
|
||||||
page->OnClientWidthChange(pgWidth,
|
page->OnClientWidthChange(pgWidth,
|
||||||
pgWidth - page->m_width,
|
pgWidth - page->GetVirtualWidth(),
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1202,7 +1202,7 @@ wxSize wxPropertyGrid::DoGetBestSize() const
|
|||||||
// make it too small neither
|
// make it too small neither
|
||||||
int numLines = wxMin
|
int numLines = wxMin
|
||||||
(
|
(
|
||||||
wxMax(m_pState->m_properties->GetChildCount(), 3),
|
wxMax(m_pState->DoGetRoot()->GetChildCount(), 3),
|
||||||
10
|
10
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1647,7 +1647,7 @@ bool wxPropertyGrid::EnsureVisible( wxPGPropArg id )
|
|||||||
wxPGProperty* parent = p->GetParent();
|
wxPGProperty* parent = p->GetParent();
|
||||||
wxPGProperty* grandparent = parent->GetParent();
|
wxPGProperty* grandparent = parent->GetParent();
|
||||||
|
|
||||||
if ( grandparent && grandparent != m_pState->m_properties )
|
if ( grandparent && grandparent != m_pState->DoGetRoot() )
|
||||||
Expand( grandparent );
|
Expand( grandparent );
|
||||||
|
|
||||||
Expand( parent );
|
Expand( parent );
|
||||||
@@ -1850,7 +1850,7 @@ wxPGProperty* wxPropertyGrid::DoGetItemAtY( int y ) const
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
unsigned int a = 0;
|
unsigned int a = 0;
|
||||||
return m_pState->m_properties->GetItemAtY(y, m_lineHeight, &a);
|
return m_pState->DoGetRoot()->GetItemAtY(y, m_lineHeight, &a);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
@@ -2010,7 +2010,7 @@ void wxPropertyGrid::DrawItems( wxDC& dc,
|
|||||||
if ( !itemsRect )
|
if ( !itemsRect )
|
||||||
{
|
{
|
||||||
tempItemsRect = wxRect(0, topItemY,
|
tempItemsRect = wxRect(0, topItemY,
|
||||||
m_pState->m_width,
|
m_pState->GetVirtualWidth(),
|
||||||
bottomItemY);
|
bottomItemY);
|
||||||
itemsRect = &tempItemsRect;
|
itemsRect = &tempItemsRect;
|
||||||
}
|
}
|
||||||
@@ -2023,7 +2023,7 @@ void wxPropertyGrid::DrawItems( wxDC& dc,
|
|||||||
// items added check
|
// items added check
|
||||||
if ( m_pState->m_itemsAdded ) PrepareAfterItemsAdded();
|
if ( m_pState->m_itemsAdded ) PrepareAfterItemsAdded();
|
||||||
|
|
||||||
if ( m_pState->m_properties->GetChildCount() > 0 )
|
if ( m_pState->DoGetRoot()->GetChildCount() > 0 )
|
||||||
{
|
{
|
||||||
// paintFinishY and drawBottomY are in buffer/physical space
|
// paintFinishY and drawBottomY are in buffer/physical space
|
||||||
int paintFinishY = DoDrawItems(dc, itemsRect);
|
int paintFinishY = DoDrawItems(dc, itemsRect);
|
||||||
@@ -2078,7 +2078,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
|
|||||||
|
|
||||||
wxCHECK_MSG( !m_pState->m_itemsAdded, itemsRect->y,
|
wxCHECK_MSG( !m_pState->m_itemsAdded, itemsRect->y,
|
||||||
"no items added" );
|
"no items added" );
|
||||||
wxASSERT( m_pState->m_properties->GetChildCount() );
|
wxASSERT( m_pState->DoGetRoot()->GetChildCount() );
|
||||||
|
|
||||||
int lh = m_lineHeight;
|
int lh = m_lineHeight;
|
||||||
|
|
||||||
@@ -2208,7 +2208,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
|
|||||||
|
|
||||||
wxPGProperty* nextP = visPropArray[0];
|
wxPGProperty* nextP = visPropArray[0];
|
||||||
|
|
||||||
int gridWidth = state->m_width;
|
int gridWidth = state->GetVirtualWidth();
|
||||||
|
|
||||||
y = firstItemTopY;
|
y = firstItemTopY;
|
||||||
for ( unsigned int arrInd=1;
|
for ( unsigned int arrInd=1;
|
||||||
@@ -2229,7 +2229,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
|
|||||||
int greyDepthX = greyDepth - xRelMod;
|
int greyDepthX = greyDepth - xRelMod;
|
||||||
|
|
||||||
// Use basic depth if in non-categoric mode and parent is base array.
|
// Use basic depth if in non-categoric mode and parent is base array.
|
||||||
if ( !(windowStyle & wxPG_HIDE_CATEGORIES) || p->GetParent() != m_pState->m_properties )
|
if ( !(windowStyle & wxPG_HIDE_CATEGORIES) || p->GetParent() != m_pState->DoGetRoot() )
|
||||||
{
|
{
|
||||||
textMarginHere += ((p->GetDepth()-1)*m_subgroup_extramargin);
|
textMarginHere += ((p->GetDepth()-1)*m_subgroup_extramargin);
|
||||||
}
|
}
|
||||||
@@ -2549,7 +2549,7 @@ wxRect wxPropertyGrid::GetPropertyRect( const wxPGProperty* p1, const wxPGProper
|
|||||||
wxRect r;
|
wxRect r;
|
||||||
|
|
||||||
if ( m_width < 10 || m_height < 10 ||
|
if ( m_width < 10 || m_height < 10 ||
|
||||||
!m_pState->m_properties->GetChildCount() ||
|
!m_pState->DoGetRoot()->GetChildCount() ||
|
||||||
p1 == NULL )
|
p1 == NULL )
|
||||||
return wxRect(0,0,0,0);
|
return wxRect(0,0,0,0);
|
||||||
|
|
||||||
@@ -2585,7 +2585,7 @@ wxRect wxPropertyGrid::GetPropertyRect( const wxPGProperty* p1, const wxPGProper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxRect(0,visTop-vy,m_pState->m_width,visBottom-visTop);
|
return wxRect(0,visTop-vy,m_pState->GetVirtualWidth(),visBottom-visTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
@@ -2776,7 +2776,7 @@ void wxPropertyGrid::SwitchState( wxPropertyGridPageState* pNewState )
|
|||||||
if ( HasVirtualWidth() )
|
if ( HasVirtualWidth() )
|
||||||
{
|
{
|
||||||
int minWidth = pgWidth;
|
int minWidth = pgWidth;
|
||||||
if ( pNewState->m_width < minWidth )
|
if ( pNewState->GetVirtualWidth() < minWidth )
|
||||||
{
|
{
|
||||||
pNewState->m_width = minWidth;
|
pNewState->m_width = minWidth;
|
||||||
pNewState->CheckColumnWidths();
|
pNewState->CheckColumnWidths();
|
||||||
@@ -2790,7 +2790,7 @@ void wxPropertyGrid::SwitchState( wxPropertyGridPageState* pNewState )
|
|||||||
// pNewState->m_fSplitterX = -1.0;
|
// pNewState->m_fSplitterX = -1.0;
|
||||||
|
|
||||||
pNewState->OnClientWidthChange(pgWidth,
|
pNewState->OnClientWidthChange(pgWidth,
|
||||||
pgWidth - pNewState->m_width);
|
pgWidth - pNewState->GetVirtualWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_propHover = NULL;
|
m_propHover = NULL;
|
||||||
@@ -4581,7 +4581,7 @@ void wxPropertyGrid::RecalculateVirtualSize( int forceXPos )
|
|||||||
|
|
||||||
m_iFlags |= wxPG_FL_RECALCULATING_VIRTUAL_SIZE;
|
m_iFlags |= wxPG_FL_RECALCULATING_VIRTUAL_SIZE;
|
||||||
|
|
||||||
int x = m_pState->m_width;
|
int x = m_pState->GetVirtualWidth();
|
||||||
int y = m_pState->m_virtualHeight;
|
int y = m_pState->m_virtualHeight;
|
||||||
|
|
||||||
int width, height;
|
int width, height;
|
||||||
@@ -5034,7 +5034,7 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y,
|
|||||||
if ( m_dragStatus > 0 )
|
if ( m_dragStatus > 0 )
|
||||||
{
|
{
|
||||||
if ( x > (m_marginWidth + wxPG_DRAG_MARGIN) &&
|
if ( x > (m_marginWidth + wxPG_DRAG_MARGIN) &&
|
||||||
x < (m_pState->m_width - wxPG_DRAG_MARGIN) )
|
x < (m_pState->GetVirtualWidth() - wxPG_DRAG_MARGIN) )
|
||||||
{
|
{
|
||||||
|
|
||||||
int newSplitterX = x - m_dragOffset;
|
int newSplitterX = x - m_dragOffset;
|
||||||
|
Reference in New Issue
Block a user