]> git.saurik.com Git - wxWidgets.git/blob - src/common/headercolcmn.cpp
implement click events in wxHeaderCtrl
[wxWidgets.git] / src / common / headercolcmn.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/headercolcmn.cpp
3 // Purpose: wxHeaderColumnBase implementation
4 // Author: Vadim Zeitlin
5 // Created: 2008-12-02
6 // RCS-ID: $Id$
7 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 // ============================================================================
12 // declarations
13 // ============================================================================
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 // for compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #ifndef WX_PRECOMP
27 #endif // WX_PRECOMP
28
29 #include "wx/headercol.h"
30
31 // ============================================================================
32 // wxHeaderColumnBase implementation
33 // ============================================================================
34
35 void wxHeaderColumnBase::SetIndividualFlags(int flags)
36 {
37 SetResizeable((flags & wxCOL_RESIZABLE) != 0);
38 SetSortable((flags & wxCOL_SORTABLE) != 0);
39 SetReorderable((flags & wxCOL_REORDERABLE) != 0);
40 SetHidden((flags & wxCOL_HIDDEN) != 0);
41 }
42
43 int wxHeaderColumnBase::GetFromIndividualFlags() const
44 {
45 int flags = 0;
46
47 if ( IsResizeable() )
48 flags |= wxCOL_RESIZABLE;
49 if ( IsSortable() )
50 flags |= wxCOL_SORTABLE;
51 if ( IsReorderable() )
52 flags |= wxCOL_REORDERABLE;
53 if ( IsHidden() )
54 flags |= wxCOL_HIDDEN;
55
56 return flags;
57 }
58
59 void wxHeaderColumnBase::ChangeFlag(int flag, bool set)
60 {
61 if ( HasFlag(flag) != set )
62 ToggleFlag(flag);
63 }
64
65 void wxHeaderColumnBase::SetFlag(int flag)
66 {
67 int flags = GetFlags();
68 if ( !(flags & flag) )
69 SetFlags(flags | flag);
70 }
71
72 void wxHeaderColumnBase::ClearFlag(int flag)
73 {
74 int flags = GetFlags();
75 if ( flags & flag )
76 SetFlags(flags & ~flag);
77 }
78
79 void wxHeaderColumnBase::ToggleFlag(int flag)
80 {
81 int flags = GetFlags();
82 if ( flags & flag )
83 flags &= ~flag;
84 else
85 flags |= flag;
86
87 SetFlags(flags);
88 }
89
90