added wxListCtrl::GetViewRect()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23574 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -40,6 +40,18 @@ versions, please update your code to not use them.
|
|||||||
OTHER CHANGES
|
OTHER CHANGES
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
2.5.1
|
||||||
|
-----
|
||||||
|
|
||||||
|
wxMSW:
|
||||||
|
|
||||||
|
- fixed wxTE_*WRAP styles handling
|
||||||
|
|
||||||
|
All (GUI):
|
||||||
|
|
||||||
|
- added wxListCtrl::GetViewRect()
|
||||||
|
|
||||||
|
|
||||||
2.5.0
|
2.5.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
@@ -463,6 +463,19 @@ Gets the text colour of the list control.
|
|||||||
Gets the index of the topmost visible item when in
|
Gets the index of the topmost visible item when in
|
||||||
list or report view.
|
list or report view.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxRect}{wxListCtrl::GetViewRect}\label{wxlistctrlgetviewrect}
|
||||||
|
|
||||||
|
\constfunc{wxRect}{GetViewRect}{\void}
|
||||||
|
|
||||||
|
Returns the rectangle taken by all items in the control. In other words, if the
|
||||||
|
controls client size were equal to the size of this rectangle, no scrollbars
|
||||||
|
would be needed and no free space would be left.
|
||||||
|
|
||||||
|
Note that this function only works in the icon and small icon views, not in
|
||||||
|
list or report views (this is a limitation of the native Win32 control).
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxListCtrl::HitTest}\label{wxlistctrlhittest}
|
\membersection{wxListCtrl::HitTest}\label{wxlistctrlhittest}
|
||||||
|
|
||||||
\func{long}{HitTest}{\param{const wxPoint\& }{point}, \param{int\& }{flags}}
|
\func{long}{HitTest}{\param{const wxPoint\& }{point}, \param{int\& }{flags}}
|
||||||
|
@@ -91,6 +91,7 @@ public:
|
|||||||
int GetColumnWidth( int col ) const;
|
int GetColumnWidth( int col ) const;
|
||||||
bool SetColumnWidth( int col, int width);
|
bool SetColumnWidth( int col, int width);
|
||||||
int GetCountPerPage() const; // not the same in wxGLC as in Windows, I think
|
int GetCountPerPage() const; // not the same in wxGLC as in Windows, I think
|
||||||
|
wxRect GetViewRect() const;
|
||||||
|
|
||||||
bool GetItem( wxListItem& info ) const;
|
bool GetItem( wxListItem& info ) const;
|
||||||
bool SetItem( wxListItem& info ) ;
|
bool SetItem( wxListItem& info ) ;
|
||||||
|
@@ -138,6 +138,9 @@ public:
|
|||||||
// or small icon view)
|
// or small icon view)
|
||||||
int GetCountPerPage() const;
|
int GetCountPerPage() const;
|
||||||
|
|
||||||
|
// return the total area occupied by all the items (icon/small icon only)
|
||||||
|
wxRect GetViewRect() const;
|
||||||
|
|
||||||
// Gets the edit control for editing labels.
|
// Gets the edit control for editing labels.
|
||||||
wxTextCtrl* GetEditControl() const;
|
wxTextCtrl* GetEditControl() const;
|
||||||
|
|
||||||
|
@@ -3773,6 +3773,41 @@ int wxListMainWindow::GetSelectedItemCount() const
|
|||||||
// item position/size
|
// item position/size
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxRect wxListMainWindow::GetViewRect() const
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( !HasFlag(wxLC_REPORT | wxLC_LIST),
|
||||||
|
_T("wxListCtrl::GetViewRect() only works in icon mode") );
|
||||||
|
|
||||||
|
// we need to find the longest/tallest label
|
||||||
|
wxCoord xMax = 0,
|
||||||
|
yMax = 0;
|
||||||
|
const int count = GetItemCount();
|
||||||
|
if ( count )
|
||||||
|
{
|
||||||
|
for ( int i = 0; i < count; i++ )
|
||||||
|
{
|
||||||
|
wxRect r;
|
||||||
|
GetItemRect(i, r);
|
||||||
|
|
||||||
|
wxCoord x = r.GetRight(),
|
||||||
|
y = r.GetBottom();
|
||||||
|
|
||||||
|
if ( x > xMax )
|
||||||
|
xMax = x;
|
||||||
|
if ( y > yMax )
|
||||||
|
yMax = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// account for the scrollbar
|
||||||
|
yMax += wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y);
|
||||||
|
xMax += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return wxRect(0, 0, xMax, yMax);
|
||||||
|
}
|
||||||
|
|
||||||
void wxListMainWindow::GetItemRect( long index, wxRect &rect ) const
|
void wxListMainWindow::GetItemRect( long index, wxRect &rect ) const
|
||||||
{
|
{
|
||||||
wxCHECK_RET( index >= 0 && (size_t)index < GetItemCount(),
|
wxCHECK_RET( index >= 0 && (size_t)index < GetItemCount(),
|
||||||
@@ -4683,6 +4718,11 @@ bool wxGenericListCtrl::SetItemData( long item, long data )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxRect wxGenericListCtrl::GetViewRect() const
|
||||||
|
{
|
||||||
|
return m_mainWin->GetViewRect();
|
||||||
|
}
|
||||||
|
|
||||||
bool wxGenericListCtrl::GetItemRect( long item, wxRect &rect, int WXUNUSED(code) ) const
|
bool wxGenericListCtrl::GetItemRect( long item, wxRect &rect, int WXUNUSED(code) ) const
|
||||||
{
|
{
|
||||||
m_mainWin->GetItemRect( item, rect );
|
m_mainWin->GetItemRect( item, rect );
|
||||||
|
@@ -1032,6 +1032,32 @@ bool wxListCtrl::SetItemData(long item, long data)
|
|||||||
return SetItem(info);
|
return SetItem(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxRect wxListCtrl::GetViewRect() const
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( !HasFlag(wxLC_REPORT | wxLC_LIST),
|
||||||
|
_T("wxListCtrl::GetViewRect() only works in icon mode") );
|
||||||
|
|
||||||
|
RECT rc;
|
||||||
|
if ( !ListView_GetViewRect(GetHwnd(), &rc) )
|
||||||
|
{
|
||||||
|
wxLogDebug(_T("ListView_GetViewRect() failed."));
|
||||||
|
|
||||||
|
wxZeroMemory(rc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// VZ: I have no idea why is this needed but without it the listbook
|
||||||
|
// control shows a tiny vertical scrollbar, make sure that it works
|
||||||
|
// correctly if you decide to change this
|
||||||
|
rc.bottom += 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxRect rect;
|
||||||
|
wxCopyRECTToRect(rc, rect);
|
||||||
|
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
// Gets the item rectangle
|
// Gets the item rectangle
|
||||||
bool wxListCtrl::GetItemRect(long item, wxRect& rect, int code) const
|
bool wxListCtrl::GetItemRect(long item, wxRect& rect, int code) const
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user