GNU Octave
4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
octave-dock-widget.h
Go to the documentation of this file.
1
/*
2
3
Copyright (C) 2012-2018 Richard Crozier
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
9
the Free Software Foundation, either version 3 of the License, or
10
(at your option) any later version.
11
12
Octave is distributed in the hope that it will be useful, but
13
WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License 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
<https://www.gnu.org/licenses/>.
20
21
*/
22
23
#if ! defined (octave_octave_dock_widget_h)
24
#define octave_octave_dock_widget_h 1
25
26
#include <QDockWidget>
27
#include <QSettings>
28
#include <QIcon>
29
#include <QMainWindow>
30
#include <QToolButton>
31
#include <QMouseEvent>
32
33
namespace
octave
34
{
35
36
// The few decoration items common to both main window and variable editor.
37
38
class
label_dock_widget
:
public
QDockWidget
39
{
40
Q_OBJECT
41
42
public
:
43
44
label_dock_widget
(
QWidget
*
p
=
nullptr
);
45
46
void
set_title
(
const
QString&);
47
48
protected
slots:
49
50
//! Slots to handle copy & paste.
51
//!@{
52
virtual
void
copyClipboard
(
void
) { }
53
virtual
void
pasteClipboard
(
void
) { }
54
virtual
void
selectAll
(
void
) { }
55
//!@}
56
57
//! Slot to handle undo.
58
59
virtual
void
do_undo
(
void
) { }
60
61
protected
:
62
63
int
m_icon_size
;
64
QWidget
*
m_title_widget
;
65
QToolButton
*
m_dock_button
;
66
QToolButton
*
m_close_button
;
67
QAction *
m_dock_action
;
68
QAction *
m_close_action
;
69
};
70
71
class
octave_dock_widget
:
public
label_dock_widget
72
{
73
Q_OBJECT
74
75
public
:
76
77
octave_dock_widget
(
QWidget
*
p
=
nullptr
);
78
79
virtual
~octave_dock_widget
(
void
) =
default
;
80
81
virtual
void
connect_visibility_changed
(
void
);
82
83
void
make_window
(
void
);
84
void
make_widget
(
bool
dock=
true
);
85
void
set_predecessor_widget
(
octave_dock_widget
*prev_widget);
86
87
signals:
88
89
//! Custom signal that tells whether a user has clicked away that dock
90
//! widget, i.e the active dock widget has changed.
91
92
void
active_changed
(
bool
active);
93
94
protected
:
95
96
virtual
void
closeEvent
(QCloseEvent *
e
);
97
98
QWidget
*
focusWidget
(
void
);
99
100
public
slots:
101
102
virtual
void
focus
(
void
)
103
{
104
if
(! isVisible ())
105
setVisible (
true
);
106
107
setFocus ();
108
activateWindow ();
109
raise
();
110
}
111
112
virtual
void
handle_visibility
(
bool
visible)
113
{
114
if
(visible && ! isFloating ())
115
focus
();
116
}
117
118
virtual
void
notice_settings
(
const
QSettings*) { }
119
120
void
handle_settings
(
const
QSettings*);
121
122
void
handle_active_dock_changed
(
octave_dock_widget
*,
octave_dock_widget
*);
123
124
QMainWindow
*
main_win
(
void
) {
return
m_parent
; }
125
126
void
save_settings
(
void
);
127
128
protected
slots:
129
130
//! Slot to steer changing visibility from outside.
131
132
virtual
void
handle_visibility_changed
(
bool
visible)
133
{
134
if
(visible)
135
emit
active_changed
(
true
);
136
}
137
138
//! Event filter for double clicks into the window decoration elements.
139
140
bool
eventFilter
(
QObject
*obj, QEvent *
e
);
141
142
private
slots:
143
144
void
change_floating
(
bool
);
145
void
change_visibility
(
bool
);
146
147
private
:
148
149
void
set_style
(
bool
active);
150
void
set_focus_predecessor
(
void
);
151
152
//! Stores the parent, since we are reparenting to 0.
153
154
QMainWindow
*
m_parent
;
155
156
bool
m_floating
;
157
bool
m_custom_style
;
158
int
m_title_3d
;
159
QColor
m_bg_color
;
160
QColor
m_bg_color_active
;
161
QColor
m_fg_color
;
162
QColor
m_fg_color_active
;
163
QString
m_icon_color
;
164
QString
m_icon_color_active
;
165
octave_dock_widget
*
m_predecessor_widget
;
166
167
};
168
}
169
170
#endif
octave
Definition:
aepbalance.cc:44
QDockWidget
octave::octave_dock_widget::notice_settings
virtual void notice_settings(const QSettings *)
Definition:
octave-dock-widget.h:118
octave::label_dock_widget::m_close_action
QAction * m_close_action
Definition:
octave-dock-widget.h:68
octave::octave_dock_widget::set_predecessor_widget
void set_predecessor_widget(octave_dock_widget *prev_widget)
Definition:
octave-dock-widget.cc:230
octave::octave_dock_widget
Definition:
octave-dock-widget.h:71
octave::octave_dock_widget::handle_visibility_changed
virtual void handle_visibility_changed(bool visible)
Slot to steer changing visibility from outside.
Definition:
octave-dock-widget.h:132
octave::label_dock_widget::m_title_widget
QWidget * m_title_widget
Definition:
octave-dock-widget.h:64
QWidget
octave::label_dock_widget::selectAll
virtual void selectAll(void)
Slots to handle copy & paste.
Definition:
octave-dock-widget.h:54
octave::octave_dock_widget::active_changed
void active_changed(bool active)
Custom signal that tells whether a user has clicked away that dock widget, i.e the active dock widget...
octave::octave_dock_widget::focusWidget
QWidget * focusWidget(void)
Definition:
octave-dock-widget.cc:246
octave::octave_dock_widget::set_focus_predecessor
void set_focus_predecessor(void)
Definition:
octave-dock-widget.cc:452
octave::label_dock_widget::copyClipboard
virtual void copyClipboard(void)
Slots to handle copy & paste.
Definition:
octave-dock-widget.h:52
octave::octave_dock_widget::m_icon_color_active
QString m_icon_color_active
Definition:
octave-dock-widget.h:164
octave::label_dock_widget::label_dock_widget
label_dock_widget(QWidget *p=nullptr)
Definition:
octave-dock-widget.cc:41
octave::octave_dock_widget::change_floating
void change_floating(bool)
Definition:
octave-dock-widget.cc:358
QObject
octave::octave_dock_widget::m_custom_style
bool m_custom_style
Definition:
octave-dock-widget.h:157
octave::octave_dock_widget::m_parent
QMainWindow * m_parent
Stores the parent, since we are reparenting to 0.
Definition:
octave-dock-widget.h:154
e
i e
Definition:
data.cc:2591
octave::octave_dock_widget::handle_visibility
virtual void handle_visibility(bool visible)
Definition:
octave-dock-widget.h:112
octave::label_dock_widget::m_icon_size
int m_icon_size
Definition:
octave-dock-widget.h:63
octave::octave_dock_widget::octave_dock_widget
octave_dock_widget(QWidget *p=nullptr)
Definition:
octave-dock-widget.cc:104
octave::label_dock_widget::m_dock_button
QToolButton * m_dock_button
Definition:
octave-dock-widget.h:65
octave::octave_dock_widget::m_fg_color
QColor m_fg_color
Definition:
octave-dock-widget.h:161
octave::octave_dock_widget::m_fg_color_active
QColor m_fg_color_active
Definition:
octave-dock-widget.h:162
octave::label_dock_widget::pasteClipboard
virtual void pasteClipboard(void)
Slots to handle copy & paste.
Definition:
octave-dock-widget.h:53
octave::octave_dock_widget::m_bg_color
QColor m_bg_color
Definition:
octave-dock-widget.h:159
octave::octave_dock_widget::main_win
QMainWindow * main_win(void)
Definition:
octave-dock-widget.h:124
octave::octave_dock_widget::m_title_3d
int m_title_3d
Definition:
octave-dock-widget.h:158
octave::octave_dock_widget::save_settings
void save_settings(void)
Definition:
octave-dock-widget.cc:321
octave::octave_dock_widget::handle_settings
void handle_settings(const QSettings *)
Definition:
octave-dock-widget.cc:254
octave::label_dock_widget::set_title
void set_title(const QString &)
Definition:
octave-dock-widget.cc:93
octave::octave_dock_widget::handle_active_dock_changed
void handle_active_dock_changed(octave_dock_widget *, octave_dock_widget *)
Definition:
octave-dock-widget.cc:304
octave::octave_dock_widget::m_predecessor_widget
octave_dock_widget * m_predecessor_widget
Definition:
octave-dock-widget.h:165
octave::label_dock_widget::do_undo
virtual void do_undo(void)
Slot to handle undo.
Definition:
octave-dock-widget.h:59
octave::octave_dock_widget::connect_visibility_changed
virtual void connect_visibility_changed(void)
Definition:
octave-dock-widget.cc:141
octave::octave_dock_widget::make_widget
void make_widget(bool dock=true)
Definition:
octave-dock-widget.cc:191
octave::octave_dock_widget::closeEvent
virtual void closeEvent(QCloseEvent *e)
Definition:
octave-dock-widget.cc:237
octave::octave_dock_widget::make_window
void make_window(void)
Definition:
octave-dock-widget.cc:150
octave::octave_dock_widget::~octave_dock_widget
virtual ~octave_dock_widget(void)=default
octave::octave_dock_widget::m_bg_color_active
QColor m_bg_color_active
Definition:
octave-dock-widget.h:160
QMainWindow
octave::octave_dock_widget::eventFilter
bool eventFilter(QObject *obj, QEvent *e)
Event filter for double clicks into the window decoration elements.
Definition:
octave-dock-widget.cc:345
p
p
Definition:
lu.cc:138
octave::octave_dock_widget::m_icon_color
QString m_icon_color
Definition:
octave-dock-widget.h:163
octave::octave_dock_widget::focus
virtual void focus(void)
Definition:
octave-dock-widget.h:102
octave::octave_dock_widget::change_visibility
void change_visibility(bool)
Definition:
octave-dock-widget.cc:371
octave::label_dock_widget::m_dock_action
QAction * m_dock_action
Definition:
octave-dock-widget.h:67
octave::octave_dock_widget::set_style
void set_style(bool active)
Definition:
octave-dock-widget.cc:378
octave::label_dock_widget::m_close_button
QToolButton * m_close_button
Definition:
octave-dock-widget.h:66
octave::label_dock_widget
Definition:
octave-dock-widget.h:38
QToolButton
octave::octave_dock_widget::m_floating
bool m_floating
Definition:
octave-dock-widget.h:156
libgui
src
octave-dock-widget.h
Generated on Sat Sep 1 2018 14:01:37 for GNU Octave by
1.8.14