LibrePCB Developers Documentation
Loading...
Searching...
No Matches
windowtab.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_EDITOR_WINDOWTAB_H
21#define LIBREPCB_EDITOR_WINDOWTAB_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "appwindow.h"
27
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36
37class LengthUnit;
38class Point;
39
40namespace editor {
41
42class GuiApplication;
43class MainWindow;
44
45/*******************************************************************************
46 * Class WindowTab
47 ******************************************************************************/
48
52class WindowTab : public QObject {
53 Q_OBJECT
54
55public:
56 // Signals
58
59 // Constructors / Destructor
60 WindowTab() = delete;
61 WindowTab(const WindowTab& other) = delete;
62 explicit WindowTab(GuiApplication& app, QObject* parent = nullptr) noexcept;
63 virtual ~WindowTab() noexcept;
64
65 // General Methods
66 virtual void setWindow(MainWindow* w) noexcept { mWindow = w; }
67 virtual ui::TabData getUiData() const noexcept = 0;
68 virtual void setUiData(const ui::TabData& data) noexcept;
69 virtual void activate() noexcept {}
70 virtual void deactivate() noexcept {}
71 virtual void trigger(ui::TabAction a) noexcept;
72 virtual slint::Image renderScene(float width, float height,
73 int scene) noexcept;
74 virtual bool processScenePointerEvent(
75 const QPointF& pos, slint::private_api::PointerEvent e) noexcept;
76 virtual bool processSceneScrolled(
77 const QPointF& pos, slint::private_api::PointerScrollEvent e) noexcept;
78 virtual bool processSceneKeyEvent(
79 const slint::private_api::KeyEvent& e) noexcept;
80
93 virtual bool requestClose() noexcept { return true; }
94
95 // Operator Overloadings
96 WindowTab& operator=(const WindowTab& rhs) = delete;
97
98signals:
99 void panelPageRequested(ui::PanelPage p);
102 void statusBarMessageChanged(const QString& message, int timeoutMs);
103 void cursorCoordinatesChanged(const Point& pos, const LengthUnit& unit);
104
105protected:
106 QWidget* getWindow() const noexcept;
107
108protected:
111};
112
113/*******************************************************************************
114 * End of File
115 ******************************************************************************/
116
117} // namespace editor
118} // namespace librepcb
119
120#endif
The LengthUnit class represents a length unit (millimeters, inches,...) and provides some useful meth...
Definition lengthunit.h:62
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5....
Definition point.h:78
The Signal class is used to emit signals on non-QObject derived classes.
Definition signalslot.h:65
The GuiApplication class.
Definition guiapplication.h:75
The MainWindow class.
Definition mainwindow.h:59
The WindowTab class.
Definition windowtab.h:52
virtual slint::Image renderScene(float width, float height, int scene) noexcept
Definition windowtab.cpp:68
virtual void deactivate() noexcept
Definition windowtab.h:70
virtual void activate() noexcept
Definition windowtab.h:69
void cursorCoordinatesChanged(const Point &pos, const LengthUnit &unit)
virtual bool processSceneKeyEvent(const slint::private_api::KeyEvent &e) noexcept
Definition windowtab.cpp:90
virtual void setUiData(const ui::TabData &data) noexcept
Definition windowtab.cpp:50
void statusBarMessageChanged(const QString &message, int timeoutMs)
WindowTab(const WindowTab &other)=delete
virtual bool processSceneScrolled(const QPointF &pos, slint::private_api::PointerScrollEvent e) noexcept
Definition windowtab.cpp:83
MainWindow * mWindow
Definition windowtab.h:110
virtual ui::TabData getUiData() const noexcept=0
void panelPageRequested(ui::PanelPage p)
virtual bool requestClose() noexcept
Request to close the tab.
Definition windowtab.h:93
virtual void trigger(ui::TabAction a) noexcept
Definition windowtab.cpp:54
QWidget * getWindow() const noexcept
Definition windowtab.cpp:100
virtual bool processScenePointerEvent(const QPointF &pos, slint::private_api::PointerEvent e) noexcept
Definition windowtab.cpp:76
WindowTab & operator=(const WindowTab &rhs)=delete
Signal< WindowTab > onUiDataChanged
Definition windowtab.h:57
virtual void setWindow(MainWindow *w) noexcept
Definition windowtab.h:66
GuiApplication & mApp
Definition windowtab.h:109
Definition occmodel.cpp:77