Use const_cast to change the constness
This commit is contained in:
parent
2ebdfb7a40
commit
b064608c2a
@ -460,7 +460,7 @@ public:
|
||||
|
||||
wxWindow* GetButton( unsigned int i ) { return m_buttons[i]; }
|
||||
const wxWindow* GetButton( unsigned int i ) const
|
||||
{ return (const wxWindow*) m_buttons[i]; }
|
||||
{ return const_cast<const wxWindow*>(m_buttons[i]); }
|
||||
|
||||
// Utility function to be used in event handlers.
|
||||
int GetButtonId( unsigned int i ) const { return GetButton(i)->GetId(); }
|
||||
|
@ -270,7 +270,7 @@ public:
|
||||
const wxPropertyGrid* GetGrid() const
|
||||
{
|
||||
wxASSERT(m_pPropGrid);
|
||||
return (const wxPropertyGrid*)m_pPropGrid;
|
||||
return const_cast<const wxPropertyGrid*>(m_pPropGrid);
|
||||
}
|
||||
|
||||
// Returns iterator class instance.
|
||||
|
@ -1162,7 +1162,7 @@ public:
|
||||
|
||||
const wxPGCommonValue* GetCommonValue( unsigned int i ) const
|
||||
{
|
||||
return (wxPGCommonValue*) m_commonValues[i];
|
||||
return const_cast<const wxPGCommonValue*>(m_commonValues[i]);
|
||||
}
|
||||
|
||||
// Returns number of common values.
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
wxPGProperty* GetPtr( wxPropertyGridInterface* iface ) const;
|
||||
wxPGProperty* GetPtr( const wxPropertyGridInterface* iface ) const
|
||||
{
|
||||
return GetPtr((wxPropertyGridInterface*)iface);
|
||||
return GetPtr(const_cast<wxPropertyGridInterface*>(iface));
|
||||
}
|
||||
wxPGProperty* GetPtr0() const { return m_ptr.property; }
|
||||
bool HasName() const { return (m_flags != IsProperty); }
|
||||
@ -305,7 +305,7 @@ public:
|
||||
|
||||
const wxPGProperty* GetFirst( int flags = wxPG_ITERATE_ALL ) const
|
||||
{
|
||||
return ((wxPropertyGridInterface*)this)->GetFirst(flags);
|
||||
return const_cast<const wxPGProperty*>(GetFirst(flags));
|
||||
}
|
||||
|
||||
// Returns pointer to a property with given name (case-sensitive).
|
||||
|
@ -217,12 +217,12 @@ public:
|
||||
PROPERTY* property = NULL, int dir = 1)
|
||||
: wxPropertyGridIteratorBase()
|
||||
{
|
||||
Init((wxPropertyGridPageState*)state, flags, (wxPGProperty*)property, dir);
|
||||
Init(const_cast<wxPropertyGridPageState*>(state), flags, const_cast<wxPGProperty*>(property), dir);
|
||||
}
|
||||
wxPGIterator(STATE* state, int flags, int startPos, int dir = 0)
|
||||
: wxPropertyGridIteratorBase()
|
||||
{
|
||||
Init((wxPropertyGridPageState*)state, flags, startPos, dir);
|
||||
Init(const_cast<wxPropertyGridPageState*>(state), flags, startPos, dir);
|
||||
}
|
||||
wxPGIterator()
|
||||
: wxPropertyGridIteratorBase()
|
||||
@ -248,7 +248,7 @@ public:
|
||||
wxPGIterator operator++(int) { wxPGIterator it = *this; Next(); return it; }
|
||||
wxPGIterator& operator--() { Prev(); return *this; }
|
||||
wxPGIterator operator--(int) { wxPGIterator it = *this; Prev(); return it; }
|
||||
PROPERTY* operator *() const { return (PROPERTY*)m_property; }
|
||||
PROPERTY* operator *() const { return const_cast<PROPERTY*>(m_property); }
|
||||
static PROPERTY* OneStep(STATE* state, int flags = wxPG_ITERATE_DEFAULT,
|
||||
PROPERTY* property = NULL, int dir = 1)
|
||||
{
|
||||
@ -412,7 +412,7 @@ public:
|
||||
|
||||
const wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT ) const
|
||||
{
|
||||
return ((wxPropertyGridPageState*)this)->GetLastItem(flags);
|
||||
return const_cast<const wxPGProperty*>(GetLastItem(flags));
|
||||
}
|
||||
|
||||
// Returns currently selected property.
|
||||
|
@ -771,7 +771,7 @@ bool PROPNAME::OnEvent( wxPropertyGrid* propgrid, \
|
||||
wxWindow* primary, wxEvent& event ) \
|
||||
{ \
|
||||
if ( event.GetEventType() == wxEVT_BUTTON ) \
|
||||
return OnButtonClick(propgrid,primary,(const wxChar*) CUSTBUTTXT); \
|
||||
return OnButtonClick(propgrid,primary, const_cast<const wxChar*>(CUSTBUTTXT)); \
|
||||
return false; \
|
||||
}
|
||||
|
||||
|
@ -1448,7 +1448,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
|
||||
// GetPropertyByNameWH(). This optimizes for full list parsing.
|
||||
for ( node = list.begin(); node != list.end(); ++node )
|
||||
{
|
||||
wxVariant& childValue = *((wxVariant*)*node);
|
||||
wxVariant& childValue = *const_cast<wxVariant*>(*node);
|
||||
wxPGProperty* child = GetPropertyByNameWH(childValue.GetName(), i);
|
||||
if ( child )
|
||||
{
|
||||
@ -2248,8 +2248,8 @@ void wxPGProperty::SetValueImage( wxBitmap& bmp )
|
||||
|
||||
wxPGProperty* wxPGProperty::GetMainParent() const
|
||||
{
|
||||
const wxPGProperty* curChild = this;
|
||||
const wxPGProperty* curParent = m_parent;
|
||||
wxPGProperty* curChild = const_cast<wxPGProperty*>(this);
|
||||
wxPGProperty* curParent = m_parent;
|
||||
|
||||
while ( !curParent->IsRoot() && !curParent->IsCategory() )
|
||||
{
|
||||
@ -2257,7 +2257,7 @@ wxPGProperty* wxPGProperty::GetMainParent() const
|
||||
curParent = curParent->m_parent;
|
||||
}
|
||||
|
||||
return (wxPGProperty*) curChild;
|
||||
return curChild;
|
||||
}
|
||||
|
||||
|
||||
@ -2729,7 +2729,7 @@ bool wxPGProperty::AreAllChildrenSpecified( wxVariant* pendingList ) const
|
||||
|
||||
for ( ; node != pList->end(); ++node )
|
||||
{
|
||||
const wxVariant& item = *((const wxVariant*)*node);
|
||||
const wxVariant& item = *const_cast<const wxVariant*>(*node);
|
||||
if ( item.GetName() == childName )
|
||||
{
|
||||
listValue = &item;
|
||||
@ -2753,7 +2753,7 @@ bool wxPGProperty::AreAllChildrenSpecified( wxVariant* pendingList ) const
|
||||
if ( listValue && listValue->IsType(wxPG_VARIANT_TYPE_LIST) )
|
||||
childList = listValue;
|
||||
|
||||
if ( !child->AreAllChildrenSpecified((wxVariant*)childList) )
|
||||
if ( !child->AreAllChildrenSpecified(const_cast<wxVariant*>(childList)) )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2128,7 +2128,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
|
||||
|
||||
if ( !p->HasFlag(wxPG_PROP_HIDDEN) )
|
||||
{
|
||||
visPropArray.push_back((wxPGProperty*)p);
|
||||
visPropArray.push_back(const_cast<wxPGProperty*>(p));
|
||||
|
||||
if ( y > endScanBottomY )
|
||||
break;
|
||||
|
@ -1442,7 +1442,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx
|
||||
// Second pass for special entries
|
||||
for ( node = list.begin(); node != list.end(); ++node )
|
||||
{
|
||||
wxVariant *current = (wxVariant*)*node;
|
||||
wxVariant *current = const_cast<wxVariant*>(*node);
|
||||
|
||||
// Make sure it is wxVariant.
|
||||
wxASSERT( current );
|
||||
@ -1505,7 +1505,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx
|
||||
{
|
||||
for ( node = list.begin(); node != list.end(); ++node )
|
||||
{
|
||||
wxVariant *current = (wxVariant*)*node;
|
||||
wxVariant *current = const_cast<wxVariant*>(*node);
|
||||
|
||||
const wxString& name = current->GetName();
|
||||
if ( !name.empty() )
|
||||
@ -1536,7 +1536,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx
|
||||
|
||||
for ( node2 = list2.begin(); node2 != list2.end(); ++node2 )
|
||||
{
|
||||
wxVariant *attr = (wxVariant*)*node2;
|
||||
wxVariant *attr = const_cast<wxVariant*>(*node2);
|
||||
foundProp->SetAttribute( attr->GetName(), *attr );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user