Mercurial > octave
diff libgui/src/octave-dock-widget.h @ 24828:0f6a261ab144
move some GUI classes inside octave namespace
* octave-dock-widget.cc, octave-dock-widget.h,
variable-editor-model.cc, variable-editor-model.h, variable-editor.cc,
variable-editor.h: Move classes inside octave namespace.
* settings-dialog.cc: Tag variable_editor with octave:: namespace.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 02 Mar 2018 15:37:31 -0500 |
parents | ed9ba20d6ed3 |
children | 6652d3823428 |
line wrap: on
line diff
--- a/libgui/src/octave-dock-widget.h Fri Mar 02 13:25:34 2018 -0500 +++ b/libgui/src/octave-dock-widget.h Fri Mar 02 15:37:31 2018 -0500 @@ -30,136 +30,141 @@ #include <QToolButton> #include <QMouseEvent> -// The few decoration items common to both main window and variable editor. -class label_dock_widget : public QDockWidget +namespace octave { - Q_OBJECT + + // The few decoration items common to both main window and variable editor. -public: - - label_dock_widget (QWidget *p = nullptr); + class label_dock_widget : public QDockWidget + { + Q_OBJECT - void set_title (const QString&); + public: -protected slots: + label_dock_widget (QWidget *p = nullptr); + + void set_title (const QString&); - //! Slots to handle copy & paste. - //!@{ - virtual void copyClipboard (void) { } - virtual void pasteClipboard (void) { } - virtual void selectAll (void) { } - //!@} + protected slots: - //! Slot to handle undo. + //! Slots to handle copy & paste. + //!@{ + virtual void copyClipboard (void) { } + virtual void pasteClipboard (void) { } + virtual void selectAll (void) { } + //!@} - virtual void do_undo (void) { } + //! Slot to handle undo. -protected: + virtual void do_undo (void) { } + + protected: - int m_icon_size; - QWidget *m_title_widget; - QToolButton *m_dock_button; - QToolButton *m_close_button; - QAction *m_dock_action; - QAction *m_close_action; -}; + int m_icon_size; + QWidget *m_title_widget; + QToolButton *m_dock_button; + QToolButton *m_close_button; + QAction *m_dock_action; + QAction *m_close_action; + }; -class octave_dock_widget : public label_dock_widget -{ - Q_OBJECT + class octave_dock_widget : public label_dock_widget + { + Q_OBJECT -public: + public: - octave_dock_widget (QWidget *p = nullptr); + octave_dock_widget (QWidget *p = nullptr); - virtual ~octave_dock_widget (void) = default; + virtual ~octave_dock_widget (void) = default; - virtual void connect_visibility_changed (void); + virtual void connect_visibility_changed (void); - void make_window (void); - void make_widget (bool dock=true); - void set_predecessor_widget (octave_dock_widget *prev_widget); + void make_window (void); + void make_widget (bool dock=true); + void set_predecessor_widget (octave_dock_widget *prev_widget); -signals: + signals: - //! Custom signal that tells whether a user has clicked away that dock - //! widget, i.e the active dock widget has changed. + //! Custom signal that tells whether a user has clicked away that dock + //! widget, i.e the active dock widget has changed. - void active_changed (bool active); + void active_changed (bool active); -protected: - - virtual void closeEvent (QCloseEvent *e); + protected: - QWidget * focusWidget (void); + virtual void closeEvent (QCloseEvent *e); -public slots: + QWidget * focusWidget (void); - virtual void focus (void) - { - if (! isVisible ()) - setVisible (true); + public slots: - setFocus (); - activateWindow (); - raise (); - } + virtual void focus (void) + { + if (! isVisible ()) + setVisible (true); + + setFocus (); + activateWindow (); + raise (); + } - virtual void handle_visibility (bool visible) - { - if (visible && ! isFloating ()) - focus (); - } + virtual void handle_visibility (bool visible) + { + if (visible && ! isFloating ()) + focus (); + } - virtual void notice_settings (const QSettings*) { } + virtual void notice_settings (const QSettings*) { } - void handle_settings (const QSettings*); + void handle_settings (const QSettings*); - void handle_active_dock_changed (octave_dock_widget*, octave_dock_widget*); + void handle_active_dock_changed (octave_dock_widget*, octave_dock_widget*); - QMainWindow * main_win (void) { return m_parent; } + QMainWindow * main_win (void) { return m_parent; } - void save_settings (void); + void save_settings (void); -protected slots: + protected slots: - //! Slot to steer changing visibility from outside. + //! Slot to steer changing visibility from outside. - virtual void handle_visibility_changed (bool visible) - { - if (visible) - emit active_changed (true); - } + virtual void handle_visibility_changed (bool visible) + { + if (visible) + emit active_changed (true); + } - //! Event filter for double clicks into the window decoration elements. + //! Event filter for double clicks into the window decoration elements. - bool eventFilter (QObject *obj, QEvent *e); + bool eventFilter (QObject *obj, QEvent *e); -private slots: + private slots: - void change_floating (bool); - void change_visibility (bool); + void change_floating (bool); + void change_visibility (bool); -private: + private: - void set_style (bool active); - void set_focus_predecessor (void); + void set_style (bool active); + void set_focus_predecessor (void); - //! Stores the parent, since we are reparenting to 0. + //! Stores the parent, since we are reparenting to 0. - QMainWindow *m_parent; + QMainWindow *m_parent; - bool m_floating; - bool m_custom_style; - int m_title_3d; - QColor m_bg_color; - QColor m_bg_color_active; - QColor m_fg_color; - QColor m_fg_color_active; - QString m_icon_color; - QString m_icon_color_active; - octave_dock_widget *m_predecessor_widget; + bool m_floating; + bool m_custom_style; + int m_title_3d; + QColor m_bg_color; + QColor m_bg_color_active; + QColor m_fg_color; + QColor m_fg_color_active; + QString m_icon_color; + QString m_icon_color_active; + octave_dock_widget *m_predecessor_widget; -}; + }; +} #endif