]> git.mar77i.info Git - bigintmandel/blob - menubar.h
make zoom_factor part of MandelSettings
[bigintmandel] / menubar.h
1
2 // menubar.h
3
4 #ifndef MENUBAR_H
5 #define MENUBAR_H
6
7 #include <QMenuBar>
8
9 #include "bigintmandelwidget.h"
10
11 class MenuBar : public QMenuBar {
12 Q_OBJECT
13
14 QMenu *file_menu;
15 QAction *load_action, *save_action;
16 QAction *export_action, *exit_action;
17 QMenu *calc_menu;
18 QAction *reset_action, *settings_action;
19 QMenu *zoom_menu;
20 QAction *no_action, *two_action, *four_action;
21 QAction *eight_action, *sixteen_action;
22 int zoom_factor;
23
24 inline void check_action() {
25 no_action->setChecked(zoom_factor == -1);
26 two_action->setChecked(zoom_factor == 2);
27 four_action->setChecked(zoom_factor == 4);
28 eight_action->setChecked(zoom_factor == 8);
29 sixteen_action->setChecked(zoom_factor == 16);
30 }
31
32 public:
33 explicit MenuBar(BigintMandelWidget *parent);
34 inline int get_zoom_factor() const { return zoom_factor; }
35 inline void set_zoom_factor(int zoom_factor) {
36 this->zoom_factor = zoom_factor;
37 check_action();
38 }
39 public Q_SLOTS:
40 void change_zoom_factor() {
41 set_zoom_factor(static_cast<QAction*>(sender())->data().toInt());
42 }
43 };
44
45 #endif // MENUBAR_H