]> git.saurik.com Git - wxWidgets.git/blame - src/common/headercolcmn.cpp
Add some version checks to help compiling on OSX.
[wxWidgets.git] / src / common / headercolcmn.cpp
CommitLineData
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
e721a2a2 26#if wxUSE_HEADERCTRL
56873923
VZ
27
28#include "wx/headercol.h"
29
30// ============================================================================
dcb6cbec 31// wxHeaderColumn implementation
56873923
VZ
32// ============================================================================
33
dcb6cbec 34int wxHeaderColumn::GetFromIndividualFlags() const
56873923
VZ
35{
36 int flags = 0;
37
38 if ( IsResizeable() )
39 flags |= wxCOL_RESIZABLE;
40 if ( IsSortable() )
41 flags |= wxCOL_SORTABLE;
42 if ( IsReorderable() )
43 flags |= wxCOL_REORDERABLE;
44 if ( IsHidden() )
45 flags |= wxCOL_HIDDEN;
46
47 return flags;
48}
49
dcb6cbec
VZ
50// ============================================================================
51// wxSettableHeaderColumn implementation
52// ============================================================================
53
54void wxSettableHeaderColumn::SetIndividualFlags(int flags)
55{
56 SetResizeable((flags & wxCOL_RESIZABLE) != 0);
57 SetSortable((flags & wxCOL_SORTABLE) != 0);
58 SetReorderable((flags & wxCOL_REORDERABLE) != 0);
59 SetHidden((flags & wxCOL_HIDDEN) != 0);
60}
61
62void wxSettableHeaderColumn::ChangeFlag(int flag, bool set)
56873923
VZ
63{
64 if ( HasFlag(flag) != set )
65 ToggleFlag(flag);
66}
67
dcb6cbec 68void wxSettableHeaderColumn::SetFlag(int flag)
56873923
VZ
69{
70 int flags = GetFlags();
71 if ( !(flags & flag) )
72 SetFlags(flags | flag);
73}
74
dcb6cbec 75void wxSettableHeaderColumn::ClearFlag(int flag)
56873923
VZ
76{
77 int flags = GetFlags();
78 if ( flags & flag )
79 SetFlags(flags & ~flag);
80}
81
dcb6cbec 82void wxSettableHeaderColumn::ToggleFlag(int flag)
56873923
VZ
83{
84 int flags = GetFlags();
85 if ( flags & flag )
86 flags &= ~flag;
87 else
88 flags |= flag;
89
90 SetFlags(flags);
91}
92
e721a2a2 93#endif // wxUSE_HEADERCTRL
56873923 94