#if wxUSE_LISTCTRL
-// under Win32 we always use the native version and also may use the generic
-// one, however some things should be done only if we use only the generic
-// version
-#if defined(__WIN32__) && !defined(__WXUNIVERSAL__)
- #define HAVE_NATIVE_LISTCTRL
-#endif
-
-// if we have the native control, wx/listctrl.h declares it and not this one
-#ifdef HAVE_NATIVE_LISTCTRL
- #include "wx/generic/listctrl.h"
-#else // !HAVE_NATIVE_LISTCTRL
- #include "wx/listctrl.h"
+#include "wx/listctrl.h"
+#if (!defined(__WXMSW__) || defined(__WXUNIVERSAL__)) && !defined(__WXMAC__)
// if we have a native version, its implementation file does all this
IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxListView, wxListCtrl)
IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxNotifyEvent)
IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxGenericListCtrl)
-#endif // HAVE_NATIVE_LISTCTRL/!HAVE_NATIVE_LISTCTRL
+#endif
#ifndef WX_PRECOMP
+ #include "wx/scrolwin.h"
+ #include "wx/timer.h"
+ #include "wx/settings.h"
#include "wx/dynarray.h"
- #include "wx/app.h"
+ #include "wx/dcclient.h"
#include "wx/dcscreen.h"
- #include "wx/textctrl.h"
- #include "wx/listbox.h"
#include "wx/math.h"
#endif
+#include "wx/imaglist.h"
#include "wx/selstore.h"
#include "wx/renderer.h"
#define _USE_VISATTR 0
-// ----------------------------------------------------------------------------
-// events
-// ----------------------------------------------------------------------------
-
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_DRAG)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_RDRAG)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS)
-#if WXWIN_COMPATIBILITY_2_4
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_GET_INFO)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_INFO)
-#endif
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_SELECTED)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_INSERT_ITEM)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_CLICK)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_RIGHT_CLICK)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_DRAGGING)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_END_DRAG)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_ACTIVATED)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_FOCUSED)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_CACHE_HINT)
-
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
void GetImageSize( int index, int &width, int &height ) const;
int GetTextLength( const wxString &s ) const;
- void SetImageList( wxImageListType *imageList, int which );
+ void SetImageList( wxImageList *imageList, int which );
void SetItemSpacing( int spacing, bool isSmall = false );
int GetItemSpacing( bool isSmall = false );
bool m_dirty;
wxColour *m_highlightColour;
- wxImageListType *m_small_image_list;
- wxImageListType *m_normal_image_list;
+ wxImageList *m_small_image_list;
+ wxImageList *m_normal_image_list;
int m_small_spacing;
int m_normal_spacing;
bool m_hasFocus;
{
wxCHECK_MSG( m_rect, false, _T("can't be called in this mode") );
- return wxRect(GetX(), GetY(), GetWidth(), GetHeight()).Inside(x, y);
+ return wxRect(GetX(), GetY(), GetWidth(), GetHeight()).Contains(x, y);
}
int wxListItemData::GetX() const
int xpix;
m_owner->GetScrollPixelsPerUnit( &xpix, NULL );
- int x;
- m_owner->GetViewStart( &x, NULL );
+ int view_start;
+ m_owner->GetViewStart( &view_start, NULL );
+
+
+ int org_x = 0;
+ int org_y = 0;
+ dc.GetDeviceOrigin( &org_x, &org_y );
// account for the horz scrollbar offset
- dc.SetDeviceOrigin( -x * xpix, 0 );
+#ifdef __WXGTK__
+ if (GetLayoutDirection() == wxLayout_RightToLeft)
+ {
+ // Maybe we just have to check for m_signX
+ // in the DC, but I leave the #ifdef __WXGTK__
+ // for now
+ dc.SetDeviceOrigin( org_x + (view_start * xpix), org_y );
+ }
+ else
+#endif
+ dc.SetDeviceOrigin( org_x - (view_start * xpix), org_y );
}
void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
static const int MARGIN_BETWEEN_TEXT_AND_ICON = 2;
int ix = 0, iy = 0; // init them just to suppress the compiler warnings
const int image = item.m_image;
- wxImageListType *imageList;
+ wxImageList *imageList;
if ( image != -1 )
{
imageList = m_owner->m_small_image_list;
m_headerWidth =
m_lineHeight = 0;
- m_small_image_list = (wxImageListType *) NULL;
- m_normal_image_list = (wxImageListType *) NULL;
+ m_small_image_list = (wxImageList *) NULL;
+ m_normal_image_list = (wxImageList *) NULL;
m_small_spacing = 30;
m_normal_spacing = 40;
wxListLineData *ld = GetLine(line);
- if ( ld->HasImage() && GetLineIconRect(line).Inside(x, y) )
+ if ( ld->HasImage() && GetLineIconRect(line).Contains(x, y) )
return wxLIST_HITTEST_ONITEMICON;
// VS: Testing for "ld->HasText() || InReportView()" instead of
wxRect rect = InReportView() ? GetLineRect(line)
: GetLineLabelRect(line);
- if ( rect.Inside(x, y) )
+ if ( rect.Contains(x, y) )
return wxLIST_HITTEST_ONITEMLABEL;
}
GetVisibleLinesRange(&visibleFrom, &visibleTo);
wxRect rectLine;
- wxCoord xOrig, yOrig;
- CalcUnscrolledPosition(0, 0, &xOrig, &yOrig);
-
+ int xOrig = dc.LogicalToDeviceX( 0 );
+ int yOrig = dc.LogicalToDeviceY( 0 );
+
// tell the caller cache to cache the data
if ( IsVirtual() )
{
{
rectLine = GetLineRect(line);
- if ( !IsExposed(rectLine.x - xOrig, rectLine.y - yOrig,
+
+ if ( !IsExposed(rectLine.x + xOrig, rectLine.y + yOrig,
rectLine.width, rectLine.height) )
{
// don't redraw unaffected lines to avoid flicker
return lw + AUTOSIZE_COL_MARGIN;
}
-void wxListMainWindow::SetImageList( wxImageListType *imageList, int which )
+void wxListMainWindow::SetImageList( wxImageList *imageList, int which )
{
m_dirty = true;
wxGenericListCtrl::wxGenericListCtrl()
{
- m_imageListNormal = (wxImageListType *) NULL;
- m_imageListSmall = (wxImageListType *) NULL;
- m_imageListState = (wxImageListType *) NULL;
+ m_imageListNormal = (wxImageList *) NULL;
+ m_imageListSmall = (wxImageList *) NULL;
+ m_imageListState = (wxImageList *) NULL;
m_ownsImageListNormal =
m_ownsImageListSmall =
{
m_imageListNormal =
m_imageListSmall =
- m_imageListState = (wxImageListType *) NULL;
+ m_imageListState = (wxImageList *) NULL;
m_ownsImageListNormal =
m_ownsImageListSmall =
m_ownsImageListState = false;
return m_mainWin->GetNextItem( item, geom, state );
}
-wxImageListType *wxGenericListCtrl::GetImageList(int which) const
+wxImageList *wxGenericListCtrl::GetImageList(int which) const
{
if (which == wxIMAGE_LIST_NORMAL)
return m_imageListNormal;
else if (which == wxIMAGE_LIST_STATE)
return m_imageListState;
- return (wxImageListType *) NULL;
+ return (wxImageList *) NULL;
}
-void wxGenericListCtrl::SetImageList( wxImageListType *imageList, int which )
+void wxGenericListCtrl::SetImageList( wxImageList *imageList, int which )
{
if ( which == wxIMAGE_LIST_NORMAL )
{
m_mainWin->SetImageList( imageList, which );
}
-void wxGenericListCtrl::AssignImageList(wxImageListType *imageList, int which)
+void wxGenericListCtrl::AssignImageList(wxImageList *imageList, int which)
{
SetImageList(imageList, which);
if ( which == wxIMAGE_LIST_NORMAL )