]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/headercolg.h
d0abd6936a0fcf69a2c1a5b4310ca96f633d3f87
[wxWidgets.git] / include / wx / generic / headercolg.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/headercolg.h
3 // Purpose: Generic wxHeaderColumn implementation
4 // Author: Vadim Zeitlin
5 // Created: 2008-12-04
6 // RCS-ID: $Id$
7 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_GENERIC_HEADERCOLG_H_
12 #define _WX_GENERIC_HEADERCOLG_H_
13
14 // ----------------------------------------------------------------------------
15 // wxHeaderColumn: trivial generic implementation of wxHeaderColumnBase
16 // ----------------------------------------------------------------------------
17
18 class WXDLLIMPEXP_CORE wxHeaderColumn : public wxHeaderColumnBase
19 {
20 public:
21 // ctors and dtor
22 wxHeaderColumn(const wxString& title,
23 int width = wxCOL_WIDTH_DEFAULT,
24 wxAlignment align = wxALIGN_NOT,
25 int flags = wxCOL_DEFAULT_FLAGS)
26 : m_title(title),
27 m_width(width),
28 m_align(align),
29 m_flags(flags)
30 {
31 Init();
32 }
33
34 wxHeaderColumn(const wxBitmap& bitmap,
35 int width = wxCOL_WIDTH_DEFAULT,
36 wxAlignment align = wxALIGN_CENTER,
37 int flags = wxCOL_DEFAULT_FLAGS)
38 : m_bitmap(bitmap),
39 m_width(width),
40 m_align(align),
41 m_flags(flags)
42 {
43 Init();
44 }
45
46 // implement base class pure virtuals
47 virtual void SetTitle(const wxString& title) { m_title = title; }
48 virtual wxString GetTitle() const { return m_title; }
49
50 virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
51 wxBitmap GetBitmap() const { return m_bitmap; }
52
53 virtual void SetWidth(int width) { m_width = width; }
54 virtual int GetWidth() const { return m_width; }
55
56 virtual void SetMinWidth(int minWidth) { m_minWidth = minWidth; }
57 virtual int GetMinWidth() const { return m_minWidth; }
58
59 virtual void SetAlignment(wxAlignment align) { m_align = align; }
60 virtual wxAlignment GetAlignment() const { return m_align; }
61
62 virtual void SetFlags(int flags) { m_flags = flags; }
63 virtual int GetFlags() const { return m_flags; }
64
65 virtual void SetSortOrder(bool ascending) { m_sortAscending = ascending; }
66 virtual bool IsSortOrderAscending() const { return m_sortAscending; }
67
68 private:
69 // common part of all ctors
70 void Init()
71 {
72 m_minWidth = 0;
73 m_sortAscending = true;
74 }
75
76 wxString m_title;
77 wxBitmap m_bitmap;
78 int m_width,
79 m_minWidth;
80 wxAlignment m_align;
81 int m_flags;
82 bool m_sortAscending;
83 };
84 #endif // _WX_GENERIC_HEADERCOLG_H_
85