]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/common/headercolcmn.cpp
Always link with expat in monolithic build.
[wxWidgets.git] / src / common / headercolcmn.cpp
... / ...
CommitLineData
1///////////////////////////////////////////////////////////////////////////////
2// Name: src/common/headercolcmn.cpp
3// Purpose: wxHeaderColumn 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#if wxUSE_HEADERCTRL
27
28#include "wx/headercol.h"
29
30// ============================================================================
31// wxHeaderColumn implementation
32// ============================================================================
33
34int wxHeaderColumn::GetFromIndividualFlags() const
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
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)
63{
64 if ( HasFlag(flag) != set )
65 ToggleFlag(flag);
66}
67
68void wxSettableHeaderColumn::SetFlag(int flag)
69{
70 int flags = GetFlags();
71 if ( !(flags & flag) )
72 SetFlags(flags | flag);
73}
74
75void wxSettableHeaderColumn::ClearFlag(int flag)
76{
77 int flags = GetFlags();
78 if ( flags & flag )
79 SetFlags(flags & ~flag);
80}
81
82void wxSettableHeaderColumn::ToggleFlag(int flag)
83{
84 int flags = GetFlags();
85 if ( flags & flag )
86 flags &= ~flag;
87 else
88 flags |= flag;
89
90 SetFlags(flags);
91}
92
93#endif // wxUSE_HEADERCTRL
94