diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-11-09 09:46:43 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-11-09 09:46:47 +0100 |
commit | 5fab9a3a2cf048330f687dda48c76c95a3a67d98 (patch) | |
tree | 1be0385ef62f5fbf0794d98a697e0ff11fe7a510 /src/Topbar.cpp | |
parent | 118277121c8b1767a78f76d19c44aea496121b34 (diff) |
Add room joining
Diffstat (limited to 'src/Topbar.cpp')
-rw-r--r-- | src/Topbar.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/Topbar.cpp b/src/Topbar.cpp new file mode 100644 index 0000000..6339761 --- /dev/null +++ b/src/Topbar.cpp @@ -0,0 +1,44 @@ +#include "../include/Topbar.hpp" + +namespace dchat +{ + Topbar::Topbar() : + roomSettingsButton("images/settings-icon.png", nullptr), + roomNotificationsButton("images/messages_icon.png", nullptr) + { + set_name("top-bar"); + set_hexpand(true); + + Gtk::Grid *topbarLeft = Gtk::manage(new Gtk::Grid()); + topbarLeft->set_name("top-bar-left"); + topbarLeft->set_size_request(180); + topbarLeft->set_valign(Gtk::ALIGN_CENTER); + topbarLeft->set_halign(Gtk::ALIGN_CENTER); + attach(*topbarLeft, 0, 0, 1, 1); + + topbarSearchBar.set_name("top-bar-search"); + topbarSearchBar.set_placeholder_text("Search..."); + topbarSearchBar.set_size_request(180); + topbarLeft->attach(topbarSearchBar, 0, 0, 1, 1); + + Gtk::Grid *topbarRight = Gtk::manage(new Gtk::Grid()); + topbarRight->set_name("top-bar-right"); + topbarRight->set_hexpand(true); + topbarRight->set_valign(Gtk::ALIGN_CENTER); + attach_next_to(*topbarRight, *topbarLeft, Gtk::POS_RIGHT, 1, 1); + + currentRoomTitle.set_name("current-room-title"); + currentRoomTitle.set_selectable(true); + currentRoomTitle.set_hexpand(true); + currentRoomTitle.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_CENTER); + topbarRight->attach(currentRoomTitle, 0, 0, 1, 1); + + topbarRight->attach_next_to(roomSettingsButton, currentRoomTitle, Gtk::POS_RIGHT, 1, 1); + topbarRight->attach_next_to(roomNotificationsButton, roomSettingsButton, Gtk::POS_RIGHT, 1, 1); + } + + void Topbar::setTitle(const Glib::ustring &title) + { + currentRoomTitle.set_text(title); + } +}
\ No newline at end of file |