From 26df5dd39a8c09397b19cd98ea51600af5a1dea4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 7 Jan 2012 15:09:34 +0000 Subject: [PATCH] Add wxListCtrlBase common base class for port-specific wxListCtrl. This base class is currently trivial, more methods will be moved to it from the derived classes later. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70280 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/listctrl.h | 2 +- include/wx/listbase.h | 14 ++++++++++++++ include/wx/msw/listctrl.h | 2 +- include/wx/osx/listctrl.h | 2 +- src/generic/listctrl.cpp | 12 +++++++----- src/msw/listctrl.cpp | 20 ++++++++++---------- src/osx/carbon/listctrl_mac.cpp | 10 +++++----- 7 files changed, 39 insertions(+), 23 deletions(-) diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index f2db368a54..63de1ff1ac 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -31,7 +31,7 @@ class WXDLLIMPEXP_FWD_CORE wxListMainWindow; // wxListCtrl //----------------------------------------------------------------------------- -class WXDLLIMPEXP_CORE wxGenericListCtrl: public wxControl, +class WXDLLIMPEXP_CORE wxGenericListCtrl: public wxListCtrlBase, public wxScrollHelper { public: diff --git a/include/wx/listbase.h b/include/wx/listbase.h index 237c593f06..8246ad83c8 100644 --- a/include/wx/listbase.h +++ b/include/wx/listbase.h @@ -371,6 +371,20 @@ private: DECLARE_DYNAMIC_CLASS(wxListItem) }; +// ---------------------------------------------------------------------------- +// wxListCtrlBase: the base class for the main control itself. +// ---------------------------------------------------------------------------- + +// Unlike other base classes, this class doesn't currently define the API of +// the real control class but is just used for implementation convenience. We +// should define the public class functions as pure virtual here in the future +// however. +class WXDLLIMPEXP_CORE wxListCtrlBase : public wxControl +{ +public: + wxListCtrlBase() { } +}; + // ---------------------------------------------------------------------------- // wxListEvent - the event class for the wxListCtrl notifications // ---------------------------------------------------------------------------- diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 172197bf62..dd11f1e4a4 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -77,7 +77,7 @@ class wxMSWListItemData; */ -class WXDLLIMPEXP_CORE wxListCtrl: public wxControl +class WXDLLIMPEXP_CORE wxListCtrl: public wxListCtrlBase { public: /* diff --git a/include/wx/osx/listctrl.h b/include/wx/osx/listctrl.h index 9f9f7f3f60..681775f0ca 100644 --- a/include/wx/osx/listctrl.h +++ b/include/wx/osx/listctrl.h @@ -23,7 +23,7 @@ class wxListCtrlRenameTimer; WX_DECLARE_EXPORTED_LIST(wxListItem, wxColumnList); -class WXDLLIMPEXP_CORE wxListCtrl: public wxControl +class WXDLLIMPEXP_CORE wxListCtrl: public wxListCtrlBase { DECLARE_DYNAMIC_CLASS(wxListCtrl) public: diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index dffb7e1bf7..49d023895b 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -4300,7 +4300,7 @@ void wxListMainWindow::GetVisibleLinesRange(size_t *from, size_t *to) IMPLEMENT_DYNAMIC_CLASS(wxGenericListCtrl, wxControl) -BEGIN_EVENT_TABLE(wxGenericListCtrl,wxControl) +BEGIN_EVENT_TABLE(wxGenericListCtrl,wxListCtrlBase) EVT_SIZE(wxGenericListCtrl::OnSize) EVT_SCROLLWIN(wxGenericListCtrl::OnScroll) END_EVENT_TABLE() @@ -4380,7 +4380,9 @@ bool wxGenericListCtrl::Create(wxWindow *parent, wxASSERT_MSG( (style & wxLC_MASK_TYPE), wxT("wxListCtrl style should have exactly one mode bit set") ); - if ( !wxControl::Create( parent, id, pos, size, style|wxVSCROLL|wxHSCROLL, validator, name ) ) + if ( !wxListCtrlBase::Create( parent, id, pos, size, + style | wxVSCROLL | wxHSCROLL, + validator, name ) ) return false; #ifdef __WXGTK__ @@ -4418,7 +4420,7 @@ WXLRESULT wxGenericListCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { - WXLRESULT rc = wxControl::MSWWindowProc(nMsg, wParam, lParam); + WXLRESULT rc = wxListCtrlBase::MSWWindowProc(nMsg, wParam, lParam); // we need to process arrows ourselves for scrolling if ( nMsg == WM_GETDLGCODE ) @@ -5145,7 +5147,7 @@ void wxGenericListCtrl::DoClientToScreen( int *x, int *y ) const if ( m_mainWin ) m_mainWin->DoClientToScreen(x, y); else - wxControl::DoClientToScreen(x, y); + wxListCtrlBase::DoClientToScreen(x, y); } void wxGenericListCtrl::DoScreenToClient( int *x, int *y ) const @@ -5155,7 +5157,7 @@ void wxGenericListCtrl::DoScreenToClient( int *x, int *y ) const if ( m_mainWin ) m_mainWin->DoScreenToClient(x, y); else - wxControl::DoScreenToClient(x, y); + wxListCtrlBase::DoScreenToClient(x, y); } void wxGenericListCtrl::SetFocus() diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 6c29d0ea06..45e1d0c503 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -226,7 +226,7 @@ public: wxDECLARE_NO_COPY_CLASS(wxMSWListItemData); }; -BEGIN_EVENT_TABLE(wxListCtrl, wxControl) +BEGIN_EVENT_TABLE(wxListCtrl, wxListCtrlBase) EVT_PAINT(wxListCtrl::OnPaint) EVT_CHAR_HOOK(wxListCtrl::OnCharHook) END_EVENT_TABLE() @@ -309,7 +309,7 @@ void wxListCtrl::MSWSetExListStyles() WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const { - WXDWORD wstyle = wxControl::MSWGetStyle(style, exstyle); + WXDWORD wstyle = wxListCtrlBase::MSWGetStyle(style, exstyle); wstyle |= LVS_SHAREIMAGELISTS | LVS_SHOWSELALWAYS; @@ -478,7 +478,7 @@ void wxListCtrl::SetWindowStyleFlag(long flag) { if ( flag != m_windowStyle ) { - wxControl::SetWindowStyleFlag(flag); + wxListCtrlBase::SetWindowStyleFlag(flag); UpdateStyle(); @@ -1862,7 +1862,7 @@ bool wxListCtrl::MSWShouldPreProcessMessage(WXMSG* msg) return false; } } - return wxControl::MSWShouldPreProcessMessage(msg); + return wxListCtrlBase::MSWShouldPreProcessMessage(msg); } bool wxListCtrl::MSWCommand(WXUINT cmd, WXWORD id_) @@ -2047,7 +2047,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) } if ( ignore ) - return wxControl::MSWOnNotify(idCtrl, lParam, result); + return wxListCtrlBase::MSWOnNotify(idCtrl, lParam, result); } else #endif // defined(HDN_BEGINTRACKA) @@ -2275,7 +2275,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) case NM_DBLCLK: // if the user processes it in wxEVT_COMMAND_LEFT_CLICK(), don't do // anything else - if ( wxControl::MSWOnNotify(idCtrl, lParam, result) ) + if ( wxListCtrlBase::MSWOnNotify(idCtrl, lParam, result) ) { return true; } @@ -2300,7 +2300,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) case NM_RCLICK: // if the user processes it in wxEVT_COMMAND_RIGHT_CLICK(), // don't do anything else - if ( wxControl::MSWOnNotify(idCtrl, lParam, result) ) + if ( wxListCtrlBase::MSWOnNotify(idCtrl, lParam, result) ) { return true; } @@ -2513,7 +2513,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) } if ( !processed ) - return wxControl::MSWOnNotify(idCtrl, lParam, result); + return wxListCtrlBase::MSWOnNotify(idCtrl, lParam, result); } else { @@ -2903,7 +2903,7 @@ void wxListCtrl::OnPaint(wxPaintEvent& event) wxPaintDC dc(this); - wxControl::OnPaint(event); + wxListCtrlBase::OnPaint(event); // Reset the device origin since it may have been set dc.SetDeviceOrigin(0, 0); @@ -3022,7 +3022,7 @@ wxListCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) //else: break } - return wxControl::MSWWindowProc(nMsg, wParam, lParam); + return wxListCtrlBase::MSWWindowProc(nMsg, wParam, lParam); } // ---------------------------------------------------------------------------- diff --git a/src/osx/carbon/listctrl_mac.cpp b/src/osx/carbon/listctrl_mac.cpp index fcb9796ec0..96d9a10738 100644 --- a/src/osx/carbon/listctrl_mac.cpp +++ b/src/osx/carbon/listctrl_mac.cpp @@ -775,7 +775,7 @@ void wxListCtrl::SetWindowStyleFlag(long flag) void wxListCtrl::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { - wxControl::DoSetSize(x, y, width, height, sizeFlags); + wxListCtrlBase::DoSetSize(x, y, width, height, sizeFlags); if (m_genericImpl) m_genericImpl->SetSize(0, 0, width, height, sizeFlags); @@ -809,7 +809,7 @@ wxSize wxListCtrl::DoGetBestSize() const bool wxListCtrl::SetFont(const wxFont& font) { bool rv = true; - rv = wxControl::SetFont(font); + rv = wxListCtrlBase::SetFont(font); if (m_genericImpl) rv = m_genericImpl->SetFont(font); return rv; @@ -849,21 +849,21 @@ void wxListCtrl::Freeze () { if (m_genericImpl) m_genericImpl->Freeze(); - wxControl::Freeze(); + wxListCtrlBase::Freeze(); } void wxListCtrl::Thaw () { if (m_genericImpl) m_genericImpl->Thaw(); - wxControl::Thaw(); + wxListCtrlBase::Thaw(); } void wxListCtrl::Update () { if (m_genericImpl) m_genericImpl->Update(); - wxControl::Update(); + wxListCtrlBase::Update(); } // ---------------------------------------------------------------------------- -- 2.45.2