annotate gui/src/m-editor/file-editor-interface.h @ 14707:674740c44c09 gui

Changed various files to matche file naming conventions.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Thu, 31 May 2012 22:19:53 +0200
parents gui/src/editor/fileeditorinterface.h@f86884be20fc
children f50591409306
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
1 /* OctaveGUI - A graphical user interface for Octave
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
2 * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
3 *
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
4 * This program is free software: you can redistribute it and/or modify
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
6 * published by the Free Software Foundation, either version 3 of the
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
7 * License, or (at your option) any later version.
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
8 *
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
12 * GNU General Public License for more details.
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
13 *
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
16 */
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
17
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
18 #ifndef FILEEDITORINTERFACE_H
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
19 #define FILEEDITORINTERFACE_H
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
20
14681
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
21 #include <QDockWidget>
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
22
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
23 class QTerminal;
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
24 class MainWindow;
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
25
14681
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
26 class FileEditorInterface : public QDockWidget
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
27 {
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
28 Q_OBJECT
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
29
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
30 public:
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
31 FileEditorInterface (QTerminal *terminal, MainWindow *mainWindow)
14681
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
32 : QDockWidget ((QWidget*)mainWindow) // QDockWidget constructor is explicit, hence the cast.
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
33 {
14681
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
34 setObjectName ("FileEditor");
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
35 m_terminal = terminal;
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
36 m_mainWindow = mainWindow;
14681
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
37
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
38 connect (this, SIGNAL (visibilityChanged (bool)), this, SLOT (handleVisibilityChanged (bool)));
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
39 }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
40
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
41 virtual ~FileEditorInterface () { }
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
42 public slots:
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
43 virtual void requestNewFile () = 0;
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
44 virtual void requestOpenFile () = 0;
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
45 virtual void requestOpenFile (QString fileName) = 0;
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
46
14681
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
47 signals:
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
48 void activeChanged (bool active);
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
49
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
50 protected:
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
51 QTerminal* m_terminal;
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
52 MainWindow* m_mainWindow;
14681
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
53
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
54 void closeEvent (QCloseEvent *event)
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
55 {
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
56 emit activeChanged (false);
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
57 QDockWidget::closeEvent (event);
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
58 }
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
59
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
60 protected slots:
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
61 void handleVisibilityChanged (bool visible)
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
62 {
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
63 if (visible)
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
64 emit activeChanged (true);
66ff321cb62e Integrated the editor to be docked with the other widgets.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14676
diff changeset
65 }
14676
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
66 };
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
67
35512b788af2 Editor can now handle multiple files in tabs.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
68 #endif // FILEEDITORINTERFACE_H