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