add wxEVT_COMMAND_HEADER_SEPARATOR_DCLICK and semi-automatic header resizing support
[wxWidgets.git] / include / wx / msw / headerctrl.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/headerctrl.h
3 // Purpose: wxMSW native wxHeaderCtrl
4 // Author: Vadim Zeitlin
5 // Created: 2008-12-01
6 // RCS-ID: $Id$
7 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_MSW_HEADERCTRL_H_
12 #define _WX_MSW_HEADERCTRL_H_
13
14 class WXDLLIMPEXP_FWD_CORE wxImageList;
15
16 // ----------------------------------------------------------------------------
17 // wxHeaderCtrl
18 // ----------------------------------------------------------------------------
19
20 class WXDLLIMPEXP_CORE wxHeaderCtrl : public wxHeaderCtrlBase
21 {
22 public:
23 wxHeaderCtrl()
24 {
25 Init();
26 }
27
28 wxHeaderCtrl(wxWindow *parent,
29 wxWindowID id = wxID_ANY,
30 const wxPoint& pos = wxDefaultPosition,
31 const wxSize& size = wxDefaultSize,
32 long style = wxHD_DEFAULT_STYLE,
33 const wxString& name = wxHeaderCtrlNameStr)
34 {
35 Init();
36
37 Create(parent, id, pos, size, style, name);
38 }
39
40 bool Create(wxWindow *parent,
41 wxWindowID id = wxID_ANY,
42 const wxPoint& pos = wxDefaultPosition,
43 const wxSize& size = wxDefaultSize,
44 long style = wxHD_DEFAULT_STYLE,
45 const wxString& name = wxHeaderCtrlNameStr);
46
47 virtual ~wxHeaderCtrl();
48
49
50 private:
51 // implement base class pure virtuals
52 virtual void DoSetCount(unsigned int count);
53 virtual unsigned int DoGetCount() const;
54 virtual void DoUpdate(unsigned int idx);
55
56 virtual void DoScrollHorz(int dx);
57
58 // override wxWindow methods which must be implemented by a new control
59 virtual wxSize DoGetBestSize() const;
60
61 // override MSW-specific methods needed for new control
62 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
63 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
64
65 // common part of all ctors
66 void Init();
67
68 // wrapper around Header_{Set,Insert}Item(): either appends the item to the
69 // end or modifies the existing item by copying information from
70 // GetColumn(idx) to it
71 enum Operation { Set, Insert };
72 void DoSetOrInsertItem(Operation oper, unsigned int idx);
73
74 // send an event of the given type for the given column, return true if it
75 // was processed
76 bool SendEvent(wxEventType evtType, unsigned int idx);
77
78 // send a click or double click event (depending on dblclk value) for the
79 // click with the given button on the given item
80 bool SendClickEvent(bool dblclk, int button, unsigned int idx);
81
82
83 // the image list: initially NULL, created on demand
84 wxImageList *m_imageList;
85
86 DECLARE_NO_COPY_CLASS(wxHeaderCtrl)
87 };
88
89 #endif // _WX_MSW_HEADERCTRL_H_
90