1 // Gmsh - Copyright (C) 1997-2021 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #ifndef GRAPHIC_WINDOW_H
7 #define GRAPHIC_WINDOW_H
8 
9 #include <string>
10 #include <vector>
11 #include <FL/Fl.H>
12 #include <FL/Fl_Window.H>
13 #include <FL/Fl_Button.H>
14 #include <FL/Fl_Box.H>
15 #include <FL/Fl_Tile.H>
16 #include <FL/Fl_Browser.H>
17 #include <FL/Fl_Progress.H>
18 #if defined(__APPLE__)
19 #include <FL/Fl_Sys_Menu_Bar.H>
20 #endif
21 #include <FL/Fl_Menu_Bar.H>
22 
23 class openglWindow;
24 class onelabGroup;
25 class messageBrowser;
26 
27 class graphicWindow {
28 private:
29   bool _autoScrollMessages;
30 #if defined(__APPLE__)
31   Fl_Sys_Menu_Bar *_sysbar;
32 #endif
33   Fl_Menu_Bar *_bar;
34   Fl_Tile *_tile;
35   Fl_Window *_win, *_menuwin;
36   messageBrowser *_browser;
37   onelabGroup *_onelab;
38   Fl_Box *_bottom;
39   Fl_Button *_butt[12];
40   Fl_Progress *_label;
41   int _minWidth, _minHeight;
42   std::vector<std::string> _messages;
43 
44 public:
45   std::vector<openglWindow *> gl;
46 
47 public:
48   graphicWindow(bool main = true, int numTiles = 1, bool detachedMenu = false);
49   ~graphicWindow();
getWindow()50   Fl_Window *getWindow() { return _win; }
getMenuWindow()51   Fl_Window *getMenuWindow() { return _menuwin; }
getMenu()52   onelabGroup *getMenu() { return _onelab; }
getProgress()53   Fl_Progress *getProgress() { return _label; }
getSelectionButton()54   Fl_Button *getSelectionButton() { return _butt[9]; }
getMessageBrowser()55   messageBrowser *getMessageBrowser() { return _browser; }
getMessages()56   std::vector<std::string> &getMessages() { return _messages; }
getMinWidth()57   int getMinWidth() { return _minWidth; }
getMinHeight()58   int getMinHeight() { return _minHeight; }
setAutoScroll(bool val)59   void setAutoScroll(bool val) { _autoScrollMessages = val; }
getAutoScroll()60   bool getAutoScroll() { return _autoScrollMessages; }
61   void setTitle(const std::string &str);
62   void setStereo(bool st);
63   int getGlWidth();
64   void setGlWidth(int w);
65   int getGlHeight();
66   void setGlHeight(int h);
67   int getMenuWidth();
68   void setMenuWidth(int w);
69   int getMenuHeight();
70   int getMenuPositionX();
71   int getMenuPositionY();
72   void showMenu();
73   void hideMenu();
74   void showHideMenu();
75   void detachMenu();
76   void attachMenu();
77   void attachDetachMenu();
isMenuDetached()78   bool isMenuDetached() { return _menuwin ? true : false; }
79   bool split(openglWindow *g, char how, double ratio);
80   void setAnimButtons(int mode);
81   void checkAnimButtons();
82   int getMessageHeight();
83   void setMessageHeight(int h);
84   void showMessages();
85   void hideMessages();
86   void showHideMessages();
87   void addMessage(const char *msg);
88   void clearMessages();
89   void saveMessages(const char *filename);
90   void copySelectedMessagesToClipboard();
91   void setMessageFontSize(int size);
92   void changeMessageFontSize(int incr);
93   void fillRecentHistoryMenu();
94 };
95 
96 void file_quit_cb(Fl_Widget *w, void *data);
97 void file_watch_cb(Fl_Widget *w, void *data);
98 void mod_geometry_cb(Fl_Widget *w, void *data);
99 void mod_mesh_cb(Fl_Widget *w, void *data);
100 void mod_solver_cb(Fl_Widget *w, void *data);
101 void mod_post_cb(Fl_Widget *w, void *data);
102 void mod_back_cb(Fl_Widget *w, void *data);
103 void mod_forward_cb(Fl_Widget *w, void *data);
104 void geometry_reload_cb(Fl_Widget *w, void *data);
105 void onelab_reload_cb(Fl_Widget *w, void *data);
106 void mesh_1d_cb(Fl_Widget *w, void *data);
107 void mesh_2d_cb(Fl_Widget *w, void *data);
108 void mesh_3d_cb(Fl_Widget *w, void *data);
109 void help_about_cb(Fl_Widget *w, void *data);
110 void status_xyz1p_cb(Fl_Widget *w, void *data);
111 void status_options_cb(Fl_Widget *w, void *data);
112 void status_play_manual(int time, int incr, bool redraw = true);
113 void quick_access_cb(Fl_Widget *w, void *data);
114 void show_hide_message_cb(Fl_Widget *w, void *data);
115 void show_hide_menu_cb(Fl_Widget *w, void *data);
116 void attach_detach_menu_cb(Fl_Widget *w, void *data);
117 
118 #endif
119