]>
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 | |
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 | // ============================================================================ | |
dcb6cbec | 32 | // wxHeaderColumn implementation |
56873923 VZ |
33 | // ============================================================================ |
34 | ||
dcb6cbec | 35 | int wxHeaderColumn::GetFromIndividualFlags() const |
56873923 VZ |
36 | { |
37 | int flags = 0; | |
38 | ||
39 | if ( IsResizeable() ) | |
40 | flags |= wxCOL_RESIZABLE; | |
41 | if ( IsSortable() ) | |
42 | flags |= wxCOL_SORTABLE; | |
43 | if ( IsReorderable() ) | |
44 | flags |= wxCOL_REORDERABLE; | |
45 | if ( IsHidden() ) | |
46 | flags |= wxCOL_HIDDEN; | |
47 | ||
48 | return flags; | |
49 | } | |
50 | ||
dcb6cbec VZ |
51 | // ============================================================================ |
52 | // wxSettableHeaderColumn implementation | |
53 | // ============================================================================ | |
54 | ||
55 | void wxSettableHeaderColumn::SetIndividualFlags(int flags) | |
56 | { | |
57 | SetResizeable((flags & wxCOL_RESIZABLE) != 0); | |
58 | SetSortable((flags & wxCOL_SORTABLE) != 0); | |
59 | SetReorderable((flags & wxCOL_REORDERABLE) != 0); | |
60 | SetHidden((flags & wxCOL_HIDDEN) != 0); | |
61 | } | |
62 | ||
63 | void wxSettableHeaderColumn::ChangeFlag(int flag, bool set) | |
56873923 VZ |
64 | { |
65 | if ( HasFlag(flag) != set ) | |
66 | ToggleFlag(flag); | |
67 | } | |
68 | ||
dcb6cbec | 69 | void wxSettableHeaderColumn::SetFlag(int flag) |
56873923 VZ |
70 | { |
71 | int flags = GetFlags(); | |
72 | if ( !(flags & flag) ) | |
73 | SetFlags(flags | flag); | |
74 | } | |
75 | ||
dcb6cbec | 76 | void wxSettableHeaderColumn::ClearFlag(int flag) |
56873923 VZ |
77 | { |
78 | int flags = GetFlags(); | |
79 | if ( flags & flag ) | |
80 | SetFlags(flags & ~flag); | |
81 | } | |
82 | ||
dcb6cbec | 83 | void wxSettableHeaderColumn::ToggleFlag(int flag) |
56873923 VZ |
84 | { |
85 | int flags = GetFlags(); | |
86 | if ( flags & flag ) | |
87 | flags &= ~flag; | |
88 | else | |
89 | flags |= flag; | |
90 | ||
91 | SetFlags(flags); | |
92 | } | |
93 | ||
94 |