2020-11-12 14:27:47 -08:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
2020-11-28 14:47:34 -08:00
|
|
|
#include <gtkmm/window.h>
|
2020-11-30 15:43:52 -08:00
|
|
|
#include <gtkmm/box.h>
|
|
|
|
#include <gtkmm/menubar.h>
|
2020-11-28 14:47:34 -08:00
|
|
|
#include <gtkmm/scrolledwindow.h>
|
2020-12-08 19:44:26 -08:00
|
|
|
#include <gtkmm/button.h>
|
2021-02-19 13:58:55 -08:00
|
|
|
#include <gtkmm/comboboxtext.h>
|
2020-12-08 19:44:26 -08:00
|
|
|
#include <gtkmm/entry.h>
|
2021-02-17 12:38:16 -08:00
|
|
|
#include <gtkmm/searchbar.h>
|
|
|
|
#include <gtkmm/searchentry.h>
|
2020-12-14 14:57:36 -08:00
|
|
|
#include <thread>
|
2020-11-30 15:43:52 -08:00
|
|
|
#include "menu.h"
|
2020-12-04 17:51:40 -08:00
|
|
|
#include "file.h"
|
2020-12-07 16:13:21 -08:00
|
|
|
#include "about.h"
|
2020-12-11 21:02:17 -08:00
|
|
|
#include "source-code-dialog.h"
|
2021-02-11 14:04:50 -08:00
|
|
|
#include "draw.h"
|
2020-11-12 14:27:47 -08:00
|
|
|
|
2021-02-17 09:05:12 -08:00
|
|
|
/**
|
|
|
|
* \class MainWindow
|
|
|
|
* \brief Main Application Window
|
|
|
|
*/
|
2020-11-28 14:47:34 -08:00
|
|
|
class MainWindow : public Gtk::Window
|
2020-11-12 14:27:47 -08:00
|
|
|
{
|
|
|
|
public:
|
2021-02-12 12:46:41 -08:00
|
|
|
MainWindow();
|
2021-02-15 13:54:56 -08:00
|
|
|
void doRequest(const std::string &path= std::string(), bool setAddressBar = false, bool isHistoryRequest = false);
|
2020-11-14 14:13:00 -08:00
|
|
|
|
2020-11-28 14:47:34 -08:00
|
|
|
protected:
|
2021-02-17 12:11:07 -08:00
|
|
|
// Signal handlers
|
2021-02-18 15:44:21 -08:00
|
|
|
void new_doc();
|
2021-02-12 12:46:41 -08:00
|
|
|
void go_home();
|
2021-02-15 10:03:07 -08:00
|
|
|
void address_bar_activate();
|
2021-02-17 12:38:16 -08:00
|
|
|
void do_search();
|
|
|
|
void show_search();
|
2021-02-15 13:54:56 -08:00
|
|
|
void back();
|
|
|
|
void forward();
|
2021-02-12 12:46:41 -08:00
|
|
|
void refresh();
|
|
|
|
void on_button_clicked(Glib::ustring data);
|
|
|
|
void show_about();
|
|
|
|
void hide_about(int response);
|
|
|
|
void show_source_code_dialog();
|
2021-02-19 13:58:55 -08:00
|
|
|
void get_heading();
|
2021-02-12 12:46:41 -08:00
|
|
|
|
2021-02-17 12:11:07 -08:00
|
|
|
Glib::RefPtr<Gtk::AccelGroup> accelGroup; /*!< Accelerator group, used for keyboard shortcut bindings */
|
|
|
|
|
2021-02-12 12:46:41 -08:00
|
|
|
// Child widgets
|
|
|
|
Menu m_menu;
|
2021-02-15 11:19:25 -08:00
|
|
|
Draw m_draw;
|
|
|
|
SourceCodeDialog m_sourceCodeDialog;
|
|
|
|
About m_about;
|
2021-02-17 12:38:16 -08:00
|
|
|
Gtk::SearchBar m_search;
|
|
|
|
Gtk::SearchEntry m_searchEntry;
|
2021-02-12 12:46:41 -08:00
|
|
|
Gtk::Box m_vbox;
|
2021-02-19 10:38:05 -08:00
|
|
|
Gtk::Box m_hboxToolbar;
|
|
|
|
Gtk::Box m_hboxEditor;
|
2021-02-17 12:38:16 -08:00
|
|
|
Gtk::Box m_hboxBottom;
|
2021-02-19 10:38:05 -08:00
|
|
|
Gtk::Entry m_addressBar;
|
2021-02-12 12:46:41 -08:00
|
|
|
Gtk::Button m_backButton;
|
|
|
|
Gtk::Button m_forwardButton;
|
|
|
|
Gtk::Button m_refreshButton;
|
|
|
|
Gtk::Button m_homeButton;
|
2021-02-19 13:58:55 -08:00
|
|
|
Gtk::ComboBoxText m_headingsComboBox;
|
2021-02-19 10:38:05 -08:00
|
|
|
Gtk::Button m_boldButton;
|
|
|
|
Gtk::Button m_italicButton;
|
|
|
|
Gtk::Button m_strikethroughButton;
|
|
|
|
Gtk::Button m_superButton;
|
|
|
|
Gtk::Button m_subButton;
|
|
|
|
Gtk::Button m_quoteButton;
|
2021-02-23 07:54:28 -08:00
|
|
|
Gtk::Button m_codeButton;
|
2021-02-19 10:38:05 -08:00
|
|
|
Gtk::Button m_linkButton;
|
|
|
|
Gtk::Button m_imageButton;
|
|
|
|
Gtk::Button m_bulletListButton;
|
|
|
|
Gtk::Button m_numberedListButton;
|
|
|
|
Gtk::Button m_highlightButton;
|
2021-02-12 12:46:41 -08:00
|
|
|
Gtk::Image backIcon;
|
|
|
|
Gtk::Image forwardIcon;
|
|
|
|
Gtk::Image refreshIcon;
|
|
|
|
Gtk::Image homeIcon;
|
2021-02-19 10:38:05 -08:00
|
|
|
Gtk::Image boldIcon;
|
|
|
|
Gtk::Image italicIcon;
|
|
|
|
Gtk::Image strikethroughIcon;
|
|
|
|
Gtk::Image superIcon;
|
|
|
|
Gtk::Image subIcon;
|
|
|
|
Gtk::Image quoteIcon;
|
2021-02-23 07:54:28 -08:00
|
|
|
Gtk::Image codeIcon;
|
2021-02-19 10:38:05 -08:00
|
|
|
Gtk::Image linkIcon;
|
|
|
|
Gtk::Image imageIcon;
|
|
|
|
Gtk::Image bulletIcon;
|
|
|
|
Gtk::Image numberedIcon;
|
|
|
|
Gtk::Image hightlightIcon;
|
2021-02-12 12:46:41 -08:00
|
|
|
Gtk::ScrolledWindow m_scrolledWindow;
|
2021-02-17 12:57:52 -08:00
|
|
|
Gtk::Button m_exitBottomButton;
|
2020-11-12 14:27:47 -08:00
|
|
|
|
|
|
|
private:
|
2021-02-19 10:38:05 -08:00
|
|
|
std::string m_appName;
|
2021-02-12 12:46:41 -08:00
|
|
|
File m_file;
|
|
|
|
std::thread *m_requestThread;
|
|
|
|
std::string requestPath;
|
|
|
|
std::string finalRequestPath;
|
|
|
|
std::string currentContent;
|
2021-02-15 13:54:56 -08:00
|
|
|
std::size_t currentHistoryIndex;
|
2021-02-15 12:32:48 -08:00
|
|
|
std::vector<std::string> history;
|
2020-11-15 20:46:05 -08:00
|
|
|
|
2021-02-19 10:38:05 -08:00
|
|
|
void enableEditing();
|
|
|
|
void disableEditing();
|
2021-02-15 15:04:41 -08:00
|
|
|
void postDoRequest(const std::string &path, bool setAddressBar, bool isHistoryRequest);
|
2021-02-15 10:03:07 -08:00
|
|
|
void processRequest(const std::string &path);
|
2021-02-12 12:46:41 -08:00
|
|
|
void fetchFromIPFS();
|
|
|
|
void openFromDisk();
|
2020-11-12 14:27:47 -08:00
|
|
|
};
|
2020-11-14 14:13:00 -08:00
|
|
|
|
2021-02-19 10:38:05 -08:00
|
|
|
#endif
|