From 8cc8853c3c1e5dfd7681bc0c31bc0eb88a4ef959 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 3 Nov 2018 01:10:08 +0100 Subject: Add room name change event, create new room button, multiple rooms --- include/ChatWindow.hpp | 15 ++++++++++++--- include/ImageButton.hpp | 12 ++++++++++++ include/InputDialog.hpp | 16 ++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 include/ImageButton.hpp create mode 100644 include/InputDialog.hpp (limited to 'include') diff --git a/include/ChatWindow.hpp b/include/ChatWindow.hpp index 988b225..7a61d91 100644 --- a/include/ChatWindow.hpp +++ b/include/ChatWindow.hpp @@ -1,5 +1,6 @@ #pragma once +#include "ImageButton.hpp" #include #include #include @@ -20,35 +21,43 @@ namespace dchat { public: ChatWindow(); + ~ChatWindow(); void addRoom(std::shared_ptr room); void addMessage(const RoomAddMessageRequest &request); void addUser(std::shared_ptr room, std::shared_ptr user); void setUserNickname(const UserChangeNicknameRequest &request); + void changeRoomName(const RoomChangeNameRequest &request); void scrollToBottom(); private: void setupTopBar(); void setupLeftPanel(Gtk::Paned *sidePanels); void setupMessageArea(Gtk::Grid *rightPanel); void setupChatInput(Gtk::Grid *rightPanel); + + void setCurrentRoom(std::shared_ptr room); private: Gtk::Grid topbar; Gtk::Entry topbarSearchBar; Gtk::Grid leftPanelChannels; - Gtk::Grid leftPanelUsers; + Gtk::Stack leftPanelUsersStack; + ImageButton addRoomButton; Gtk::Label currentChannelTitle; Gtk::ScrolledWindow messageArea; - Gtk::Grid messageAreaLayout; + Gtk::Stack messageAreaStack; Gtk::TextView chatInput; struct RoomData { + Gtk::Grid *leftPanelUsersLayout; + Gtk::Grid *messageAreaLayout; Gtk::ToggleButton *button; }; - odhtdb::MapHash roomDataById; + odhtdb::MapHash roomDataById; odhtdb::MapHash messageById; int chatPrevNumLines; int roomCount; + RoomData *currentRoomData; std::shared_ptr currentRoom; }; } \ No newline at end of file diff --git a/include/ImageButton.hpp b/include/ImageButton.hpp new file mode 100644 index 0000000..16b0840 --- /dev/null +++ b/include/ImageButton.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include + +namespace dchat +{ + class ImageButton : public Gtk::Button + { + public: + ImageButton(const char *filepath, const char *text); + }; +} \ No newline at end of file diff --git a/include/InputDialog.hpp b/include/InputDialog.hpp new file mode 100644 index 0000000..4b2b02a --- /dev/null +++ b/include/InputDialog.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include +#include + +namespace dchat +{ + class InputDialog : public Gtk::Dialog + { + public: + InputDialog(const char *title, const char *text, const char *acceptText = "Create", const char *cancelText = "Cancel"); + Glib::ustring getInput() const; + + Gtk::Entry entry; + }; +} \ No newline at end of file -- cgit v1.2.3