extract (and expand and clean up and document) the header window implementation used inside the generic wxDataViewCtrl in a separate wxHeaderCtrl class which could be reused in (generic) wxListCtrl and, most importantly, wxGrid later
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57093 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
77
include/wx/msw/headercol.h
Normal file
77
include/wx/msw/headercol.h
Normal file
@@ -0,0 +1,77 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/headercol.h
|
||||
// Purpose: wxHeaderColumn implementation for MSW
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2008-12-02
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MSW_HEADERCOL_H_
|
||||
#define _WX_MSW_HEADERCOL_H_
|
||||
|
||||
struct wxHDITEM;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxHeaderColumn
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxHeaderColumn : public wxHeaderColumnBase
|
||||
{
|
||||
public:
|
||||
// ctors and dtor
|
||||
wxHeaderColumn(const wxString& title,
|
||||
int width = wxCOL_WIDTH_DEFAULT,
|
||||
wxAlignment align = wxALIGN_NOT,
|
||||
int flags = wxCOL_DEFAULT_FLAGS);
|
||||
wxHeaderColumn(const wxBitmap &bitmap,
|
||||
int width = wxCOL_WIDTH_DEFAULT,
|
||||
wxAlignment align = wxALIGN_CENTER,
|
||||
int flags = wxCOL_DEFAULT_FLAGS);
|
||||
|
||||
virtual ~wxHeaderColumn();
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual void SetTitle(const wxString& title);
|
||||
virtual wxString GetTitle() const;
|
||||
|
||||
virtual void SetBitmap(const wxBitmap& bitmap);
|
||||
wxBitmap GetBitmap() const;
|
||||
|
||||
virtual void SetWidth(int width);
|
||||
virtual int GetWidth() const;
|
||||
|
||||
virtual void SetMinWidth(int minWidth);
|
||||
virtual int GetMinWidth() const;
|
||||
|
||||
virtual void SetAlignment(wxAlignment align);
|
||||
virtual wxAlignment GetAlignment() const;
|
||||
|
||||
virtual void SetClientData(wxUIntPtr data);
|
||||
virtual wxUIntPtr GetClientData() const;
|
||||
|
||||
virtual void SetFlags(int flags);
|
||||
virtual int GetFlags() const;
|
||||
|
||||
|
||||
virtual void SetSortOrder(bool ascending);
|
||||
virtual bool IsSortOrderAscending() const;
|
||||
|
||||
|
||||
// MSW-specific implementation helpers
|
||||
wxHDITEM& GetHDI();
|
||||
const wxHDITEM& GetHDI() const
|
||||
{
|
||||
return const_cast<wxHeaderColumn *>(this)->GetHDI();
|
||||
}
|
||||
|
||||
private:
|
||||
// initialize m_impl
|
||||
void Init();
|
||||
|
||||
struct wxMSWHeaderColumnImpl *m_impl;
|
||||
};
|
||||
|
||||
#endif // _WX_MSW_HEADERCOL_H_
|
||||
|
72
include/wx/msw/headerctrl.h
Normal file
72
include/wx/msw/headerctrl.h
Normal file
@@ -0,0 +1,72 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/msw/headerctrl.h
|
||||
// Purpose: wxMSW native wxHeaderCtrl
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2008-12-01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MSW_HEADERCTRL_H_
|
||||
#define _WX_MSW_HEADERCTRL_H_
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxImageList;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxHeaderCtrl
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxHeaderCtrl : public wxHeaderCtrlBase
|
||||
{
|
||||
public:
|
||||
wxHeaderCtrl()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
wxHeaderCtrl(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxHD_DEFAULT_STYLE,
|
||||
const wxString& name = wxHeaderCtrlNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxHD_DEFAULT_STYLE,
|
||||
const wxString& name = wxHeaderCtrlNameStr);
|
||||
|
||||
virtual ~wxHeaderCtrl();
|
||||
|
||||
private:
|
||||
// implement base class pure virtuals
|
||||
virtual unsigned int DoGetCount() const;
|
||||
virtual void DoInsert(const wxHeaderColumn& col, unsigned int idx);
|
||||
virtual void DoDelete(unsigned int idx);
|
||||
virtual void DoShowSortIndicator(unsigned int idx, int sortOrder);
|
||||
|
||||
// override wxWindow methods which must be implemented by a new control
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// override MSW-specific methods needed for new control
|
||||
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// the image list: initially NULL, created on demand
|
||||
wxImageList *m_imageList;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHeaderCtrl)
|
||||
};
|
||||
|
||||
#endif // _WX_MSW_HEADERCTRL_H_
|
||||
|
@@ -359,9 +359,13 @@ typedef struct _OSVERSIONINFOEX {
|
||||
#define NMHEADER HD_NOTIFY
|
||||
#endif
|
||||
|
||||
#ifndef HDS_FULLDRAG
|
||||
#define HDS_FULLDRAG 128
|
||||
#ifndef HDS_DRAGDROP
|
||||
#define HDS_DRAGDROP 0x0040
|
||||
#endif
|
||||
#ifndef HDS_FULLDRAG
|
||||
#define HDS_FULLDRAG 0x0080
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HDN_BEGINDRAG
|
||||
#define HDN_BEGINDRAG (HDN_FIRST - 11)
|
||||
|
@@ -242,8 +242,10 @@ private:
|
||||
// the common part of all ctors
|
||||
void Init();
|
||||
|
||||
// helper functions
|
||||
// helper functions: DoGetItem() doesn't work for hidden virtual root item
|
||||
// while DoGetPossiblyRootItem() does
|
||||
bool DoGetItem(wxTreeViewItem *tvItem) const;
|
||||
bool DoGetPossiblyRootItem(wxTreeViewItem *tvItem) const;
|
||||
void DoSetItem(wxTreeViewItem *tvItem);
|
||||
|
||||
void DoExpand(const wxTreeItemId& item, int flag);
|
||||
|
@@ -35,6 +35,17 @@ inline void wxSetCCUnicodeFormat(HWND WXUNUSED_IN_WINCE(hwnd))
|
||||
// this is implemented in msw/settings.cpp
|
||||
class wxFont;
|
||||
extern wxFont wxGetCCDefaultFont();
|
||||
#endif
|
||||
|
||||
// this is just a wrapper for HDITEM which we can't use in the public header
|
||||
// because we don't want to include commctrl.h (and hence windows.h) from there
|
||||
struct wxHDITEM : public HDITEM
|
||||
{
|
||||
wxHDITEM()
|
||||
{
|
||||
::ZeroMemory(this, sizeof(*this));
|
||||
}
|
||||
};
|
||||
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
#endif // _WX_MSW_WRAPCCTL_H_
|
||||
|
Reference in New Issue
Block a user