Update list of wide characters
[centerim5.git] / src / Header.h
blob8aaf7938c83047b70f843fb3f6eb66b4a6c74265
1 // Copyright (C) 2010-2015 Petr Pavlu <setup@dagobah.cz>
2 //
3 // This file is part of CenterIM.
4 //
5 // CenterIM is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // CenterIM is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with CenterIM. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef HEADER_H
19 #define HEADER_H
21 #include "Accounts.h"
23 #include <cppconsui/HorizontalListBox.h>
24 #include <cppconsui/Label.h>
25 #include <cppconsui/Window.h>
26 #include <libpurple/purple.h>
27 #include <map>
29 #define HEADER (Header::instance())
31 // Top "head"-area of the screen.
32 class Header : public CppConsUI::Window {
33 public:
34 static Header *instance();
36 // Window
37 virtual void onScreenResized() override;
39 private:
40 typedef std::multiset<std::string> ProtocolCount;
41 typedef std::map<PurpleAccount *, CppConsUI::Label *> Statuses;
43 CppConsUI::HorizontalListBox *container_;
44 CppConsUI::Label *request_indicator_;
45 ProtocolCount protocol_count_;
46 Statuses statuses_;
48 static Header *my_instance_;
50 Header();
51 virtual ~Header() override;
52 CONSUI_DISABLE_COPY(Header);
54 static void init();
55 static void finalize();
56 friend class CenterIM;
58 // Signal from the Accounts singleton.
59 void onRequestCountChange(Accounts &accounts, std::size_t request_count);
61 static void account_signed_on_(PurpleAccount *account, gpointer data)
63 reinterpret_cast<Header *>(data)->account_signed_on(account);
65 static void account_signed_off_(PurpleAccount *account, gpointer data)
67 reinterpret_cast<Header *>(data)->account_signed_off(account);
69 static void account_status_changed_(
70 PurpleAccount *account, PurpleStatus *old, PurpleStatus *cur, gpointer data)
72 reinterpret_cast<Header *>(data)->account_status_changed(account, old, cur);
74 static void account_alias_changed_(
75 PurpleAccount *account, const char *old, gpointer data)
77 reinterpret_cast<Header *>(data)->account_alias_changed(account, old);
79 static void account_enabled_(PurpleAccount *account, gpointer data)
81 reinterpret_cast<Header *>(data)->account_enabled(account);
83 static void account_disabled_(PurpleAccount *account, gpointer data)
85 reinterpret_cast<Header *>(data)->account_disabled(account);
88 void account_signed_on(PurpleAccount *account);
89 void account_signed_off(PurpleAccount *account);
90 void account_status_changed(
91 PurpleAccount *account, PurpleStatus *old, PurpleStatus *cur);
92 void account_alias_changed(PurpleAccount *account, const char *old);
93 void account_enabled(PurpleAccount *account);
94 void account_disabled(PurpleAccount *account);
97 #endif // HEADER_H
99 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab: