g-window.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
  2. /*
  3. * g-window.h
  4. * Copyright (C) 2017 Unknown <francois@gautrais.eu>
  5. *
  6. * histodexc is free software: you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * histodexc is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. * See the GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef _G_WINDOW_H_
  20. #define _G_WINDOW_H_
  21. #include <iostream>
  22. #include <json/json.h>
  23. #include <gtk/gtk.h>
  24. class GeneralTab;
  25. class ResourceTab;
  26. class ZoneTab;
  27. class StageTab;
  28. struct _Private;
  29. class GWindow
  30. {
  31. public:
  32. GWindow(const std::string& file);
  33. virtual ~GWindow();
  34. virtual void show()=0;
  35. virtual void write(const std::string& file)=0;
  36. virtual Json::Value getJson(bool genFinal=false)=0;
  37. virtual void on_generate()=0;
  38. virtual void on_new()=0;
  39. virtual void on_import()=0;
  40. virtual void on_open()=0;
  41. virtual void on_save()=0;
  42. virtual void on_saveas()=0;
  43. virtual void on_exit()=0;
  44. virtual void open(const std::string& f)=0;
  45. virtual void changeFile(const std::string& file)=0;
  46. protected:
  47. int m_magic;
  48. GtkWidget *m_window;
  49. GtkBuilder *m_builder;
  50. struct _Private *m_priv;
  51. GtkButton* m_generate;
  52. GtkImageMenuItem* m_new;
  53. GtkMenuItem* m_import;
  54. GtkImageMenuItem* m_open;
  55. GtkImageMenuItem* m_save;
  56. GtkImageMenuItem* m_saveas;
  57. GtkImageMenuItem* m_exit;
  58. GtkTextView* m_log;
  59. protected:
  60. virtual void init_menu()=0;
  61. virtual void setModidified()=0;
  62. virtual void clearModidified()=0;
  63. virtual bool isModidified()=0;
  64. virtual bool checkSaved()=0;
  65. private:
  66. };
  67. extern "C" {
  68. extern void window_start(int argc, char** argv); /* a C function */
  69. }
  70. #endif // _G_WINDOW_H_