]>
Commit | Line | Data |
---|---|---|
56873923 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: src/common/headercolcmn.cpp | |
dcb6cbec | 3 | // Purpose: wxHeaderColumn implementation |
56873923 VZ |
4 | // Author: Vadim Zeitlin |
5 | // Created: 2008-12-02 | |
56873923 VZ |
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 | ||
e721a2a2 | 25 | #if wxUSE_HEADERCTRL |
56873923 VZ |
26 | |
27 | #include "wx/headercol.h" | |
28 | ||
29 | // ============================================================================ | |
dcb6cbec | 30 | // wxHeaderColumn implementation |
56873923 VZ |
31 | // ============================================================================ |
32 | ||
dcb6cbec | 33 | int wxHeaderColumn::GetFromIndividualFlags() const |
56873923 VZ |
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 | ||
dcb6cbec VZ |
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) | |
56873923 VZ |
62 | { |
63 | if ( HasFlag(flag) != set ) | |
64 | ToggleFlag(flag); | |
65 | } | |
66 | ||
dcb6cbec | 67 | void wxSettableHeaderColumn::SetFlag(int flag) |
56873923 VZ |
68 | { |
69 | int flags = GetFlags(); | |
70 | if ( !(flags & flag) ) | |
71 | SetFlags(flags | flag); | |
72 | } | |
73 | ||
dcb6cbec | 74 | void wxSettableHeaderColumn::ClearFlag(int flag) |
56873923 VZ |
75 | { |
76 | int flags = GetFlags(); | |
77 | if ( flags & flag ) | |
78 | SetFlags(flags & ~flag); | |
79 | } | |
80 | ||
dcb6cbec | 81 | void wxSettableHeaderColumn::ToggleFlag(int flag) |
56873923 VZ |
82 | { |
83 | int flags = GetFlags(); | |
84 | if ( flags & flag ) | |
85 | flags &= ~flag; | |
86 | else | |
87 | flags |= flag; | |
88 | ||
89 | SetFlags(flags); | |
90 | } | |
91 | ||
e721a2a2 | 92 | #endif // wxUSE_HEADERCTRL |
56873923 | 93 |