#include "wx/textctrl.h"
#endif
-#include "wx/imaglist.h"
-#include "wx/listctrl.h"
+// Include wx/listctrl.h (with wxListView declaration)
+// only when wxGenericListCtrl is the only
+// implementation, and therefore wxListView needs
+// to be derived from the 'generic' version.
+
+#if defined(__WIN32__) && !defined(__WXUNIVERSAL__)
+ #include "wx/generic/listctrl.h"
+#else
+ #include "wx/listctrl.h"
+#endif
#if defined(__WXGTK__)
#include <gtk/gtk.h>
int CMPFUNC_CONV wxSizeTCmpFn(size_t n1, size_t n2) { return n1 - n2; }
-WX_DEFINE_SORTED_EXPORTED_ARRAY(size_t, wxIndexArray);
+WX_DEFINE_SORTED_EXPORTED_ARRAY_LONG(size_t, wxIndexArray);
// this class is used to store the selected items in the virtual list control
// (but it is not tied to list control and so can be used with other controls
void SetItemCount(size_t count) { m_count = count; }
// special case of SetItemCount(0)
- void Clear() { m_itemsSel.Clear(); m_count = 0; }
+ void Clear() { m_itemsSel.Clear(); m_count = 0; m_defaultState = FALSE; }
// must be called when a new item is inserted/added
void OnItemAdd(size_t item) { wxFAIL_MSG( _T("TODO") ); }
wxCursor *m_resizeCursor;
bool m_isDragging;
- // column being resized
+ // column being resized or -1
int m_column;
// divider line position in logical (unscrolled) coords
// common part of all ctors
void Init();
+ void SendListEvent(wxEventType type, wxPoint pos);
+
DECLARE_DYNAMIC_CLASS(wxListHeaderWindow)
DECLARE_EVENT_TABLE()
};
class WXDLLEXPORT wxListTextCtrl: public wxTextCtrl
{
-private:
- bool *m_accept;
- wxString *m_res;
- wxListMainWindow *m_owner;
- wxString m_startValue;
- bool m_finished;
-
public:
- wxListTextCtrl() {}
- wxListTextCtrl( wxWindow *parent, const wxWindowID id,
- bool *accept, wxString *res, wxListMainWindow *owner,
- const wxString &value = "",
- const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
- int style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString &name = "listctrltextctrl" );
+ wxListTextCtrl(wxListMainWindow *owner, size_t itemEdit);
+
+protected:
void OnChar( wxKeyEvent &event );
void OnKeyUp( wxKeyEvent &event );
void OnKillFocus( wxFocusEvent &event );
+ bool AcceptChanges();
+ void Finish();
+
private:
- DECLARE_DYNAMIC_CLASS(wxListTextCtrl);
+ wxListMainWindow *m_owner;
+ wxString m_startValue;
+ size_t m_itemEdited;
+ bool m_finished;
+
DECLARE_EVENT_TABLE()
};
// suspend/resume redrawing the control
void Freeze();
void Thaw();
-
+
void SetFocus();
void OnRenameTimer();
- void OnRenameAccept();
+ bool OnRenameAccept(size_t itemEdit, const wxString& value);
void OnMouse( wxMouseEvent &event );
void GetImageSize( int index, int &width, int &height ) const;
int GetTextLength( const wxString &s ) const;
- void SetImageList( wxImageList *imageList, int which );
+ void SetImageList( wxGenericImageList *imageList, int which );
void SetItemSpacing( int spacing, bool isSmall = FALSE );
int GetItemSpacing( bool isSmall = FALSE );
int GetCountPerPage() const;
void SetItem( wxListItem &item );
- void GetItem( wxListItem &item );
+ void GetItem( wxListItem &item ) const;
void SetItemState( long item, long state, long stateMask );
- int GetItemState( long item, long stateMask );
- void GetItemRect( long index, wxRect &rect );
- bool GetItemPosition( long item, wxPoint& pos );
- int GetSelectedItemCount();
+ int GetItemState( long item, long stateMask ) const;
+ void GetItemRect( long index, wxRect &rect ) const;
+ bool GetItemPosition( long item, wxPoint& pos ) const;
+ int GetSelectedItemCount() const;
+
+ wxString GetItemText(long item) const
+ {
+ wxListItem info;
+ info.m_itemId = item;
+ GetItem( info );
+ return info.m_text;
+ }
+
+ void SetItemText(long item, const wxString& value)
+ {
+ wxListItem info;
+ info.m_mask = wxLIST_MASK_TEXT;
+ info.m_itemId = item;
+ info.m_text = value;
+ SetItem( info );
+ }
// set the scrollbars and update the positions of the items
void RecalculatePositions(bool noRefresh = FALSE);
// refresh the window and the header
void RefreshAll();
- long GetNextItem( long item, int geometry, int state );
+ long GetNextItem( long item, int geometry, int state ) const;
void DeleteItem( long index );
void DeleteAllItems();
void DeleteColumn( int col );
// these are for wxListLineData usage only
// get the backpointer to the list ctrl
- wxListCtrl *GetListCtrl() const
+ wxGenericListCtrl *GetListCtrl() const
{
- return wxStaticCast(GetParent(), wxListCtrl);
+ return wxStaticCast(GetParent(), wxGenericListCtrl);
}
// get the height of all lines (assuming they all do have the same height)
}
//protected:
- // the array of all line objects for a non virtual list control
+ // the array of all line objects for a non virtual list control (for the
+ // virtual list control we only ever use m_lines[0])
wxListLineDataArray m_lines;
// the list of column objects
// currently focused item or -1
size_t m_current;
- // the item currently being edited or -1
- size_t m_currentEdit;
-
// the number of lines per page
int m_linesPerPage;
wxColour *m_highlightColour;
int m_xScroll,
m_yScroll;
- wxImageList *m_small_image_list;
- wxImageList *m_normal_image_list;
+ wxGenericImageList *m_small_image_list;
+ wxGenericImageList *m_normal_image_list;
int m_small_spacing;
int m_normal_spacing;
bool m_hasFocus;
bool m_lastOnSame;
wxTimer *m_renameTimer;
- bool m_renameAccept;
- wxString m_renameRes;
bool m_isCreated;
int m_dragCount;
wxPoint m_dragStart;
// if this is > 0, the control is frozen and doesn't redraw itself
size_t m_freezeCount;
- DECLARE_DYNAMIC_CLASS(wxListMainWindow);
+ DECLARE_DYNAMIC_CLASS(wxListMainWindow)
DECLARE_EVENT_TABLE()
};
if ( item->HasImage() )
{
- m_gi->m_rectIcon.x = m_gi->m_rectAll.x + 4
- + (spacing - m_gi->m_rectIcon.width)/2;
+ m_gi->m_rectIcon.x = m_gi->m_rectAll.x + 4 +
+ (m_gi->m_rectAll.width - m_gi->m_rectIcon.width) / 2;
m_gi->m_rectIcon.y = m_gi->m_rectAll.y + 4;
}
dc->DrawRectangle( rectHL );
}
- wxListItemDataList::Node *node = m_items.GetFirst();
- wxCHECK_RET( node, _T("no subitems at all??") );
-
- size_t col = 0;
wxCoord x = rect.x + HEADER_OFFSET_X,
y = rect.y + (LINE_SPACING + EXTRA_HEIGHT) / 2;
- while ( node )
+ size_t col = 0;
+ for ( wxListItemDataList::Node *node = m_items.GetFirst();
+ node;
+ node = node->GetNext(), col++ )
{
wxListItemData *item = node->GetData();
- int width = m_owner->GetColumnWidth(col++);
+ int width = m_owner->GetColumnWidth(col);
int xOld = x;
x += width;
{
dc->DrawText( item->GetText(), xOld, y );
}
-
- node = node->GetNext();
}
}
// wxListHeaderWindow
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxListHeaderWindow,wxWindow);
+IMPLEMENT_DYNAMIC_CLASS(wxListHeaderWindow,wxWindow)
BEGIN_EVENT_TABLE(wxListHeaderWindow,wxWindow)
EVT_PAINT (wxListHeaderWindow::OnPaint)
int image = item.m_image;
if ( image != -1 )
{
- wxImageList *imageList = m_owner->m_small_image_list;
+ wxGenericImageList *imageList = m_owner->m_small_image_list;
if ( imageList )
{
int ix, iy;
if (m_isDragging)
{
+ SendListEvent(wxEVT_COMMAND_LIST_COL_DRAGGING,
+ event.GetPosition());
+
// we don't draw the line beyond our window, but we allow dragging it
// there
int w = 0;
m_isDragging = FALSE;
m_dirty = TRUE;
m_owner->SetColumnWidth( m_column, m_currentX - m_minX );
+ SendListEvent(wxEVT_COMMAND_LIST_COL_END_DRAG,
+ event.GetPosition());
}
else
{
int xpos = 0;
// find the column where this event occured
- int countCol = m_owner->GetColumnCount();
- for (int col = 0; col < countCol; col++)
+ int col,
+ countCol = m_owner->GetColumnCount();
+ for (col = 0; col < countCol; col++)
{
xpos += m_owner->GetColumnWidth( col );
m_column = col;
m_minX = xpos;
}
+ if ( col == countCol )
+ m_column = -1;
+
if (event.LeftDown() || event.RightUp())
{
if (hit_border && event.LeftDown())
m_currentX = x;
DrawCurrent();
CaptureMouse();
+ SendListEvent(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG,
+ event.GetPosition());
}
else // click on a column
{
- wxWindow *parent = GetParent();
- wxListEvent le( event.LeftDown()
+ SendListEvent( event.LeftDown()
? wxEVT_COMMAND_LIST_COL_CLICK
: wxEVT_COMMAND_LIST_COL_RIGHT_CLICK,
- parent->GetId() );
- le.SetEventObject( parent );
- le.m_pointDrag = event.GetPosition();
-
- // the position should be relative to the parent window, not
- // this one for compatibility with MSW and common sense: the
- // user code doesn't know anything at all about this header
- // window, so why should it get positions relative to it?
- le.m_pointDrag.y -= GetSize().y;
-
- le.m_col = m_column;
- parent->GetEventHandler()->ProcessEvent( le );
+ event.GetPosition());
}
}
else if (event.Moving())
m_owner->SetFocus();
}
+void wxListHeaderWindow::SendListEvent(wxEventType type, wxPoint pos)
+{
+ wxWindow *parent = GetParent();
+ wxListEvent le( type, parent->GetId() );
+ le.SetEventObject( parent );
+ le.m_pointDrag = pos;
+
+ // the position should be relative to the parent window, not
+ // this one for compatibility with MSW and common sense: the
+ // user code doesn't know anything at all about this header
+ // window, so why should it get positions relative to it?
+ le.m_pointDrag.y -= GetSize().y;
+
+ le.m_col = m_column;
+ parent->GetEventHandler()->ProcessEvent( le );
+}
+
//-----------------------------------------------------------------------------
// wxListRenameTimer (internal)
//-----------------------------------------------------------------------------
// wxListTextCtrl (internal)
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxListTextCtrl,wxTextCtrl);
-
BEGIN_EVENT_TABLE(wxListTextCtrl,wxTextCtrl)
EVT_CHAR (wxListTextCtrl::OnChar)
EVT_KEY_UP (wxListTextCtrl::OnKeyUp)
EVT_KILL_FOCUS (wxListTextCtrl::OnKillFocus)
END_EVENT_TABLE()
-wxListTextCtrl::wxListTextCtrl( wxWindow *parent,
- const wxWindowID id,
- bool *accept,
- wxString *res,
- wxListMainWindow *owner,
- const wxString &value,
- const wxPoint &pos,
- const wxSize &size,
- int style,
- const wxValidator& validator,
- const wxString &name )
- : wxTextCtrl( parent, id, value, pos, size, style, validator, name )
-{
- m_res = res;
- m_accept = accept;
+wxListTextCtrl::wxListTextCtrl(wxListMainWindow *owner, size_t itemEdit)
+ : m_startValue(owner->GetItemText(itemEdit)),
+ m_itemEdited(itemEdit)
+{
m_owner = owner;
- (*m_accept) = FALSE;
- (*m_res) = "";
- m_startValue = value;
m_finished = FALSE;
+
+ wxRect rectLabel = owner->GetLineLabelRect(itemEdit);
+
+ m_owner->CalcScrolledPosition(rectLabel.x, rectLabel.y,
+ &rectLabel.x, &rectLabel.y);
+
+ (void)Create(owner, wxID_ANY, m_startValue,
+ wxPoint(rectLabel.x-4,rectLabel.y-4),
+ wxSize(rectLabel.width+11,rectLabel.height+8));
}
-void wxListTextCtrl::OnChar( wxKeyEvent &event )
+void wxListTextCtrl::Finish()
{
- if (event.m_keyCode == WXK_RETURN)
+ if ( !m_finished )
{
- (*m_accept) = TRUE;
- (*m_res) = GetValue();
-
- if (!wxPendingDelete.Member(this))
- wxPendingDelete.Append(this);
-
- if ((*m_res) != m_startValue)
- m_owner->OnRenameAccept();
+ wxPendingDelete.Append(this);
m_finished = TRUE;
+
m_owner->SetFocus();
+ }
+}
- return;
+bool wxListTextCtrl::AcceptChanges()
+{
+ const wxString value = GetValue();
+
+ if ( value == m_startValue )
+ {
+ // nothing changed, always accept
+ return TRUE;
}
- if (event.m_keyCode == WXK_ESCAPE)
+
+ if ( !m_owner->OnRenameAccept(m_itemEdited, value) )
{
- (*m_accept) = FALSE;
- (*m_res) = "";
+ // vetoed by the user
+ return FALSE;
+ }
- if (!wxPendingDelete.Member(this))
- wxPendingDelete.Append(this);
+ // accepted, do rename the item
+ m_owner->SetItemText(m_itemEdited, value);
- m_finished = TRUE;
- m_owner->SetFocus();
+ return TRUE;
+}
- return;
- }
+void wxListTextCtrl::OnChar( wxKeyEvent &event )
+{
+ switch ( event.m_keyCode )
+ {
+ case WXK_RETURN:
+ if ( !AcceptChanges() )
+ {
+ // vetoed by the user code
+ break;
+ }
+ //else: fall through
- event.Skip();
+ case WXK_ESCAPE:
+ Finish();
+ break;
+
+ default:
+ event.Skip();
+ }
}
void wxListTextCtrl::OnKeyUp( wxKeyEvent &event )
void wxListTextCtrl::OnKillFocus( wxFocusEvent &event )
{
- if (m_finished)
+ if ( !m_finished )
{
- event.Skip();
- return;
- }
+ (void)AcceptChanges();
- if (!wxPendingDelete.Member(this))
- wxPendingDelete.Append(this);
+ Finish();
+ }
- (*m_accept) = TRUE;
- (*m_res) = GetValue();
-
- if ((*m_res) != m_startValue)
- m_owner->OnRenameAccept();
+ event.Skip();
}
//-----------------------------------------------------------------------------
// wxListMainWindow
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxListMainWindow,wxScrolledWindow);
+IMPLEMENT_DYNAMIC_CLASS(wxListMainWindow,wxScrolledWindow)
BEGIN_EVENT_TABLE(wxListMainWindow,wxScrolledWindow)
EVT_PAINT (wxListMainWindow::OnPaint)
m_headerWidth =
m_lineHeight = 0;
- m_small_image_list = (wxImageList *) NULL;
- m_normal_image_list = (wxImageList *) NULL;
+ m_small_image_list = (wxGenericImageList *) NULL;
+ m_normal_image_list = (wxGenericImageList *) NULL;
m_small_spacing = 30;
m_normal_spacing = 40;
m_lastOnSame = FALSE;
m_renameTimer = new wxListRenameTimer( this );
- m_renameAccept = FALSE;
m_current =
- m_currentEdit =
m_lineLastClicked =
m_lineBeforeLastClicked = (size_t)-1;
void wxListMainWindow::CacheLineData(size_t line)
{
- wxListCtrl *listctrl = GetListCtrl();
+ wxGenericListCtrl *listctrl = GetListCtrl();
wxListLineData *ld = GetDummyLine();
{
wxASSERT_MSG( !IsEmpty(), _T("invalid line index") );
- if ( m_lines.IsEmpty() )
+ wxASSERT_MSG( IsVirtual(), _T("GetDummyLine() shouldn't be called") );
+
+ wxListMainWindow *self = wxConstCast(this, wxListMainWindow);
+
+ // we need to recreate the dummy line if the number of columns in the
+ // control changed as it would have the incorrect number of fields
+ // otherwise
+ if ( !m_lines.IsEmpty() &&
+ m_lines[0].m_items.GetCount() != (size_t)GetColumnCount() )
{
- // normal controls are supposed to have something in m_lines
- // already if it's not empty
- wxASSERT_MSG( IsVirtual(), _T("logic error") );
+ self->m_lines.Clear();
+ }
- wxListMainWindow *self = wxConstCast(this, wxListMainWindow);
+ if ( m_lines.IsEmpty() )
+ {
wxListLineData *line = new wxListLineData(self);
self->m_lines.Add(line);
+
+ // don't waste extra memory -- there never going to be anything
+ // else/more in this array
+ self->m_lines.Shrink();
}
return &m_lines[0];
if ( ld->HasImage() && GetLineIconRect(line).Inside(x, y) )
return wxLIST_HITTEST_ONITEMICON;
- if ( ld->HasText() )
+ // VS: Testing for "ld->HasText() || InReportView()" instead of
+ // "ld->HasText()" is needed to make empty lines in report view
+ // possible
+ if ( ld->HasText() || InReportView() )
{
wxRect rect = InReportView() ? GetLineRect(line)
: GetLineLabelRect(line);
{
if ( HasFlag(wxLC_REPORT) )
{
- size_t visibleFrom;
- GetVisibleLinesRange(&visibleFrom, NULL);
+ size_t visibleFrom, visibleTo;
+ GetVisibleLinesRange(&visibleFrom, &visibleTo);
if ( lineFrom < visibleFrom )
lineFrom = visibleFrom;
+ else if ( lineFrom > visibleTo )
+ return;
wxRect rect;
rect.x = 0;
rect.y = GetLineY(lineFrom);
+ CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y );
wxSize size = GetClientSize();
rect.width = size.x;
// refresh till the bottom of the window
rect.height = size.y - rect.y;
- CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y );
RefreshRect( rect );
}
else // !report
to = GetItemCount() - 1;
}
- // VZ: this code would work fine if wxGTK wxWindow::Refresh() were
- // reasonable, i.e. if it only generated one expose event for
- // several calls to it - as it is, each Refresh() results in a
- // repaint which provokes flicker too horrible to be seen
- //
- // when/if wxGTK is fixed, this code should be restored as normally it
- // should generate _less_ flicker than the version below
-#ifndef __WXGTK__
if ( HasCurrent() && m_current >= from && m_current <= to )
{
RefreshLine(m_current);
RefreshLine(line);
}
}
-#else // __WXGTK__
- size_t selMin = (size_t)-1,
- selMax = 0;
-
- for ( size_t line = from; line <= to; line++ )
- {
- if ( IsHighlighted(line) || (line == m_current) )
- {
- if ( line < selMin )
- selMin = line;
- if ( line > selMax )
- selMax = line;
- }
- }
-
- if ( selMin != (size_t)-1 )
- {
- RefreshLines(selMin, selMax);
- }
-#endif // !__WXGTK__/__WXGTK__
}
void wxListMainWindow::Freeze()
void wxListMainWindow::EditLabel( long item )
{
wxCHECK_RET( (item >= 0) && ((size_t)item < GetItemCount()),
- wxT("wrong index in wxListCtrl::EditLabel()") );
+ wxT("wrong index in wxGenericListCtrl::EditLabel()") );
- m_currentEdit = (size_t)item;
+ size_t itemEdit = (size_t)item;
wxListEvent le( wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, GetParent()->GetId() );
le.SetEventObject( GetParent() );
le.m_itemIndex = item;
- wxListLineData *data = GetLine(m_currentEdit);
+ wxListLineData *data = GetLine(itemEdit);
wxCHECK_RET( data, _T("invalid index in EditLabel()") );
data->GetItem( 0, le.m_item );
- GetParent()->GetEventHandler()->ProcessEvent( le );
-
- if (!le.IsAllowed())
+ if ( GetParent()->GetEventHandler()->ProcessEvent( le ) && !le.IsAllowed() )
+ {
+ // vetoed by user code
return;
+ }
// We have to call this here because the label in question might just have
// been added and no screen update taken place.
- if (m_dirty)
+ if ( m_dirty )
wxSafeYield();
- wxClientDC dc(this);
- PrepareDC( dc );
+ wxListTextCtrl *text = new wxListTextCtrl(this, itemEdit);
- wxString s = data->GetText(0);
- wxRect rectLabel = GetLineLabelRect(m_currentEdit);
-
- rectLabel.x = dc.LogicalToDeviceX( rectLabel.x );
- rectLabel.y = dc.LogicalToDeviceY( rectLabel.y );
-
- wxListTextCtrl *text = new wxListTextCtrl
- (
- this, -1,
- &m_renameAccept,
- &m_renameRes,
- this,
- s,
- wxPoint(rectLabel.x-4,rectLabel.y-4),
- wxSize(rectLabel.width+11,rectLabel.height+8)
- );
text->SetFocus();
}
EditLabel( m_current );
}
-void wxListMainWindow::OnRenameAccept()
+bool wxListMainWindow::OnRenameAccept(size_t itemEdit, const wxString& value)
{
wxListEvent le( wxEVT_COMMAND_LIST_END_LABEL_EDIT, GetParent()->GetId() );
le.SetEventObject( GetParent() );
- le.m_itemIndex = m_currentEdit;
+ le.m_itemIndex = itemEdit;
- wxListLineData *data = GetLine(m_currentEdit);
- wxCHECK_RET( data, _T("invalid index in OnRenameAccept()") );
+ wxListLineData *data = GetLine(itemEdit);
+ wxCHECK_MSG( data, FALSE, _T("invalid index in OnRenameAccept()") );
data->GetItem( 0, le.m_item );
- le.m_item.m_text = m_renameRes;
- GetParent()->GetEventHandler()->ProcessEvent( le );
-
- if (!le.IsAllowed()) return;
-
- wxListItem info;
- info.m_mask = wxLIST_MASK_TEXT;
- info.m_itemId = le.m_itemIndex;
- info.m_text = m_renameRes;
- info.SetTextColour(le.m_item.GetTextColour());
- SetItem( info );
+ le.m_item.m_text = value;
+ return !GetParent()->GetEventHandler()->ProcessEvent( le ) ||
+ le.IsAllowed();
}
void wxListMainWindow::OnMouse( wxMouseEvent &event )
m_renameTimer->Stop();
m_lastOnSame = FALSE;
+#ifdef __WXGTK__
+ // FIXME: wxGTK generates bad sequence of events prior to doubleclick
+ // ("down, up, down, double, up" while other ports
+ // do "down, up, double, up"). We have to have this hack
+ // in place till somebody fixes wxGTK...
if ( current == m_lineBeforeLastClicked )
+#else
+ if ( current == m_lineLastClicked )
+#endif
{
SendNotify( current, wxEVT_COMMAND_LIST_ITEM_ACTIVATED );
ChangeCurrent(newCurrent);
- HighlightLine( oldCurrent, FALSE );
+ // refresh the old focus to remove it
RefreshLine( oldCurrent );
if ( !event.ControlDown() )
// focus handling
// ----------------------------------------------------------------------------
-#ifdef __WXGTK__
-extern wxWindow *g_focusWindow;
-#endif
-
void wxListMainWindow::SetFocus()
{
// VS: wxListMainWindow derives from wxPanel (via wxScrolledWindow) and wxPanel
- // overrides SetFocus in such way that it does never change focus from
+ // overrides SetFocus in such way that it does never change focus from
// panel's child to the panel itself. Unfortunately, we must be able to change
- // focus to the panel from wxListTextCtrl because the text control should
+ // focus to the panel from wxListTextCtrl because the text control should
// disappear when the user clicks outside it.
wxWindow *oldFocus = FindFocus();
-
- if ( oldFocus->GetParent() == this )
+
+ if ( oldFocus && oldFocus->GetParent() == this )
{
wxWindow::SetFocus();
}
if ( !GetParent() )
return;
-#ifdef __WXGTK__
- g_focusWindow = GetParent();
-#endif
-
wxFocusEvent event( wxEVT_SET_FOCUS, GetParent()->GetId() );
event.SetEventObject( GetParent() );
GetParent()->GetEventHandler()->ProcessEvent( event );
return lw + AUTOSIZE_COL_MARGIN;
}
-void wxListMainWindow::SetImageList( wxImageList *imageList, int which )
+void wxListMainWindow::SetImageList( wxGenericImageList *imageList, int which )
{
m_dirty = TRUE;
{
ResetCurrent();
+ if ( IsSingleSel() )
+ {
+ // we must unselect the old current item as well or we
+ // might end up with more than one selected item in a
+ // single selection control
+ HighlightLine(oldCurrent, FALSE);
+ }
+
RefreshLine( oldCurrent );
}
}
}
}
-int wxListMainWindow::GetItemState( long item, long stateMask )
+int wxListMainWindow::GetItemState( long item, long stateMask ) const
{
wxCHECK_MSG( item >= 0 && (size_t)item < GetItemCount(), 0,
_T("invalid list ctrl item index in GetItemState()") );
return ret;
}
-void wxListMainWindow::GetItem( wxListItem &item )
+void wxListMainWindow::GetItem( wxListItem &item ) const
{
wxCHECK_RET( item.m_itemId >= 0 && (size_t)item.m_itemId < GetItemCount(),
_T("invalid item index in GetItem") );
m_dirty = TRUE;
}
-int wxListMainWindow::GetSelectedItemCount()
+int wxListMainWindow::GetSelectedItemCount() const
{
// deal with the quick case first
if ( IsSingleSel() )
// item position/size
// ----------------------------------------------------------------------------
-void wxListMainWindow::GetItemRect( long index, wxRect &rect )
+void wxListMainWindow::GetItemRect( long index, wxRect &rect ) const
{
wxCHECK_RET( index >= 0 && (size_t)index < GetItemCount(),
_T("invalid index in GetItemRect") );
CalcScrolledPosition(rect.x, rect.y, &rect.x, &rect.y);
}
-bool wxListMainWindow::GetItemPosition(long item, wxPoint& pos)
+bool wxListMainWindow::GetItemPosition(long item, wxPoint& pos) const
{
wxRect rect;
GetItemRect(item, rect);
int clientWidth,
clientHeight;
GetSize( &clientWidth, &clientHeight );
-
+
if ( HasFlag(wxLC_REPORT) )
{
// all lines have the same height
ResetVisibleLinesRange();
SetScrollbars( m_xScroll, m_yScroll,
- (GetHeaderWidth() + m_xScroll - 1)/m_xScroll,
+ GetHeaderWidth() / m_xScroll,
(entireHeight + m_yScroll - 1)/m_yScroll,
GetScrollPos(wxHORIZONTAL),
GetScrollPos(wxVERTICAL),
{
// We start with 4 for the border around all items
entireWidth = 4;
-
+
if (tries == 1)
{
// Now we have decided that the items do not fit into the
// a scrollbar at the bottom of its client area.
entireWidth += SCROLL_UNIT_X;
}
-
+
// Start at 2,2 so the text does not touch the border
int x = 2;
int y = 2;
entireWidth += maxWidth+6;
maxWidth = 0;
}
-
+
// We have reached the last item.
if ( i == count - 1 )
entireWidth += maxWidth;
-
+
if ( (tries == 0) && (entireWidth+SCROLL_UNIT_X > clientWidth) )
{
clientHeight -= 15; // We guess the scrollbar height. (FIXME)
currentlyVisibleLines = 0;
break;
}
-
+
if ( i == count - 1 )
tries = 1; // Everything fits, no second try required.
}
long wxListMainWindow::GetNextItem( long item,
int WXUNUSED(geometry),
- int state )
+ int state ) const
{
long ret = item,
max = GetItemCount();
m_dirty = TRUE;
m_columns.DeleteNode( node );
+
+ // invalidate it as it has to be recalculated
+ m_headerWidth = 0;
}
void wxListMainWindow::DoDeleteAllItems()
void wxListMainWindow::DeleteEverything()
{
- DeleteAllItems();
-
m_columns.Clear();
+
+ DeleteAllItems();
}
// ----------------------------------------------------------------------------
{
m_columns.Append( column );
}
+
+ // invalidate it as it has to be recalculated
+ m_headerWidth = 0;
}
}
if ( event.GetOrientation() == wxHORIZONTAL && HasHeader() )
{
- wxListCtrl* lc = GetListCtrl();
+ wxGenericListCtrl* lc = GetListCtrl();
wxCHECK_RET( lc, _T("no listctrl window?") );
- lc->m_headerWin->Refresh() ;
-#ifdef __WXMAC__
- lc->m_headerWin->MacUpdateImmediately() ;
-#endif
+ lc->m_headerWin->Refresh();
+ lc->m_headerWin->Update();
}
}
// wxListItem
// -------------------------------------------------------------------------------------
+#if !defined(__WIN32__)
IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject)
-
-wxListItem::wxListItem()
-{
- m_attr = NULL;
-
- Clear();
-}
-
-void wxListItem::Clear()
-{
- m_mask = 0;
- m_itemId = 0;
- m_col = 0;
- m_state = 0;
- m_stateMask = 0;
- m_image = -1;
- m_data = 0;
- m_format = wxLIST_FORMAT_CENTRE;
- m_width = 0;
- m_text.clear();
-
- ClearAttributes();
-}
-
-void wxListItem::ClearAttributes()
-{
- if (m_attr)
- {
- delete m_attr;
- m_attr = NULL;
- }
-}
+#endif
// -------------------------------------------------------------------------------------
-// wxListCtrl
+// wxGenericListCtrl
// -------------------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxGenericListCtrl, wxControl)
+
+#if !defined(__WIN32__)
IMPLEMENT_DYNAMIC_CLASS(wxListView, wxListCtrl)
IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxNotifyEvent)
+#endif
-BEGIN_EVENT_TABLE(wxListCtrl,wxControl)
- EVT_SIZE(wxListCtrl::OnSize)
- EVT_IDLE(wxListCtrl::OnIdle)
+BEGIN_EVENT_TABLE(wxGenericListCtrl,wxControl)
+ EVT_SIZE(wxGenericListCtrl::OnSize)
+ EVT_IDLE(wxGenericListCtrl::OnIdle)
END_EVENT_TABLE()
-wxListCtrl::wxListCtrl()
+#if !defined(__WXMSW__) || defined(__WIN16__) || defined(__WXUNIVERSAL__)
+/*
+ * wxListCtrl has to be a real class or we have problems with
+ * the run-time information.
+ */
+
+IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxGenericListCtrl)
+#endif
+
+wxGenericListCtrl::wxGenericListCtrl()
{
- m_imageListNormal = (wxImageList *) NULL;
- m_imageListSmall = (wxImageList *) NULL;
- m_imageListState = (wxImageList *) NULL;
+ m_imageListNormal = (wxGenericImageList *) NULL;
+ m_imageListSmall = (wxGenericImageList *) NULL;
+ m_imageListState = (wxGenericImageList *) NULL;
m_ownsImageListNormal =
m_ownsImageListSmall =
m_headerWin = (wxListHeaderWindow*) NULL;
}
-wxListCtrl::~wxListCtrl()
+wxGenericListCtrl::~wxGenericListCtrl()
{
if (m_ownsImageListNormal)
delete m_imageListNormal;
delete m_imageListState;
}
-void wxListCtrl::CreateHeaderWindow()
+void wxGenericListCtrl::CreateHeaderWindow()
{
m_headerWin = new wxListHeaderWindow
(
);
}
-bool wxListCtrl::Create(wxWindow *parent,
+bool wxGenericListCtrl::Create(wxWindow *parent,
wxWindowID id,
const wxPoint &pos,
const wxSize &size,
{
m_imageListNormal =
m_imageListSmall =
- m_imageListState = (wxImageList *) NULL;
+ m_imageListState = (wxGenericImageList *) NULL;
m_ownsImageListNormal =
m_ownsImageListSmall =
m_ownsImageListState = FALSE;
style = style | wxLC_LIST;
}
- if ( !wxControl::Create( parent, id, pos, size, style, validator, "listctrl" ) )
+ if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
return FALSE;
// don't create the inner window with the border
return TRUE;
}
-void wxListCtrl::SetSingleStyle( long style, bool add )
+void wxGenericListCtrl::SetSingleStyle( long style, bool add )
{
wxASSERT_MSG( !(style & wxLC_VIRTUAL),
_T("wxLC_VIRTUAL can't be [un]set") );
SetWindowStyleFlag( flag );
}
-void wxListCtrl::SetWindowStyleFlag( long flag )
+void wxGenericListCtrl::SetWindowStyleFlag( long flag )
{
if (m_mainWin)
{
wxWindow::SetWindowStyleFlag( flag );
}
-bool wxListCtrl::GetColumn(int col, wxListItem &item) const
+bool wxGenericListCtrl::GetColumn(int col, wxListItem &item) const
{
m_mainWin->GetColumn( col, item );
return TRUE;
}
-bool wxListCtrl::SetColumn( int col, wxListItem& item )
+bool wxGenericListCtrl::SetColumn( int col, wxListItem& item )
{
m_mainWin->SetColumn( col, item );
return TRUE;
}
-int wxListCtrl::GetColumnWidth( int col ) const
+int wxGenericListCtrl::GetColumnWidth( int col ) const
{
return m_mainWin->GetColumnWidth( col );
}
-bool wxListCtrl::SetColumnWidth( int col, int width )
+bool wxGenericListCtrl::SetColumnWidth( int col, int width )
{
m_mainWin->SetColumnWidth( col, width );
return TRUE;
}
-int wxListCtrl::GetCountPerPage() const
+int wxGenericListCtrl::GetCountPerPage() const
{
return m_mainWin->GetCountPerPage(); // different from Windows ?
}
-bool wxListCtrl::GetItem( wxListItem &info ) const
+bool wxGenericListCtrl::GetItem( wxListItem &info ) const
{
m_mainWin->GetItem( info );
return TRUE;
}
-bool wxListCtrl::SetItem( wxListItem &info )
+bool wxGenericListCtrl::SetItem( wxListItem &info )
{
m_mainWin->SetItem( info );
return TRUE;
}
-long wxListCtrl::SetItem( long index, int col, const wxString& label, int imageId )
+long wxGenericListCtrl::SetItem( long index, int col, const wxString& label, int imageId )
{
wxListItem info;
info.m_text = label;
return TRUE;
}
-int wxListCtrl::GetItemState( long item, long stateMask ) const
+int wxGenericListCtrl::GetItemState( long item, long stateMask ) const
{
return m_mainWin->GetItemState( item, stateMask );
}
-bool wxListCtrl::SetItemState( long item, long state, long stateMask )
+bool wxGenericListCtrl::SetItemState( long item, long state, long stateMask )
{
m_mainWin->SetItemState( item, state, stateMask );
return TRUE;
}
-bool wxListCtrl::SetItemImage( long item, int image, int WXUNUSED(selImage) )
+bool wxGenericListCtrl::SetItemImage( long item, int image, int WXUNUSED(selImage) )
{
wxListItem info;
info.m_image = image;
return TRUE;
}
-wxString wxListCtrl::GetItemText( long item ) const
+wxString wxGenericListCtrl::GetItemText( long item ) const
{
- wxListItem info;
- info.m_itemId = item;
- m_mainWin->GetItem( info );
- return info.m_text;
+ return m_mainWin->GetItemText(item);
}
-void wxListCtrl::SetItemText( long item, const wxString &str )
+void wxGenericListCtrl::SetItemText( long item, const wxString& str )
{
- wxListItem info;
- info.m_mask = wxLIST_MASK_TEXT;
- info.m_itemId = item;
- info.m_text = str;
- m_mainWin->SetItem( info );
+ m_mainWin->SetItemText(item, str);
}
-long wxListCtrl::GetItemData( long item ) const
+long wxGenericListCtrl::GetItemData( long item ) const
{
wxListItem info;
info.m_itemId = item;
return info.m_data;
}
-bool wxListCtrl::SetItemData( long item, long data )
+bool wxGenericListCtrl::SetItemData( long item, long data )
{
wxListItem info;
info.m_mask = wxLIST_MASK_DATA;
return TRUE;
}
-bool wxListCtrl::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 );
return TRUE;
}
-bool wxListCtrl::GetItemPosition( long item, wxPoint& pos ) const
+bool wxGenericListCtrl::GetItemPosition( long item, wxPoint& pos ) const
{
m_mainWin->GetItemPosition( item, pos );
return TRUE;
}
-bool wxListCtrl::SetItemPosition( long WXUNUSED(item), const wxPoint& WXUNUSED(pos) )
+bool wxGenericListCtrl::SetItemPosition( long WXUNUSED(item), const wxPoint& WXUNUSED(pos) )
{
return 0;
}
-int wxListCtrl::GetItemCount() const
+int wxGenericListCtrl::GetItemCount() const
{
return m_mainWin->GetItemCount();
}
-int wxListCtrl::GetColumnCount() const
+int wxGenericListCtrl::GetColumnCount() const
{
return m_mainWin->GetColumnCount();
}
-void wxListCtrl::SetItemSpacing( int spacing, bool isSmall )
+void wxGenericListCtrl::SetItemSpacing( int spacing, bool isSmall )
{
m_mainWin->SetItemSpacing( spacing, isSmall );
}
-int wxListCtrl::GetItemSpacing( bool isSmall ) const
+int wxGenericListCtrl::GetItemSpacing( bool isSmall ) const
{
return m_mainWin->GetItemSpacing( isSmall );
}
-int wxListCtrl::GetSelectedItemCount() const
+void wxGenericListCtrl::SetItemTextColour( long item, const wxColour &col )
+{
+ wxListItem info;
+ info.m_itemId = item;
+ info.SetTextColour( col );
+ m_mainWin->SetItem( info );
+}
+
+wxColour wxGenericListCtrl::GetItemTextColour( long item ) const
+{
+ wxListItem info;
+ info.m_itemId = item;
+ m_mainWin->GetItem( info );
+ return info.GetTextColour();
+}
+
+void wxGenericListCtrl::SetItemBackgroundColour( long item, const wxColour &col )
+{
+ wxListItem info;
+ info.m_itemId = item;
+ info.SetBackgroundColour( col );
+ m_mainWin->SetItem( info );
+}
+
+wxColour wxGenericListCtrl::GetItemBackgroundColour( long item ) const
+{
+ wxListItem info;
+ info.m_itemId = item;
+ m_mainWin->GetItem( info );
+ return info.GetBackgroundColour();
+}
+
+int wxGenericListCtrl::GetSelectedItemCount() const
{
return m_mainWin->GetSelectedItemCount();
}
-wxColour wxListCtrl::GetTextColour() const
+wxColour wxGenericListCtrl::GetTextColour() const
{
return GetForegroundColour();
}
-void wxListCtrl::SetTextColour(const wxColour& col)
+void wxGenericListCtrl::SetTextColour(const wxColour& col)
{
SetForegroundColour(col);
}
-long wxListCtrl::GetTopItem() const
+long wxGenericListCtrl::GetTopItem() const
{
return 0;
}
-long wxListCtrl::GetNextItem( long item, int geom, int state ) const
+long wxGenericListCtrl::GetNextItem( long item, int geom, int state ) const
{
return m_mainWin->GetNextItem( item, geom, state );
}
-wxImageList *wxListCtrl::GetImageList(int which) const
+wxGenericImageList *wxGenericListCtrl::GetImageList(int which) const
{
if (which == wxIMAGE_LIST_NORMAL)
{
{
return m_imageListState;
}
- return (wxImageList *) NULL;
+ return (wxGenericImageList *) NULL;
}
-void wxListCtrl::SetImageList( wxImageList *imageList, int which )
+void wxGenericListCtrl::SetImageList( wxGenericImageList *imageList, int which )
{
if ( which == wxIMAGE_LIST_NORMAL )
{
m_mainWin->SetImageList( imageList, which );
}
-void wxListCtrl::AssignImageList(wxImageList *imageList, int which)
+void wxGenericListCtrl::AssignImageList(wxGenericImageList *imageList, int which)
{
SetImageList(imageList, which);
if ( which == wxIMAGE_LIST_NORMAL )
m_ownsImageListState = TRUE;
}
-bool wxListCtrl::Arrange( int WXUNUSED(flag) )
+bool wxGenericListCtrl::Arrange( int WXUNUSED(flag) )
{
return 0;
}
-bool wxListCtrl::DeleteItem( long item )
+bool wxGenericListCtrl::DeleteItem( long item )
{
m_mainWin->DeleteItem( item );
return TRUE;
}
-bool wxListCtrl::DeleteAllItems()
+bool wxGenericListCtrl::DeleteAllItems()
{
m_mainWin->DeleteAllItems();
return TRUE;
}
-bool wxListCtrl::DeleteAllColumns()
+bool wxGenericListCtrl::DeleteAllColumns()
{
size_t count = m_mainWin->m_columns.GetCount();
for ( size_t n = 0; n < count; n++ )
return TRUE;
}
-void wxListCtrl::ClearAll()
+void wxGenericListCtrl::ClearAll()
{
m_mainWin->DeleteEverything();
}
-bool wxListCtrl::DeleteColumn( int col )
+bool wxGenericListCtrl::DeleteColumn( int col )
{
m_mainWin->DeleteColumn( col );
+
+ // if we don't have the header any longer, we need to relayout the window
+ if ( !GetColumnCount() )
+ {
+ ResizeReportView(FALSE /* no header */);
+ }
+
return TRUE;
}
-void wxListCtrl::Edit( long item )
+void wxGenericListCtrl::Edit( long item )
{
m_mainWin->EditLabel( item );
}
-bool wxListCtrl::EnsureVisible( long item )
+bool wxGenericListCtrl::EnsureVisible( long item )
{
m_mainWin->EnsureVisible( item );
return TRUE;
}
-long wxListCtrl::FindItem( long start, const wxString& str, bool partial )
+long wxGenericListCtrl::FindItem( long start, const wxString& str, bool partial )
{
return m_mainWin->FindItem( start, str, partial );
}
-long wxListCtrl::FindItem( long start, long data )
+long wxGenericListCtrl::FindItem( long start, long data )
{
return m_mainWin->FindItem( start, data );
}
-long wxListCtrl::FindItem( long WXUNUSED(start), const wxPoint& WXUNUSED(pt),
+long wxGenericListCtrl::FindItem( long WXUNUSED(start), const wxPoint& WXUNUSED(pt),
int WXUNUSED(direction))
{
return 0;
}
-long wxListCtrl::HitTest( const wxPoint &point, int &flags )
+long wxGenericListCtrl::HitTest( const wxPoint &point, int &flags )
{
return m_mainWin->HitTest( (int)point.x, (int)point.y, flags );
}
-long wxListCtrl::InsertItem( wxListItem& info )
+long wxGenericListCtrl::InsertItem( wxListItem& info )
{
m_mainWin->InsertItem( info );
return info.m_itemId;
}
-long wxListCtrl::InsertItem( long index, const wxString &label )
+long wxGenericListCtrl::InsertItem( long index, const wxString &label )
{
wxListItem info;
info.m_text = label;
return InsertItem( info );
}
-long wxListCtrl::InsertItem( long index, int imageIndex )
+long wxGenericListCtrl::InsertItem( long index, int imageIndex )
{
wxListItem info;
info.m_mask = wxLIST_MASK_IMAGE;
return InsertItem( info );
}
-long wxListCtrl::InsertItem( long index, const wxString &label, int imageIndex )
+long wxGenericListCtrl::InsertItem( long index, const wxString &label, int imageIndex )
{
wxListItem info;
info.m_text = label;
return InsertItem( info );
}
-long wxListCtrl::InsertColumn( long col, wxListItem &item )
+long wxGenericListCtrl::InsertColumn( long col, wxListItem &item )
{
- wxASSERT( m_headerWin );
+ wxCHECK_MSG( m_headerWin, -1, _T("can't add column in non report mode") );
+
m_mainWin->InsertColumn( col, item );
+
+ // if we hadn't had header before and have it now we need to relayout the
+ // window
+ if ( GetColumnCount() == 1 )
+ {
+ ResizeReportView(TRUE /* have header */);
+ }
+
m_headerWin->Refresh();
return 0;
}
-long wxListCtrl::InsertColumn( long col, const wxString &heading,
+long wxGenericListCtrl::InsertColumn( long col, const wxString &heading,
int format, int width )
{
wxListItem item;
return InsertColumn( col, item );
}
-bool wxListCtrl::ScrollList( int WXUNUSED(dx), int WXUNUSED(dy) )
+bool wxGenericListCtrl::ScrollList( int WXUNUSED(dx), int WXUNUSED(dy) )
{
return 0;
}
// or zero if the two items are equivalent.
// data is arbitrary data to be passed to the sort function.
-bool wxListCtrl::SortItems( wxListCtrlCompare fn, long data )
+bool wxGenericListCtrl::SortItems( wxListCtrlCompare fn, long data )
{
m_mainWin->SortItems( fn, data );
return TRUE;
// event handlers
// ----------------------------------------------------------------------------
-void wxListCtrl::OnSize(wxSizeEvent& event)
+void wxGenericListCtrl::OnSize(wxSizeEvent& WXUNUSED(event))
{
if ( !m_mainWin )
return;
m_mainWin->RecalculatePositions();
}
-void wxListCtrl::ResizeReportView(bool showHeader)
+void wxGenericListCtrl::ResizeReportView(bool showHeader)
{
int cw, ch;
GetClientSize( &cw, &ch );
}
}
-void wxListCtrl::OnIdle( wxIdleEvent & event )
+void wxGenericListCtrl::OnIdle( wxIdleEvent & event )
{
event.Skip();
// font/colours
// ----------------------------------------------------------------------------
-bool wxListCtrl::SetBackgroundColour( const wxColour &colour )
+bool wxGenericListCtrl::SetBackgroundColour( const wxColour &colour )
{
if (m_mainWin)
{
return TRUE;
}
-bool wxListCtrl::SetForegroundColour( const wxColour &colour )
+bool wxGenericListCtrl::SetForegroundColour( const wxColour &colour )
{
if ( !wxWindow::SetForegroundColour( colour ) )
return FALSE;
return TRUE;
}
-bool wxListCtrl::SetFont( const wxFont &font )
+bool wxGenericListCtrl::SetFont( const wxFont &font )
{
if ( !wxWindow::SetFont( font ) )
return FALSE;
#if wxUSE_DRAG_AND_DROP
-void wxListCtrl::SetDropTarget( wxDropTarget *dropTarget )
+void wxGenericListCtrl::SetDropTarget( wxDropTarget *dropTarget )
{
m_mainWin->SetDropTarget( dropTarget );
}
-wxDropTarget *wxListCtrl::GetDropTarget() const
+wxDropTarget *wxGenericListCtrl::GetDropTarget() const
{
return m_mainWin->GetDropTarget();
}
#endif // wxUSE_DRAG_AND_DROP
-bool wxListCtrl::SetCursor( const wxCursor &cursor )
+bool wxGenericListCtrl::SetCursor( const wxCursor &cursor )
{
return m_mainWin ? m_mainWin->wxWindow::SetCursor(cursor) : FALSE;
}
-wxColour wxListCtrl::GetBackgroundColour() const
+wxColour wxGenericListCtrl::GetBackgroundColour() const
{
return m_mainWin ? m_mainWin->GetBackgroundColour() : wxColour();
}
-wxColour wxListCtrl::GetForegroundColour() const
+wxColour wxGenericListCtrl::GetForegroundColour() const
{
return m_mainWin ? m_mainWin->GetForegroundColour() : wxColour();
}
-bool wxListCtrl::DoPopupMenu( wxMenu *menu, int x, int y )
+bool wxGenericListCtrl::DoPopupMenu( wxMenu *menu, int x, int y )
{
#if wxUSE_MENUS
return m_mainWin->PopupMenu( menu, x, y );
#endif // wxUSE_MENUS
}
-void wxListCtrl::SetFocus()
+void wxGenericListCtrl::SetFocus()
{
/* The test in window.cpp fails as we are a composite
window, so it checks against "this", but not m_mainWin. */
// virtual list control support
// ----------------------------------------------------------------------------
-wxString wxListCtrl::OnGetItemText(long item, long col) const
+wxString wxGenericListCtrl::OnGetItemText(long WXUNUSED(item), long WXUNUSED(col)) const
{
// this is a pure virtual function, in fact - which is not really pure
// because the controls which are not virtual don't need to implement it
- wxFAIL_MSG( _T("not supposed to be called") );
+ wxFAIL_MSG( _T("wxGenericListCtrl::OnGetItemText not supposed to be called") );
return wxEmptyString;
}
-int wxListCtrl::OnGetItemImage(long item) const
+int wxGenericListCtrl::OnGetItemImage(long WXUNUSED(item)) const
{
// same as above
- wxFAIL_MSG( _T("not supposed to be called") );
+ wxFAIL_MSG( _T("wxGenericListCtrl::OnGetItemImage not supposed to be called") );
return -1;
}
-wxListItemAttr *wxListCtrl::OnGetItemAttr(long item) const
+wxListItemAttr *wxGenericListCtrl::OnGetItemAttr(long item) const
{
wxASSERT_MSG( item >= 0 && item < GetItemCount(),
_T("invalid item index in OnGetItemAttr()") );
return NULL;
}
-void wxListCtrl::SetItemCount(long count)
+void wxGenericListCtrl::SetItemCount(long count)
{
wxASSERT_MSG( IsVirtual(), _T("this is for virtual controls only") );
m_mainWin->SetItemCount(count);
}
-void wxListCtrl::RefreshItem(long item)
+void wxGenericListCtrl::RefreshItem(long item)
{
m_mainWin->RefreshLine(item);
}
-void wxListCtrl::RefreshItems(long itemFrom, long itemTo)
+void wxGenericListCtrl::RefreshItems(long itemFrom, long itemTo)
{
m_mainWin->RefreshLines(itemFrom, itemTo);
}
-void wxListCtrl::Freeze()
+void wxGenericListCtrl::Freeze()
{
m_mainWin->Freeze();
}
-void wxListCtrl::Thaw()
+void wxGenericListCtrl::Thaw()
{
m_mainWin->Thaw();
}
#endif // wxUSE_LISTCTRL
+