diff options
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 |