diff options
Diffstat (limited to 'Swift/Controllers/Roster/TableRoster.h')
-rw-r--r-- | Swift/Controllers/Roster/TableRoster.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/Swift/Controllers/Roster/TableRoster.h b/Swift/Controllers/Roster/TableRoster.h new file mode 100644 index 0000000..7d92995 --- /dev/null +++ b/Swift/Controllers/Roster/TableRoster.h @@ -0,0 +1,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; + }; +} |