summaryrefslogtreecommitdiffstats
blob: 7d9299542aa868a48ec7dfc7aacfd7c380e26a8d (plain)
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
/*
 * Copyright (c) 2011 Remko Tronçon
 * Licensed under the GNU General Public License v3.
 * See Documentation/Licenses/GPLv3.txt for more information.
 */

#pragma once

#include <string>
#include <vector>
#include <Swiften/Base/boost_bsignals.h>

#include <Swiften/JID/JID.h>

namespace Swift {
	class Roster;

	class TableRoster {
		public:
			struct Item {
				std::string name;
				std::string description;
				JID jid;
			};
			struct Index {
				Index(size_t section, size_t row) : section(section), row(row) { 
				}
				size_t section;
				size_t row;
			};

			TableRoster(Roster* model);
			
			size_t getNumberOfSections() const;
			size_t getNumberOfRowsInSection(size_t section) const;

			const std::string& getSectionTitle(size_t);

			Item getItem(const Index&) const;

			boost::signal<void ()> onBeginUpdates;
			boost::signal<void (const std::vector<Index>&)> onRowsInserted;
			boost::signal<void (const std::vector<Index>&)> onRowsDeleted;
			boost::signal<void (const std::vector<size_t>&)> onSectionsInserted;
			boost::signal<void (const std::vector<size_t>&)> onSectionsDeleted;
			boost::signal<void ()> onEndUpdates;

		private:
			Roster* model;
	};
}