GNU Octave 7.1.0
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-2022 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_octave_dock_widget_h)
27#define octave_octave_dock_widget_h 1
28
29#include <QDockWidget>
30#include <QIcon>
31#include <QMouseEvent>
32#include <QToolButton>
33
34#include "gui-settings.h"
36
37namespace octave
38{
39 class base_qobject;
40 class main_window;
41
42 // The few decoration items common to both main window and variable editor.
43
45 {
46 Q_OBJECT
47
48 public:
49
51
52 ~label_dock_widget (void) = default;
53
54 // set_title() uses the custom title bar while setWindowTitle() uses
55 // the default title bar (with style sheets)
56 void set_title (const QString&);
57
58 protected slots:
59
60 //! Slots to handle copy & paste.
61 //!@{
62 virtual void copyClipboard (void) { }
63 virtual void pasteClipboard (void) { }
64 virtual void selectAll (void) { }
65 //!@}
66
67 //! Slot to handle undo.
68
69 virtual void do_undo (void) { }
70
71 protected:
72
74
79 QAction *m_dock_action;
81
82 QAbstractButton *m_default_float_button;
83 QAbstractButton *m_default_close_button;
84 };
85
87 {
88 Q_OBJECT
89
90 public:
91
92 octave_dock_widget (const QString& obj_name, QWidget *p,
93 base_qobject& oct_qobj);
94
95 ~octave_dock_widget (void) = default;
96
98
100
101 void set_adopted (bool adopted = true) { m_adopted = adopted; }
102 bool adopted (void) const { return m_adopted; }
103
104 signals:
105
106 //! Custom signal that tells whether a user has clicked away that dock
107 //! widget, i.e. the active dock widget has changed.
108
109 void active_changed (bool active);
110
111 void queue_make_window (bool widget_was_dragged);
112
113 void queue_make_widget (void);
114
115 protected:
116
117 virtual void closeEvent (QCloseEvent *e);
118
119 QWidget * focusWidget (void);
120
121 bool event (QEvent *event);
122
123 public slots:
124
125 virtual void activate (void);
126
127 virtual void handle_visibility (bool visible);
128
129 virtual void notice_settings (const gui_settings *) { }
130
131 virtual void save_settings (void);
132
133 void init_window_menu_entry (void);
134
135 void handle_settings (const gui_settings *);
136
138
139 void moveEvent (QMoveEvent *event);
140
141 void resizeEvent (QResizeEvent *event);
142
143 void make_window (bool widget_was_dragged = false);
144
145 void make_widget (bool not_used = false);
146
147 void default_dock (bool not_used = false);
148
149 protected slots:
150
151 virtual void toplevel_change (bool);
152
153 //! Event filter for double clicks into the window decoration elements.
154
155 bool eventFilter (QObject *obj, QEvent *e);
156
157 private slots:
158
159 void change_visibility (bool);
160
161 private:
162
163 void set_style (bool active);
164 void set_focus_predecessor (void);
165 void store_geometry (void);
166
167 //! Stores the parent, since we are reparenting to 0.
168
170
185 };
186}
187
188#endif
Base class for Octave interfaces that use Qt.
QAbstractButton * m_default_close_button
QAbstractButton * m_default_float_button
virtual void selectAll(void)
Slots to handle copy & paste.
label_dock_widget(QWidget *p, base_qobject &oct_qobj)
virtual void copyClipboard(void)
Slots to handle copy & paste.
virtual void do_undo(void)
Slot to handle undo.
virtual void pasteClipboard(void)
Slots to handle copy & paste.
void set_title(const QString &)
~label_dock_widget(void)=default
Represents the main window.
Definition: main-window.h:73
~octave_dock_widget(void)=default
void queue_make_window(bool widget_was_dragged)
void set_main_window(main_window *mw)
void handle_settings(const gui_settings *)
void handle_active_dock_changed(octave_dock_widget *, octave_dock_widget *)
void make_window(bool widget_was_dragged=false)
octave_dock_widget * m_predecessor_widget
bool eventFilter(QObject *obj, QEvent *e)
Event filter for double clicks into the window decoration elements.
main_window * m_main_window
Stores the parent, since we are reparenting to 0.
virtual void toplevel_change(bool)
void make_widget(bool not_used=false)
void set_predecessor_widget(octave_dock_widget *prev_widget)
void active_changed(bool active)
Custom signal that tells whether a user has clicked away that dock widget, i.e.
void resizeEvent(QResizeEvent *event)
void moveEvent(QMoveEvent *event)
virtual void closeEvent(QCloseEvent *e)
void set_adopted(bool adopted=true)
virtual void save_settings(void)
octave_dock_widget(const QString &obj_name, QWidget *p, base_qobject &oct_qobj)
virtual void handle_visibility(bool visible)
void default_dock(bool not_used=false)
virtual void notice_settings(const gui_settings *)