Fixed various NULL reference issues. Also cleaned up wxPGComboBox code overall a bit.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56782 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
extern WXDLLIMPEXP_DATA_PROPGRID(const char) wxPropertyGridNameStr[];
|
extern WXDLLIMPEXP_DATA_PROPGRID(const char) wxPropertyGridNameStr[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
class wxPGComboBox;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// Global variables
|
// Global variables
|
||||||
@@ -1219,8 +1220,11 @@ public:
|
|||||||
void IncFrozen() { m_frozen++; }
|
void IncFrozen() { m_frozen++; }
|
||||||
void DecFrozen() { m_frozen--; }
|
void DecFrozen() { m_frozen--; }
|
||||||
|
|
||||||
void OnComboItemPaint( wxPGCustomComboControl* pCb,int item,wxDC& dc,
|
void OnComboItemPaint( const wxPGComboBox* pCb,
|
||||||
wxRect& rect,int flags );
|
int item,
|
||||||
|
wxDC* pDc,
|
||||||
|
wxRect& rect,
|
||||||
|
int flags );
|
||||||
|
|
||||||
/** Standardized double-to-string conversion.
|
/** Standardized double-to-string conversion.
|
||||||
*/
|
*/
|
||||||
|
@@ -266,7 +266,6 @@ class wxPropertyGrid;
|
|||||||
class wxPropertyGridEvent;
|
class wxPropertyGridEvent;
|
||||||
class wxPropertyGridManager;
|
class wxPropertyGridManager;
|
||||||
class wxPGOwnerDrawnComboBox;
|
class wxPGOwnerDrawnComboBox;
|
||||||
class wxPGCustomComboControl;
|
|
||||||
class wxPGEditorDialogAdapter;
|
class wxPGEditorDialogAdapter;
|
||||||
class wxPGValidationInfo;
|
class wxPGValidationInfo;
|
||||||
|
|
||||||
|
@@ -363,7 +363,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
const wxPGAttributeStorage& GetPropertyAttributes( wxPGPropArg id ) const
|
const wxPGAttributeStorage& GetPropertyAttributes( wxPGPropArg id ) const
|
||||||
{
|
{
|
||||||
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(*((const wxPGAttributeStorage*)NULL));
|
// If 'id' refers to invalid property, then we will return dummy
|
||||||
|
// attributes (ie. root property's attributes, which contents should
|
||||||
|
// should always be empty and of no consequence).
|
||||||
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(m_pState->DoGetRoot()->GetAttributes());
|
||||||
return p->GetAttributes();
|
return p->GetAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -528,31 +528,37 @@ public:
|
|||||||
name ) )
|
name ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_dclickProcessor = new wxPGDoubleClickProcessor(this, GetGrid()->GetSelection() );
|
m_dclickProcessor = new
|
||||||
|
wxPGDoubleClickProcessor( this, GetGrid()->GetSelection() );
|
||||||
|
|
||||||
PushEventHandler(m_dclickProcessor);
|
PushEventHandler(m_dclickProcessor);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const
|
virtual void OnDrawItem( wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int item,
|
||||||
|
int flags ) const
|
||||||
{
|
{
|
||||||
wxPropertyGrid* pg = GetGrid();
|
wxPropertyGrid* pg = GetGrid();
|
||||||
pg->OnComboItemPaint((wxPGCustomComboControl*)this,item,dc,(wxRect&)rect,flags);
|
pg->OnComboItemPaint( this, item, &dc, (wxRect&)rect, flags );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual wxCoord OnMeasureItem( size_t item ) const
|
virtual wxCoord OnMeasureItem( size_t item ) const
|
||||||
{
|
{
|
||||||
wxPropertyGrid* pg = GetGrid();
|
wxPropertyGrid* pg = GetGrid();
|
||||||
wxRect rect;
|
wxRect rect;
|
||||||
rect.x = -1;
|
rect.x = -1;
|
||||||
rect.width = 0;
|
rect.width = 0;
|
||||||
pg->OnComboItemPaint((wxPGCustomComboControl*)this,item,*((wxDC*)NULL),rect,0);
|
pg->OnComboItemPaint( this, item, NULL, rect, 0 );
|
||||||
return rect.height;
|
return rect.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPropertyGrid* GetGrid() const
|
wxPropertyGrid* GetGrid() const
|
||||||
{
|
{
|
||||||
wxPropertyGrid* pg = wxDynamicCast(GetParent()->GetParent(),wxPropertyGrid);
|
wxPropertyGrid* pg = wxDynamicCast(GetParent()->GetParent(),
|
||||||
|
wxPropertyGrid);
|
||||||
wxASSERT(pg);
|
wxASSERT(pg);
|
||||||
return pg;
|
return pg;
|
||||||
}
|
}
|
||||||
@@ -563,15 +569,17 @@ public:
|
|||||||
wxRect rect;
|
wxRect rect;
|
||||||
rect.x = -1;
|
rect.x = -1;
|
||||||
rect.width = -1;
|
rect.width = -1;
|
||||||
pg->OnComboItemPaint((wxPGCustomComboControl*)this,item,*((wxDC*)NULL),rect,0);
|
pg->OnComboItemPaint( this, item, NULL, rect, 0 );
|
||||||
return rect.width;
|
return rect.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void PositionTextCtrl( int WXUNUSED(textCtrlXAdjust), int WXUNUSED(textCtrlYAdjust) )
|
virtual void PositionTextCtrl( int WXUNUSED(textCtrlXAdjust),
|
||||||
|
int WXUNUSED(textCtrlYAdjust) )
|
||||||
{
|
{
|
||||||
wxPropertyGrid* pg = GetGrid();
|
wxPropertyGrid* pg = GetGrid();
|
||||||
wxOwnerDrawnComboBox::PositionTextCtrl(
|
wxOwnerDrawnComboBox::PositionTextCtrl(
|
||||||
wxPG_TEXTCTRLXADJUST - (wxPG_XBEFOREWIDGET+wxPG_CONTROL_MARGIN+1) - 1,
|
wxPG_TEXTCTRLXADJUST -
|
||||||
|
(wxPG_XBEFOREWIDGET+wxPG_CONTROL_MARGIN+1) - 1,
|
||||||
pg->GetSpacingY() + 2
|
pg->GetSpacingY() + 2
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -582,14 +590,12 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void wxPropertyGrid::OnComboItemPaint( wxPGCustomComboControl* pCc,
|
void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb,
|
||||||
int item,
|
int item,
|
||||||
wxDC& dc,
|
wxDC* pDc,
|
||||||
wxRect& rect,
|
wxRect& rect,
|
||||||
int flags )
|
int flags )
|
||||||
{
|
{
|
||||||
wxPGComboBox* pCb = (wxPGComboBox*)pCc;
|
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
wxASSERT( IsKindOf(CLASSINFO(wxPropertyGrid)) );
|
wxASSERT( IsKindOf(CLASSINFO(wxPropertyGrid)) );
|
||||||
|
|
||||||
@@ -669,13 +675,14 @@ void wxPropertyGrid::OnComboItemPaint( wxPGCustomComboControl* pCc,
|
|||||||
if ( (flags & wxODCB_PAINTING_CONTROL) )
|
if ( (flags & wxODCB_PAINTING_CONTROL) )
|
||||||
paintdata.m_choiceItem = -1;
|
paintdata.m_choiceItem = -1;
|
||||||
|
|
||||||
if ( &dc )
|
if ( pDc )
|
||||||
dc.SetBrush(*wxWHITE_BRUSH);
|
pDc->SetBrush(*wxWHITE_BRUSH);
|
||||||
|
|
||||||
if ( rect.x >= 0 )
|
if ( rect.x >= 0 )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// DrawItem call
|
// DrawItem call
|
||||||
|
wxDC& dc = *pDc;
|
||||||
|
|
||||||
wxPoint pt(rect.x + wxPG_CONTROL_MARGIN - wxPG_CHOICEXADJUST - 1,
|
wxPoint pt(rect.x + wxPG_CONTROL_MARGIN - wxPG_CHOICEXADJUST - 1,
|
||||||
rect.y + 1);
|
rect.y + 1);
|
||||||
@@ -760,6 +767,7 @@ void wxPropertyGrid::OnComboItemPaint( wxPGCustomComboControl* pCc,
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
// MeasureItem call
|
// MeasureItem call
|
||||||
|
wxDC& dc = *pDc;
|
||||||
|
|
||||||
p->OnCustomPaint( dc, rect, paintdata );
|
p->OnCustomPaint( dc, rect, paintdata );
|
||||||
rect.height = paintdata.m_drawnHeight + 2;
|
rect.height = paintdata.m_drawnHeight + 2;
|
||||||
|
Reference in New Issue
Block a user