#include "wx/listctrl.h"
-#if (!defined(__WXMSW__) || defined(__WXUNIVERSAL__)) && !defined(__WXMAC__)
+#if ((!defined(__WXMSW__) && !(defined(__WXMAC__) && wxOSX_USE_CARBON)) || defined(__WXUNIVERSAL__))
// if we have a native version, its implementation file does all this
IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxListView, wxListCtrl)
#include "wx/renderer.h"
#ifdef __WXMAC__
- #include "wx/mac/private.h"
+ #include "wx/osx/private.h"
+ // for themeing support
+ #include <Carbon/Carbon.h>
#endif
// wxListLineData (internal)
//-----------------------------------------------------------------------------
-WX_DECLARE_EXPORTED_LIST(wxListItemData, wxListItemDataList);
+WX_DECLARE_LIST(wxListItemData, wxListItemDataList);
#include "wx/listimpl.cpp"
WX_DEFINE_LIST(wxListItemDataList)
int width);
};
-WX_DECLARE_EXPORTED_OBJARRAY(wxListLineData, wxListLineDataArray);
+WX_DECLARE_OBJARRAY(wxListLineData, wxListLineDataArray);
#include "wx/arrimpl.cpp"
WX_DEFINE_OBJARRAY(wxListLineDataArray)
// it wasn't vetoed, i.e. if we should proceed
bool SendListEvent(wxEventType type, const wxPoint& pos);
- DECLARE_DYNAMIC_CLASS(wxListHeaderWindow)
DECLARE_EVENT_TABLE()
};
wxTextCtrl *GetText() const { return m_text; }
- void AcceptChangesAndFinish();
+ void EndEdit( bool discardChanges );
protected:
void OnChar( wxKeyEvent &event );
void OnKillFocus( wxFocusEvent &event );
bool AcceptChanges();
- void Finish();
+ void Finish( bool setfocus );
private:
wxListMainWindow *m_owner;
wxTextCtrl *m_text;
wxString m_startValue;
size_t m_itemEdited;
- bool m_finished;
bool m_aboutToFinish;
DECLARE_EVENT_TABLE()
// wxListMainWindow (internal)
//-----------------------------------------------------------------------------
-WX_DECLARE_EXPORTED_LIST(wxListHeaderData, wxListHeaderDataList);
+WX_DECLARE_LIST(wxListHeaderData, wxListHeaderDataList);
#include "wx/listimpl.cpp"
WX_DEFINE_LIST(wxListHeaderDataList)
-class wxListMainWindow : public wxScrolledWindow
+class wxListMainWindow : public wxScrolledCanvas
{
public:
wxListMainWindow();
// bring the selected item into view, scrolling to it if necessary
void MoveToItem(size_t item);
+ bool ScrollList( int WXUNUSED(dx), int dy );
+
// bring the current item into view
void MoveToFocus() { MoveToItem(m_current); }
return m_textctrlWrapper ? m_textctrlWrapper->GetText() : NULL;
}
- void FinishEditing(wxTextCtrl *text)
+ void ResetTextControl(wxTextCtrl *text)
{
delete text;
m_textctrlWrapper = NULL;
- SetFocusIgnoringChildren();
}
- // suspend/resume redrawing the control
- void Freeze();
- void Thaw();
-
void OnRenameTimer();
bool OnRenameAccept(size_t itemEdit, const wxString& value);
void OnRenameCancelled(size_t itemEdit);
void OnPaint( wxPaintEvent &event );
+ void OnChildFocus(wxChildFocusEvent& event);
+
void DrawImage( int index, wxDC *dc, int x, int y );
void GetImageSize( int index, int &width, int &height ) const;
int GetTextLength( const wxString &s ) const;
void SetItemState( long item, long state, long stateMask );
void SetItemStateAll( long state, long stateMask );
int GetItemState( long item, long stateMask ) const;
- void GetItemRect( long index, wxRect &rect ) const;
+ bool GetItemRect( long item, wxRect &rect ) const
+ {
+ return GetSubItemRect(item, wxLIST_GETSUBITEMRECT_WHOLEITEM, rect);
+ }
+ bool GetSubItemRect( long item, long subItem, wxRect& rect ) const;
wxRect GetViewRect() const;
bool GetItemPosition( long item, wxPoint& pos ) const;
int GetSelectedItemCount() const;
// override base class virtual to reset m_lineHeight when the font changes
virtual bool SetFont(const wxFont& font)
{
- if ( !wxScrolledWindow::SetFont(font) )
+ if ( !wxScrolledCanvas::SetFont(font) )
return false;
m_lineHeight = 0;
wxBrush *m_highlightBrush,
*m_highlightUnfocusedBrush;
- // if this is > 0, the control is frozen and doesn't redraw itself
- size_t m_freezeCount;
-
// wrapper around the text control currently used for in place editing or
// NULL if no item is being edited
wxListTextCtrlWrapper *m_textctrlWrapper;
- DECLARE_DYNAMIC_CLASS(wxListMainWindow)
DECLARE_EVENT_TABLE()
friend class wxGenericListCtrl;
#ifdef __WXMAC__
{
if (m_owner->HasFocus()
-#ifdef __WXMAC__
+#if !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON
&& IsControlActive( (ControlRef)m_owner->GetHandle() )
#endif
)
if ( highlighted )
dc->SetBrush( *m_owner->GetHighlightBrush() );
else
- dc->SetBrush(wxBrush(attr->GetBackgroundColour(), wxSOLID));
+ dc->SetBrush(wxBrush(attr->GetBackgroundColour(), wxBRUSHSTYLE_SOLID));
dc->SetPen( *wxTRANSPARENT_PEN );
{
int flags = wxCONTROL_SELECTED;
if (m_owner->HasFocus()
-#ifdef __WXMAC__
+#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON
&& IsControlActive( (ControlRef)m_owner->GetHandle() )
#endif
)
int xOld = x;
x += width;
+ const int wText = width - 8;
+ wxDCClipper clipper(*dc, xOld, rect.y, wText, rect.height);
+
if ( item->HasImage() )
{
int ix, iy;
}
if ( item->HasText() )
- DrawTextFormatted(dc, item->GetText(), col, xOld, yMid, width - 8);
+ DrawTextFormatted(dc, item->GetText(), col, xOld, yMid, wText);
}
}
// wxListHeaderWindow
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxListHeaderWindow,wxWindow)
-
BEGIN_EVENT_TABLE(wxListHeaderWindow,wxWindow)
EVT_PAINT (wxListHeaderWindow::OnPaint)
EVT_MOUSE_EVENTS (wxListHeaderWindow::OnMouse)
GetClientSize( &w, &h );
m_owner->CalcUnscrolledPosition(w, 0, &w, NULL);
- dc.SetBackgroundMode(wxTRANSPARENT);
+ dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
dc.SetTextForeground(GetForegroundColour());
int x = HEADER_OFFSET_X;
x += wCol;
}
+
+ // Fill in what's missing to the right of the columns, otherwise we will
+ // leave an unpainted area when columns are removed (and it looks better)
+ if ( x < w )
+ {
+ wxRendererNative::Get().DrawHeaderButton
+ (
+ this,
+ dc,
+ wxRect(x, HEADER_OFFSET_Y, w - x, h),
+ 0
+ );
+ }
}
void wxListHeaderWindow::DrawCurrent()
{
m_owner = owner;
m_text = text;
- m_finished = false;
m_aboutToFinish = false;
wxRect rectLabel = owner->GetLineLabelRect(itemEdit);
m_text->PushEventHandler(this);
}
-void wxListTextCtrlWrapper::Finish()
+void wxListTextCtrlWrapper::EndEdit(bool discardChanges)
{
- if ( !m_finished )
+ m_aboutToFinish = true;
+
+ if ( discardChanges )
{
- m_finished = true;
+ m_owner->OnRenameCancelled(m_itemEdited);
- m_text->RemoveEventHandler(this);
- m_owner->FinishEditing(m_text);
+ Finish( true );
+ }
+ else
+ {
+ // Notify the owner about the changes
+ AcceptChanges();
- wxPendingDelete.Append( this );
+ // Even if vetoed, close the control (consistent with MSW)
+ Finish( true );
}
}
+void wxListTextCtrlWrapper::Finish( bool setfocus )
+{
+ m_text->RemoveEventHandler(this);
+ m_owner->ResetTextControl( m_text );
+
+ wxPendingDelete.Append( this );
+
+ if (setfocus)
+ m_owner->SetFocus();
+}
+
bool wxListTextCtrlWrapper::AcceptChanges()
{
const wxString value = m_text->GetValue();
return true;
}
-void wxListTextCtrlWrapper::AcceptChangesAndFinish()
-{
- m_aboutToFinish = true;
-
- // Notify the owner about the changes
- AcceptChanges();
-
- // Even if vetoed, close the control (consistent with MSW)
- Finish();
-}
-
void wxListTextCtrlWrapper::OnChar( wxKeyEvent &event )
{
switch ( event.m_keyCode )
{
case WXK_RETURN:
- AcceptChangesAndFinish();
+ EndEdit( false );
break;
case WXK_ESCAPE:
- m_owner->OnRenameCancelled( m_itemEdited );
- Finish();
+ EndEdit( true );
break;
default:
void wxListTextCtrlWrapper::OnKeyUp( wxKeyEvent &event )
{
- if (m_finished)
+ if (m_aboutToFinish)
{
- event.Skip();
- return;
+ // auto-grow the textctrl:
+ wxSize parentSize = m_owner->GetSize();
+ wxPoint myPos = m_text->GetPosition();
+ wxSize mySize = m_text->GetSize();
+ int sx, sy;
+ m_text->GetTextExtent(m_text->GetValue() + _T("MM"), &sx, &sy);
+ if (myPos.x + sx > parentSize.x)
+ sx = parentSize.x - myPos.x;
+ if (mySize.x > sx)
+ sx = mySize.x;
+ m_text->SetSize(sx, wxDefaultCoord);
}
- // auto-grow the textctrl:
- wxSize parentSize = m_owner->GetSize();
- wxPoint myPos = m_text->GetPosition();
- wxSize mySize = m_text->GetSize();
- int sx, sy;
- m_text->GetTextExtent(m_text->GetValue() + _T("MM"), &sx, &sy);
- if (myPos.x + sx > parentSize.x)
- sx = parentSize.x - myPos.x;
- if (mySize.x > sx)
- sx = mySize.x;
- m_text->SetSize(sx, wxDefaultCoord);
-
event.Skip();
}
void wxListTextCtrlWrapper::OnKillFocus( wxFocusEvent &event )
{
- if ( !m_finished && !m_aboutToFinish )
+ if ( !m_aboutToFinish )
{
if ( !AcceptChanges() )
m_owner->OnRenameCancelled( m_itemEdited );
- Finish();
+ Finish( false );
}
// We must let the native text control handle focus
// wxListMainWindow
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxListMainWindow,wxScrolledWindow)
-
-BEGIN_EVENT_TABLE(wxListMainWindow,wxScrolledWindow)
+BEGIN_EVENT_TABLE(wxListMainWindow,wxScrolledCanvas)
EVT_PAINT (wxListMainWindow::OnPaint)
EVT_MOUSE_EVENTS (wxListMainWindow::OnMouse)
EVT_CHAR (wxListMainWindow::OnChar)
EVT_SET_FOCUS (wxListMainWindow::OnSetFocus)
EVT_KILL_FOCUS (wxListMainWindow::OnKillFocus)
EVT_SCROLLWIN (wxListMainWindow::OnScroll)
+ EVT_CHILD_FOCUS (wxListMainWindow::OnChildFocus)
END_EVENT_TABLE()
void wxListMainWindow::Init()
m_lineLastClicked =
m_lineSelectSingleOnUp =
m_lineBeforeLastClicked = (size_t)-1;
-
- m_freezeCount = 0;
}
wxListMainWindow::wxListMainWindow()
const wxSize& size,
long style,
const wxString &name )
- : wxScrolledWindow( parent, id, pos, size,
+ : wxScrolledCanvas( parent, id, pos, size,
style | wxHSCROLL | wxVSCROLL, name )
{
Init();
(
wxSYS_COLOUR_HIGHLIGHT
),
- wxSOLID
+ wxBRUSHSTYLE_SOLID
);
m_highlightUnfocusedBrush = new wxBrush
(
wxSYS_COLOUR_BTNSHADOW
),
- wxSOLID
+ wxBRUSHSTYLE_SOLID
);
SetScrollbars( 0, 0, 0, 0, 0, 0 );
}
}
-void wxListMainWindow::Freeze()
-{
- m_freezeCount++;
-}
-
-void wxListMainWindow::Thaw()
-{
- wxCHECK_RET( m_freezeCount > 0, _T("thawing unfrozen list control?") );
-
- if ( --m_freezeCount == 0 )
- Refresh();
-}
-
void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
{
// Note: a wxPaintDC must be constructed even if no drawing is
// done (a Windows requirement).
wxPaintDC dc( this );
- if ( IsEmpty() || m_freezeCount )
+ if ( IsEmpty() )
+ {
// nothing to draw or not the moment to draw it
return;
+ }
if ( m_dirty )
+ {
// delay the repainting until we calculate all the items positions
return;
+ }
PrepareDC( dc );
if ( HasFlag(wxLC_HRULES) )
{
- wxPen pen(GetRuleColour(), 1, wxSOLID);
+ wxPen pen(GetRuleColour(), 1, wxPENSTYLE_SOLID);
wxSize clientSize = GetClientSize();
size_t i = visibleFrom;
// Draw vertical rules if required
if ( HasFlag(wxLC_VRULES) && !IsEmpty() )
{
- wxPen pen(GetRuleColour(), 1, wxSOLID);
+ wxPen pen(GetRuleColour(), 1, wxPENSTYLE_SOLID);
wxRect firstItemRect, lastItemRect;
GetItemRect(visibleFrom, firstItemRect);
}
}
+void wxListMainWindow::OnChildFocus(wxChildFocusEvent& WXUNUSED(event))
+{
+ // Do nothing here. This prevents the default handler in wxScrolledWindow
+ // from needlessly scrolling the window when the edit control is
+ // dismissed. See ticket #9563.
+}
+
void wxListMainWindow::SendNotify( size_t line,
wxEventType command,
const wxPoint& point )
// listctrl because the order of events is different (or something like
// that), so explicitly end the edit if it is active.
if ( event.LeftDown() && m_textctrlWrapper )
- m_textctrlWrapper->AcceptChangesAndFinish();
+ m_textctrlWrapper->EndEdit( false );
#endif // __WXMAC__
if ( event.LeftDown() )
- SetFocusIgnoringChildren();
+ SetFocus();
event.SetEventObject( GetParent() );
if ( GetParent()->GetEventHandler()->ProcessEvent( event) )
}
else // !report
{
+ int sx = -1,
+ sy = -1;
+
if (rect.x-view_x < 5)
- Scroll( (rect.x - 5) / SCROLL_UNIT_X, -1 );
+ sx = (rect.x - 5) / SCROLL_UNIT_X;
if (rect.x + rect.width - 5 > view_x + client_w)
- Scroll( (rect.x + rect.width - client_w + SCROLL_UNIT_X) / SCROLL_UNIT_X, -1 );
+ sx = (rect.x + rect.width - client_w + SCROLL_UNIT_X) / SCROLL_UNIT_X;
+
+ if (rect.y-view_y < 5)
+ sy = (rect.y - 5) / hLine;
+ if (rect.y + rect.height - 5 > view_y + client_h)
+ sy = (rect.y + rect.height - client_h + hLine) / hLine;
+
+ Scroll(sx, sy);
}
}
+bool wxListMainWindow::ScrollList(int WXUNUSED(dx), int dy)
+{
+ if ( !InReportView() )
+ {
+ // TODO: this should work in all views but is not implemented now
+ return false;
+ }
+
+ size_t top, bottom;
+ GetVisibleLinesRange(&top, &bottom);
+
+ if ( bottom == (size_t)-1 )
+ return 0;
+
+ ResetVisibleLinesRange();
+
+ int hLine = GetLineHeight();
+
+ Scroll(-1, top + dy / hLine);
+
+#ifdef __WXMAC__
+ // see comment in MoveToItem() for why we do this
+ ResetVisibleLinesRange();
+#endif
+
+ return true;
+}
+
// ----------------------------------------------------------------------------
// keyboard handling
// ----------------------------------------------------------------------------
wxWindow *parent = GetParent();
// propagate the key event upwards
- wxKeyEvent ke( wxEVT_KEY_DOWN );
- ke.m_shiftDown = event.m_shiftDown;
- ke.m_controlDown = event.m_controlDown;
- ke.m_altDown = event.m_altDown;
- ke.m_metaDown = event.m_metaDown;
- ke.m_keyCode = event.m_keyCode;
- ke.m_x = event.m_x;
- ke.m_y = event.m_y;
+ wxKeyEvent ke(event);
ke.SetEventObject( parent );
- if (parent->GetEventHandler()->ProcessEvent( ke )) return;
+ if (parent->GetEventHandler()->ProcessEvent( ke ))
+ return;
event.Skip();
}
wxWindow *parent = GetParent();
// propagate the key event upwards
- wxKeyEvent ke( wxEVT_KEY_UP );
- ke.m_shiftDown = event.m_shiftDown;
- ke.m_controlDown = event.m_controlDown;
- ke.m_altDown = event.m_altDown;
- ke.m_metaDown = event.m_metaDown;
- ke.m_keyCode = event.m_keyCode;
- ke.m_x = event.m_x;
- ke.m_y = event.m_y;
- ke.SetEventObject( parent );
- if (parent->GetEventHandler()->ProcessEvent( ke )) return;
+ wxKeyEvent ke(event);
+ if (parent->GetEventHandler()->ProcessEvent( ke ))
+ return;
event.Skip();
}
}
// propagate the char event upwards
- wxKeyEvent ke( wxEVT_CHAR );
- ke.m_shiftDown = event.m_shiftDown;
- ke.m_controlDown = event.m_controlDown;
- ke.m_altDown = event.m_altDown;
- ke.m_metaDown = event.m_metaDown;
- ke.m_keyCode = event.m_keyCode;
- ke.m_x = event.m_x;
- ke.m_y = event.m_y;
+ wxKeyEvent ke(event);
ke.SetEventObject( parent );
- if (parent->GetEventHandler()->ProcessEvent( ke )) return;
+ if (parent->GetEventHandler()->ProcessEvent( ke ))
+ return;
- if (event.GetKeyCode() == WXK_TAB)
- {
- wxNavigationKeyEvent nevent;
- nevent.SetWindowChange( event.ControlDown() );
- nevent.SetDirection( !event.ShiftDown() );
- nevent.SetEventObject( GetParent()->GetParent() );
- nevent.SetCurrentFocus( m_parent );
- if (GetParent()->GetParent()->GetEventHandler()->ProcessEvent( nevent ))
- return;
- }
+ if ( HandleAsNavigationKey(event) )
+ return;
// no item -> nothing to do
if (!HasCurrent())
wxRect wxListMainWindow::GetViewRect() const
{
- wxASSERT_MSG( !HasFlag(wxLC_REPORT | wxLC_LIST),
- _T("wxListCtrl::GetViewRect() only works in icon mode") );
+ wxASSERT_MSG( !HasFlag(wxLC_LIST), "not implemented for list view" );
// we need to find the longest/tallest label
wxCoord xMax = 0, yMax = 0;
{
for ( int i = 0; i < count; i++ )
{
- wxRect r;
- GetItemRect(i, r);
+ // we need logical, not physical, coordinates here, so use
+ // GetLineRect() instead of GetItemRect()
+ wxRect r = GetLineRect(i);
wxCoord x = r.GetRight(),
y = r.GetBottom();
return wxRect(0, 0, xMax, yMax);
}
-void wxListMainWindow::GetItemRect( long index, wxRect &rect ) const
+bool
+wxListMainWindow::GetSubItemRect(long item, long subItem, wxRect& rect) const
{
- wxCHECK_RET( index >= 0 && (size_t)index < GetItemCount(),
- _T("invalid index in GetItemRect") );
+ wxCHECK_MSG( subItem == wxLIST_GETSUBITEMRECT_WHOLEITEM || InReportView(),
+ false,
+ _T("GetSubItemRect only meaningful in report view") );
+ wxCHECK_MSG( item >= 0 && (size_t)item < GetItemCount(), false,
+ _T("invalid item in GetSubItemRect") );
// ensure that we're laid out, otherwise we could return nonsense
if ( m_dirty )
RecalculatePositions(true /* no refresh */);
}
- rect = GetLineRect((size_t)index);
+ rect = GetLineRect((size_t)item);
+
+ // Adjust rect to specified column
+ if ( subItem != wxLIST_GETSUBITEMRECT_WHOLEITEM )
+ {
+ wxCHECK_MSG( subItem >= 0 && subItem < GetColumnCount(), false,
+ _T("invalid subItem in GetSubItemRect") );
+
+ for (int i = 0; i < subItem; i++)
+ {
+ rect.x += GetColumnWidth(i);
+ }
+ rect.width = GetColumnWidth(subItem);
+ }
CalcScrolledPosition(rect.x, rect.y, &rect.x, &rect.y);
+
+ return true;
}
bool wxListMainWindow::GetItemPosition(long item, wxPoint& pos) const
const size_t count = GetItemCount();
int iconSpacing;
- if ( HasFlag(wxLC_ICON) )
+ if ( HasFlag(wxLC_ICON) && m_normal_image_list )
iconSpacing = m_normal_spacing;
- else if ( HasFlag(wxLC_SMALL_ICON) )
+ else if ( HasFlag(wxLC_SMALL_ICON) && m_small_image_list )
iconSpacing = m_small_spacing;
else
iconSpacing = 0;
{
// FIXME
#if ( defined(__WXGTK__) || defined(__WXMAC__) ) && !defined(__WXUNIVERSAL__)
- wxScrolledWindow::OnScroll(event);
+ wxScrolledCanvas::OnScroll(event);
#else
HandleOnScroll( event );
#endif
{
if ( m_headerWin )
{
-#ifdef __WXMAC__
+#if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
SInt32 h;
GetThemeMetric( kThemeMetricListHeaderHeight, &h );
#else
m_headerHeight = 0;
- if ( !(style & wxLC_MASK_TYPE) )
- {
- style = style | wxLC_LIST;
- }
+ // just like in other ports, an assert will fail if the user doesn't give any type style:
+ wxASSERT_MSG( (style & wxLC_MASK_TYPE),
+ _T("wxListCtrl style should have exactly one mode bit set") );
if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
return false;
m_mainWin = new wxListMainWindow( this, wxID_ANY, wxPoint(0, 0), size, style );
-#ifdef __WXMAC_CARBON__
+#if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
// Human Interface Guidelines ask us for a special font in this case
if ( GetWindowVariant() == wxWINDOW_VARIANT_NORMAL )
{
wxFont font;
- font.MacCreateThemeFont( kThemeViewsFont );
+#if wxOSX_USE_CARBON
+ font.MacCreateFromThemeFont( kThemeViewsFont );
+#else
+ font.MacCreateFromUIFont( kCTFontViewsFontType );
+#endif
SetFont( font );
}
#endif
{
CreateHeaderWindow();
-#ifdef __WXMAC_CARBON__
+#if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
if (m_headerWin)
{
wxFont font;
- font.MacCreateThemeFont( kThemeSmallSystemFont );
+#if wxOSX_USE_CARBON
+ font.MacCreateFromThemeFont( kThemeSmallSystemFont );
+#else
+ font.MacCreateFromUIFont( kCTFontSystemFontType );
+#endif
m_headerWin->SetFont( font );
CalculateAndSetHeaderHeight();
}
else
flag &= ~style;
- SetWindowStyleFlag( flag );
+ // some styles can be set without recreating everything (as happens in
+ // SetWindowStyleFlag() which calls wxListMainWindow::DeleteEverything())
+ if ( !(style & ~(wxLC_HRULES | wxLC_VRULES)) )
+ {
+ Refresh();
+ wxWindow::SetWindowStyleFlag(flag);
+ }
+ else
+ {
+ SetWindowStyleFlag( flag );
+ }
}
void wxGenericListCtrl::SetWindowStyleFlag( long flag )
return m_mainWin->GetViewRect();
}
-bool wxGenericListCtrl::GetItemRect( long item, wxRect &rect, int WXUNUSED(code) ) const
+bool wxGenericListCtrl::GetItemRect(long item, wxRect& rect, int code) const
{
- m_mainWin->GetItemRect( item, rect );
+ return GetSubItemRect(item, wxLIST_GETSUBITEMRECT_WHOLEITEM, rect, code);
+}
+
+bool wxGenericListCtrl::GetSubItemRect(long item,
+ long subItem,
+ wxRect& rect,
+ int WXUNUSED(code)) const
+{
+ if ( !m_mainWin->GetSubItemRect( item, subItem, rect ) )
+ return false;
+
if ( m_mainWin->HasHeader() )
rect.y += m_headerHeight + 1;
+
return true;
}
bool wxGenericListCtrl::SetItemPosition( long WXUNUSED(item), const wxPoint& WXUNUSED(pos) )
{
- return 0;
+ return false;
}
int wxGenericListCtrl::GetItemCount() const
return InsertColumn( col, item );
}
-bool wxGenericListCtrl::ScrollList( int WXUNUSED(dx), int WXUNUSED(dy) )
+bool wxGenericListCtrl::ScrollList( int dx, int dy )
{
- return 0;
+ return m_mainWin->ScrollList(dx, dy);
}
// Sort items.
}
}
-void wxGenericListCtrl::Freeze()
-{
- m_mainWin->Freeze();
-}
-
-void wxGenericListCtrl::Thaw()
-{
- m_mainWin->Thaw();
-}
-
#endif // wxUSE_LISTCTRL