diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-11-03 01:10:08 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-11-03 01:10:11 +0100 |
commit | 8cc8853c3c1e5dfd7681bc0c31bc0eb88a4ef959 (patch) | |
tree | 844cb300de80e41aac38a1b481368c6ae6eb6c58 /include | |
parent | 3c5eb7000709606eccd34114e8bf4e851dcacd6a (diff) |
Add room name change event, create new room button, multiple rooms
Diffstat (limited to 'include')
-rw-r--r-- | include/ChatWindow.hpp | 15 | ||||
-rw-r--r-- | include/ImageButton.hpp | 12 | ||||
-rw-r--r-- | include/InputDialog.hpp | 16 |
3 files changed, 40 insertions, 3 deletions
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 <dchat/Room.hpp> #include <gtkmm/label.h> #include <gtkmm/togglebutton.h> @@ -20,35 +21,43 @@ namespace dchat { public: ChatWindow(); + ~ChatWindow(); void addRoom(std::shared_ptr<Room> room); void addMessage(const RoomAddMessageRequest &request); void addUser(std::shared_ptr<Room> room, std::shared_ptr<User> 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> 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<RoomData> roomDataById; + odhtdb::MapHash<RoomData*> roomDataById; odhtdb::MapHash<ChatMessage*> messageById; int chatPrevNumLines; int roomCount; + RoomData *currentRoomData; std::shared_ptr<Room> 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 <gtkmm/button.h> + +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 <gtkmm/dialog.h> +#include <gtkmm/entry.h> + +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 |