]>
Commit | Line | Data |
---|---|---|
b63f9a33 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/generic/headerctrlg.h | |
3 | // Purpose: Generic wxHeaderCtrl implementation | |
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_GENERIC_HEADERCTRLG_H_ | |
12 | #define _WX_GENERIC_HEADERCTRLG_H_ | |
13 | ||
14 | #include "wx/event.h" | |
15 | #include "wx/vector.h" | |
16 | ||
17 | // ---------------------------------------------------------------------------- | |
18 | // wxHeaderCtrl | |
19 | // ---------------------------------------------------------------------------- | |
20 | ||
21 | class WXDLLIMPEXP_CORE wxHeaderCtrl : public wxHeaderCtrlBase | |
22 | { | |
23 | public: | |
24 | wxHeaderCtrl() | |
25 | { | |
26 | Init(); | |
27 | } | |
28 | ||
29 | wxHeaderCtrl(wxWindow *parent, | |
30 | wxWindowID id = wxID_ANY, | |
31 | const wxPoint& pos = wxDefaultPosition, | |
32 | const wxSize& size = wxDefaultSize, | |
33 | long style = wxHD_DEFAULT_STYLE, | |
34 | const wxString& name = wxHeaderCtrlNameStr) | |
35 | { | |
36 | Init(); | |
37 | ||
38 | Create(parent, id, pos, size, style, name); | |
39 | } | |
40 | ||
41 | bool Create(wxWindow *parent, | |
42 | wxWindowID id = wxID_ANY, | |
43 | const wxPoint& pos = wxDefaultPosition, | |
44 | const wxSize& size = wxDefaultSize, | |
45 | long style = wxHD_DEFAULT_STYLE, | |
46 | const wxString& name = wxHeaderCtrlNameStr); | |
47 | ||
48 | virtual ~wxHeaderCtrl(); | |
49 | ||
50 | private: | |
51 | // implement base class pure virtuals | |
52 | virtual unsigned int DoGetCount() const; | |
53 | virtual void DoInsert(const wxHeaderColumn& col, unsigned int idx); | |
54 | virtual void DoDelete(unsigned int idx); | |
55 | virtual void DoShowColumn(unsigned int idx, bool show); | |
56 | virtual void DoShowSortIndicator(unsigned int idx, int sortOrder); | |
57 | virtual void DoScrollHorz(int dx); | |
58 | ||
59 | // override wxWindow methods which must be implemented by a new control | |
60 | virtual wxSize DoGetBestSize() const; | |
61 | ||
62 | // common part of all ctors | |
63 | void Init(); | |
64 | ||
65 | // event handlers | |
66 | void OnPaint(wxPaintEvent& event); | |
67 | void OnMouse(wxMouseEvent& event); | |
68 | ||
69 | // return the horizontal start position of the given column | |
70 | int GetColStart(unsigned int idx) const; | |
71 | ||
72 | // refresh the given column [only] | |
73 | void RefreshCol(unsigned int idx); | |
74 | ||
75 | // refresh all the controls starting from (and including) the given one | |
76 | void RefreshColsAfter(unsigned int idx); | |
77 | ||
b63f9a33 VZ |
78 | // index of the column under mouse or -1 if none |
79 | unsigned int m_hover; | |
80 | ||
81 | // the horizontal scroll offset | |
82 | int m_scrollOffset; | |
83 | ||
84 | ||
85 | DECLARE_EVENT_TABLE() | |
86 | DECLARE_NO_COPY_CLASS(wxHeaderCtrl) | |
87 | }; | |
88 | ||
89 | #endif // _WX_GENERIC_HEADERCTRLG_H_ | |
90 |