sptk2 logo
SPTK Home Page
CListViewRows.h
1/*
2╔══════════════════════════════════════════════════════════════════════════════╗
3║ SIMPLY POWERFUL TOOLKIT (SPTK) ║
4╟──────────────────────────────────────────────────────────────────────────────╢
5║ copyright © 1999-2022 Alexey Parshin. All rights reserved. ║
6║ email alexeyp@gmail.com ║
7╚══════════════════════════════════════════════════════════════════════════════╝
8┌──────────────────────────────────────────────────────────────────────────────┐
9│ This library is free software; you can redistribute it and/or modify it │
10│ under the terms of the GNU Library General Public License as published by │
11│ the Free Software Foundation; either version 2 of the License, or (at your │
12│ option) any later version. │
13│ │
14│ This library is distributed in the hope that it will be useful, but │
15│ WITHOUT ANY WARRANTY; without even the implied warranty of │
16│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library │
17│ General Public License for more details. │
18│ │
19│ You should have received a copy of the GNU Library General Public License │
20│ along with this library; if not, write to the Free Software Foundation, │
21│ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. │
22│ │
23│ Please report all bugs and problems to alexeyp@gmail.com. │
24└──────────────────────────────────────────────────────────────────────────────┘
25*/
26
27#pragma once
28
29#include <sptk5/PackedStrings.h>
30#include <sptk5/Variant.h>
31
32#include <vector>
33
34namespace sptk {
35
41class CListView;
42
47class SP_EXPORT CListViewRows
48{
50 using CPSVector = std::vector<PPackedStrings>;
51
52 friend class CListView;
53
57 int32_t m_sortColumn;
58
62 VariantDataType m_sortColumnType;
63
67 bool m_sortAscending;
68
72 uint32_t m_fullHeight;
73
77 CPSVector m_rows;
78
79protected:
84
88 static bool compare_strings(const PPackedStrings&, const PPackedStrings&);
89
93 static bool compare_integers(const PPackedStrings&, const PPackedStrings&);
94
98 static bool compare_floats(const PPackedStrings&, const PPackedStrings&);
99
103 static bool compare_dates(const PPackedStrings&, const PPackedStrings&);
104
109
110public:
115
120
124 void clear();
125
130 void truncate(uint32_t count);
131
136 void remove(uint32_t index);
137
143 uint32_t add(CPackedStrings* row);
144
151 uint32_t insert(uint32_t index, CPackedStrings* row);
152
159 uint32_t update(uint32_t index, CPackedStrings* row);
160
166 CPackedStrings* operator[](uint32_t index) const
167 {
168 if (index < m_rows.size())
169 {
170 return m_rows[index];
171 }
172 return 0L;
173 }
174
180 int32_t indexOf(CPackedStrings* row) const;
181
186 uint32_t size() const
187 {
188 return (uint32_t) m_rows.size();
189 }
190
194 void sort();
195
200 int32_t sortColumn() const
201 {
202 return m_sortColumn;
203 }
204
211 void sortColumn(int column, VariantDataType ctype, bool sortNow);
212
217 bool sortAscending() const
218 {
219 return m_sortAscending;
220 }
221
227 void sortAscending(bool ascending, bool sortNow);
228
233 int32_t fullHeight() const
234 {
235 return (int32_t) m_fullHeight;
236 }
237};
241} // namespace sptk
Definition: CListViewRows.h:48
CPackedStrings * operator[](uint32_t index) const
Definition: CListViewRows.h:166
static bool compare_integers(const PPackedStrings &, const PPackedStrings &)
static bool compare_floats(const PPackedStrings &, const PPackedStrings &)
static bool compare_datetimes(const PPackedStrings &, const PPackedStrings &)
int32_t fullHeight() const
Definition: CListViewRows.h:233
int32_t sortColumn() const
Definition: CListViewRows.h:200
int32_t indexOf(CPackedStrings *row) const
uint32_t size() const
Definition: CListViewRows.h:186
void sortAscending(bool ascending, bool sortNow)
uint32_t update(uint32_t index, CPackedStrings *row)
void sortColumn(int column, VariantDataType ctype, bool sortNow)
void truncate(uint32_t count)
static int currentSortColumn
Definition: CListViewRows.h:83
static bool compare_strings(const PPackedStrings &, const PPackedStrings &)
bool sortAscending() const
Definition: CListViewRows.h:217
uint32_t insert(uint32_t index, CPackedStrings *row)
uint32_t add(CPackedStrings *row)
void remove(uint32_t index)
static bool compare_dates(const PPackedStrings &, const PPackedStrings &)
List view widget.
Definition: CListView.h:108
Packed strings list.
Definition: PackedStrings.h:58
VariantDataType
Definition: VariantData.h:44

Fri Oct 14 2022 09:58:31: SPTK 5.4.1