Add wxTreeListCtrl::GetView() and GetDataView().
It can be useful to have access to the window used to actually show the items by wxTreeListCtrl, provide two accessors for m_view: a wxDataViewCtrl-specific one and a generic one returning just a wxWindow that can be used to keep the code isolated from wxDataViewCtrl. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69173 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b83d8f7339
commit
8148ae02ef
@ -322,6 +322,18 @@ public:
|
||||
wxCheckBoxState state) const;
|
||||
|
||||
|
||||
|
||||
// View window functions.
|
||||
// ----------------------
|
||||
|
||||
// This control itself is entirely covered by the "view window" which is
|
||||
// currently a wxDataViewCtrl but if you want to avoid relying on this to
|
||||
// allow your code to work with later versions which might not be
|
||||
// wxDataViewCtrl-based, use the first function only and only use the
|
||||
// second one if you really need to call wxDataViewCtrl methods on it.
|
||||
wxWindow* GetView() const;
|
||||
wxDataViewCtrl* GetDataView() const { return m_view; }
|
||||
|
||||
private:
|
||||
// Common part of all ctors.
|
||||
void Init();
|
||||
|
@ -664,6 +664,36 @@ public:
|
||||
wxCheckBoxState state) const;
|
||||
|
||||
//@}
|
||||
|
||||
/**
|
||||
View window.
|
||||
|
||||
This control itself is entirely covered by the "view window" which is
|
||||
currently a wxDataViewCtrl but if you want to avoid relying on this to
|
||||
allow your code to work with later versions which might not be
|
||||
wxDataViewCtrl-based, use GetView() function only and only use
|
||||
GetDataView() if you really need to call wxDataViewCtrl methods on it.
|
||||
*/
|
||||
//@{
|
||||
|
||||
/**
|
||||
Return the view part of this control as a wxWindow.
|
||||
|
||||
This method always returns non-@NULL pointer once the window was
|
||||
created.
|
||||
*/
|
||||
wxWindow* GetView() const;
|
||||
|
||||
/**
|
||||
Return the view part of this control as wxDataViewCtrl.
|
||||
|
||||
This method may return @NULL in the future, non wxDataViewCtrl-based,
|
||||
versions of this class, use GetView() unless you really need to use
|
||||
wxDataViewCtrl methods on the returned object.
|
||||
*/
|
||||
wxDataViewCtrl* GetDataView() const;
|
||||
|
||||
//@}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1548,6 +1548,15 @@ void wxTreeListCtrl::OnSize(wxSizeEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
wxWindow* wxTreeListCtrl::GetView() const
|
||||
{
|
||||
#ifdef wxHAS_GENERIC_DATAVIEWCTRL
|
||||
return m_view->GetMainWindow();
|
||||
#else
|
||||
return m_view;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// wxTreeListEvent implementation
|
||||
// ============================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user