/usr/include/wx-3.0/wx/headercol.h is in wx3.0-headers 3.0.2-1+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | ///////////////////////////////////////////////////////////////////////////////
// Name: wx/headercol.h
// Purpose: declaration of wxHeaderColumn class
// Author: Vadim Zeitlin
// Created: 2008-12-02
// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_HEADERCOL_H_
#define _WX_HEADERCOL_H_
#include "wx/bitmap.h"
#if wxUSE_HEADERCTRL
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
enum
{
// special value for column width meaning unspecified/default
wxCOL_WIDTH_DEFAULT = -1,
// size the column automatically to fit all values
wxCOL_WIDTH_AUTOSIZE = -2
};
// bit masks for the various column attributes
enum
{
// column can be resized (included in default flags)
wxCOL_RESIZABLE = 1,
// column can be clicked to toggle the sort order by its contents
wxCOL_SORTABLE = 2,
// column can be dragged to change its order (included in default)
wxCOL_REORDERABLE = 4,
// column is not shown at all
wxCOL_HIDDEN = 8,
// default flags for wxHeaderColumn ctor
wxCOL_DEFAULT_FLAGS = wxCOL_RESIZABLE | wxCOL_REORDERABLE
};
// ----------------------------------------------------------------------------
// wxHeaderColumn: interface for a column in a header of controls such as
// wxListCtrl, wxDataViewCtrl or wxGrid
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxHeaderColumn
{
public:
// ctors and dtor
// --------------
/*
Derived classes must provide ctors with the following signatures
(notice that they shouldn't be explicit to allow passing strings/bitmaps
directly to methods such wxHeaderCtrl::AppendColumn()):
wxHeaderColumn(const wxString& title,
int width = wxCOL_WIDTH_DEFAULT,
wxAlignment align = wxALIGN_NOT,
int flags = wxCOL_DEFAULT_FLAGS);
wxHeaderColumn(const wxBitmap &bitmap,
int width = wxDVC_DEFAULT_WIDTH,
wxAlignment align = wxALIGN_CENTER,
int flags = wxCOL_DEFAULT_FLAGS);
*/
// virtual dtor for the base class to avoid gcc warnings even though we
// don't normally delete the objects of this class via a pointer to
// wxHeaderColumn so it's not necessary, strictly speaking
virtual ~wxHeaderColumn() { }
// getters for various attributes
// ------------------------------
// notice that wxHeaderColumn only provides getters as this is all the
// wxHeaderCtrl needs, various derived class must also provide some way to
// change these attributes but this can be done either at the column level
// (in which case they should inherit from wxSettableHeaderColumn) or via
// the methods of the main control in which case you don't need setters in
// the column class at all
// title is the string shown for this column
virtual wxString GetTitle() const = 0;
// bitmap shown (instead of text) in the column header
virtual wxBitmap GetBitmap() const = 0; \
// width of the column in pixels, can be set to wxCOL_WIDTH_DEFAULT meaning
// unspecified/default
virtual int GetWidth() const = 0;
// minimal width can be set for resizable columns to forbid resizing them
// below the specified size (set to 0 to remove)
virtual int GetMinWidth() const = 0;
// alignment of the text: wxALIGN_CENTRE, wxALIGN_LEFT or wxALIGN_RIGHT
virtual wxAlignment GetAlignment() const = 0;
// flags manipulations:
// --------------------
// notice that while we make GetFlags() pure virtual here and implement the
// individual flags access in terms of it, for some derived classes it is
// more natural to implement access to each flag individually, in which
// case they can use our GetFromIndividualFlags() helper below to implement
// GetFlags()
// retrieve all column flags at once: combination of wxCOL_XXX values above
virtual int GetFlags() const = 0;
bool HasFlag(int flag) const { return (GetFlags() & flag) != 0; }
// wxCOL_RESIZABLE
virtual bool IsResizeable() const
{ return HasFlag(wxCOL_RESIZABLE); }
// wxCOL_SORTABLE
virtual bool IsSortable() const
{ return HasFlag(wxCOL_SORTABLE); }
// wxCOL_REORDERABLE
virtual bool IsReorderable() const
{ return HasFlag(wxCOL_REORDERABLE); }
// wxCOL_HIDDEN
virtual bool IsHidden() const
{ return HasFlag(wxCOL_HIDDEN); }
bool IsShown() const
{ return !IsHidden(); }
// sorting
// -------
// return true if the column is the one currently used for sorting
virtual bool IsSortKey() const = 0;
// for sortable columns indicate whether we should sort in ascending or
// descending order (this should only be taken into account if IsSortKey())
virtual bool IsSortOrderAscending() const = 0;
protected:
// helper for the class overriding IsXXX()
int GetFromIndividualFlags() const;
};
// ----------------------------------------------------------------------------
// wxSettableHeaderColumn: column which allows to change its fields too
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxSettableHeaderColumn : public wxHeaderColumn
{
public:
virtual void SetTitle(const wxString& title) = 0;
virtual void SetBitmap(const wxBitmap& bitmap) = 0;
virtual void SetWidth(int width) = 0;
virtual void SetMinWidth(int minWidth) = 0;
virtual void SetAlignment(wxAlignment align) = 0;
// see comment for wxHeaderColumn::GetFlags() about the relationship
// between SetFlags() and Set{Sortable,Reorderable,...}
// change, set, clear, toggle or test for any individual flag
virtual void SetFlags(int flags) = 0;
void ChangeFlag(int flag, bool set);
void SetFlag(int flag);
void ClearFlag(int flag);
void ToggleFlag(int flag);
virtual void SetResizeable(bool resizable)
{ ChangeFlag(wxCOL_RESIZABLE, resizable); }
virtual void SetSortable(bool sortable)
{ ChangeFlag(wxCOL_SORTABLE, sortable); }
virtual void SetReorderable(bool reorderable)
{ ChangeFlag(wxCOL_REORDERABLE, reorderable); }
virtual void SetHidden(bool hidden)
{ ChangeFlag(wxCOL_HIDDEN, hidden); }
// This function can be called to indicate that this column is not used for
// sorting any more. Under some platforms it's not necessary to do anything
// in this case as just setting another column as a sort key takes care of
// everything but under MSW we currently need to call this explicitly to
// reset the sort indicator displayed on the column.
virtual void UnsetAsSortKey() { }
virtual void SetSortOrder(bool ascending) = 0;
void ToggleSortOrder() { SetSortOrder(!IsSortOrderAscending()); }
protected:
// helper for the class overriding individual SetXXX() methods instead of
// overriding SetFlags()
void SetIndividualFlags(int flags);
};
// ----------------------------------------------------------------------------
// wxHeaderColumnSimple: trivial generic implementation of wxHeaderColumn
// ----------------------------------------------------------------------------
class wxHeaderColumnSimple : public wxSettableHeaderColumn
{
public:
// ctors and dtor
wxHeaderColumnSimple(const wxString& title,
int width = wxCOL_WIDTH_DEFAULT,
wxAlignment align = wxALIGN_NOT,
int flags = wxCOL_DEFAULT_FLAGS)
: m_title(title),
m_width(width),
m_align(align),
m_flags(flags)
{
Init();
}
wxHeaderColumnSimple(const wxBitmap& bitmap,
int width = wxCOL_WIDTH_DEFAULT,
wxAlignment align = wxALIGN_CENTER,
int flags = wxCOL_DEFAULT_FLAGS)
: m_bitmap(bitmap),
m_width(width),
m_align(align),
m_flags(flags)
{
Init();
}
// implement base class pure virtuals
virtual void SetTitle(const wxString& title) { m_title = title; }
virtual wxString GetTitle() const { return m_title; }
virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
wxBitmap GetBitmap() const { return m_bitmap; }
virtual void SetWidth(int width) { m_width = width; }
virtual int GetWidth() const { return m_width; }
virtual void SetMinWidth(int minWidth) { m_minWidth = minWidth; }
virtual int GetMinWidth() const { return m_minWidth; }
virtual void SetAlignment(wxAlignment align) { m_align = align; }
virtual wxAlignment GetAlignment() const { return m_align; }
virtual void SetFlags(int flags) { m_flags = flags; }
virtual int GetFlags() const { return m_flags; }
virtual bool IsSortKey() const { return m_sort; }
virtual void UnsetAsSortKey() { m_sort = false; }
virtual void SetSortOrder(bool ascending)
{
m_sort = true;
m_sortAscending = ascending;
}
virtual bool IsSortOrderAscending() const { return m_sortAscending; }
private:
// common part of all ctors
void Init()
{
m_minWidth = 0;
m_sort = false;
m_sortAscending = true;
}
wxString m_title;
wxBitmap m_bitmap;
int m_width,
m_minWidth;
wxAlignment m_align;
int m_flags;
bool m_sort,
m_sortAscending;
};
#endif // wxUSE_HEADERCTRL
#endif // _WX_HEADERCOL_H_
|