GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Figure.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2011-2015 Michael Goffioul
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #ifndef __QtHandles_Figure__
24 #define __QtHandles_Figure__ 1
25 
26 #include <QRect>
27 
28 #include "GenericEventNotify.h"
29 #include "MenuContainer.h"
30 #include "Object.h"
31 
32 class QMainWindow;
33 class QToolBar;
34 
35 namespace QtHandles
36 {
37 
39 {
40  // NOTE: These values must match the order of the buttons in the
41  // MouseModeActionGroup object.
42 
43  NoMode = 0,
47  PanMode = 4,
48  TextMode = 5,
50 };
51 
52 class Container;
53 class FigureWindow;
54 class MenuBar;
55 class ToolBar;
56 
57 class MouseModeActionGroup;
58 
59 class Figure :
60  public Object,
61  public MenuContainer,
63 {
64  Q_OBJECT
65 
66  friend class ToolBar;
67 
68 public:
69  Figure (const graphics_object& go, FigureWindow* win);
70  ~Figure (void);
71 
72  static Figure* create (const graphics_object& go);
73 
74  QString fileName (void);
75  void setFileName (const QString& name);
76 
77  MouseMode mouseMode (void);
78 
79  Container* innerContainer (void);
80  QWidget* menu (void);
81 
82  bool eventNotifyBefore (QObject* watched, QEvent* event);
83  void eventNotifyAfter (QObject* watched, QEvent* event);
84 
85 protected:
87  {
91  };
92 
93 protected:
94  void redraw (void);
95  void print (const QString& file_cmd, const QString& term);
96  void update (int pId);
97  void updateBoundingBox (bool internal = false, int flags = 0);
98  void beingDeleted (void);
99 
100 private:
101  void createFigureToolBarAndMenuBar (void);
102  void showFigureToolBar (bool visible);
103  void showMenuBar (bool visible);
104  void addCustomToolBar (QToolBar* bar, bool visible);
105  void showCustomToolBar (QToolBar* bar, bool visible);
106 
107  void updateFigureToolBarAndMenuBar (void);
108 
109  static void updateBoundingBoxHelper (void*);
110 
111  void save_figure_callback (const std::string& file);
112  void copy_figure_callback (const std::string& format);
113 
114 private slots:
115  void setMouseMode (MouseMode mode);
116  void fileSaveFigure (bool prompt = false);
117  void fileSaveFigureAs (void);
118  void fileCloseFigure (void);
119  void editCopy (bool choose_format = false);
120  void helpAboutQtHandles (void);
121  void updateMenuBar (void);
122  void updateContainer (void);
123  void toggleAxes (void);
124  void toggleGrid (void);
125  void autoAxes (void);
126 
127 signals:
128  void asyncUpdate (void);
129 
130 private:
133  QToolBar* m_figureToolBar;
135  QRect m_innerRect;
136  QRect m_outerRect;
138 };
139 
140 }; // namespace QtHandles
141 
142 #endif
void fileSaveFigure(bool prompt=false)
Definition: Figure.cc:781
void update(int pId)
Definition: Figure.cc:399
QWidget * menu(void)
Definition: Figure.cc:555
QString fileName(void)
Definition: Figure.cc:241
QRect m_outerRect
Definition: Figure.h:136
void showFigureToolBar(bool visible)
Definition: Figure.cc:488
void fileCloseFigure(void)
Definition: Figure.cc:846
static void updateBoundingBoxHelper(void *)
Definition: Figure.cc:569
Container * m_container
Definition: Figure.h:131
MouseMode
Definition: Figure.h:38
void showCustomToolBar(QToolBar *bar, bool visible)
Definition: Figure.cc:902
void beingDeleted(void)
Definition: Figure.cc:386
void editCopy(bool choose_format=false)
Definition: Figure.cc:852
Figure(const graphics_object &go, FigureWindow *win)
Definition: Figure.cc:126
void updateMenuBar(void)
Definition: Figure.cc:545
void showMenuBar(bool visible)
Definition: Figure.cc:510
void updateContainer(void)
Definition: Figure.cc:926
void setMouseMode(MouseMode mode)
Definition: Figure.cc:763
void addCustomToolBar(QToolBar *bar, bool visible)
Definition: Figure.cc:876
void asyncUpdate(void)
Definition: moc-Figure.cc:136
void copy_figure_callback(const std::string &format)
Definition: Figure.cc:820
void helpAboutQtHandles(void)
Definition: Figure.cc:756
void fileSaveFigureAs(void)
Definition: Figure.cc:840
void createFigureToolBarAndMenuBar(void)
Definition: Figure.cc:284
MouseModeActionGroup * m_mouseModeGroup
Definition: Figure.h:137
void eventNotifyAfter(QObject *watched, QEvent *event)
Definition: Figure.cc:691
MenuBar * m_menuBar
Definition: Figure.h:134
void toggleGrid(void)
Definition: Figure.cc:941
bool eventNotifyBefore(QObject *watched, QEvent *event)
Definition: Figure.cc:646
Container * innerContainer(void)
Definition: Figure.cc:348
void autoAxes(void)
Definition: Figure.cc:950
QRect m_innerRect
Definition: Figure.h:135
void toggleAxes(void)
Definition: Figure.cc:932
bool m_blockUpdates
Definition: Figure.h:132
QToolBar * m_figureToolBar
Definition: Figure.h:133
void print(const QString &file_cmd, const QString &term)
Definition: Figure.cc:377
MouseMode mouseMode(void)
Definition: Figure.cc:263
static Figure * create(const graphics_object &go)
Definition: Figure.cc:121
void updateFigureToolBarAndMenuBar(void)
Definition: Figure.cc:337
void redraw(void)
Definition: Figure.cc:354
void updateBoundingBox(bool internal=false, int flags=0)
Definition: Figure.cc:587
void save_figure_callback(const std::string &file)
Definition: Figure.cc:814
void setFileName(const QString &name)
Definition: Figure.cc:253