#pragma once #include "ChatWindow.hpp" #include "LoginWindow.hpp" #include "WindowNotification.hpp" #include #include #include #include #include #include #include #include namespace dchat { class Window : public Gtk::Window { public: Window(); virtual ~Window(); std::shared_ptr rooms; WindowNotification *windowNotification; private: using DispatcherHandler = std::function; bool drawBackground(const Cairo::RefPtr &cairo); void dispatchFunction(DispatcherHandler func); private: class OverlayDrawable : public Gtk::Overlay { public: void draw(const Cairo::RefPtr &cairo) { Gtk::Overlay::draw(cairo); } }; std::mutex databaseCallbackMutex; OverlayDrawable overlay; Gtk::Stack stack; LoginWindow loginWindow; ChatWindow chatWindow; struct Node { double radius; double originalPosX; double originalPosY; double currentPosX; double currentPosY; double targetPosX; double targetPosY; }; std::mt19937 backgroundRng; std::vector backgroundNodes; int prevTimeMillis; sigc::connection drawBackgroundConnection; Glib::Dispatcher dispatcher; std::mutex dispatcherMutex; std::vector dispatcherHandlers; }; }