API Documentation
Loading...
Searching...
No Matches
DesignObjectDialog.h
Go to the documentation of this file.
1/**--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: NDEVR
28File: DesignObjectDialog
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/QTDesignObject.h>
35#include <NDEVR/ShowPropertiesSettings.h>
36#include <NDEVR/QCustomDockWidget.h>
37#include <NDEVR/Pointer.h>
38#include <NDEVR/UnitManager.h>
39#include <QWidget>
40
41class QTabWidget;
42namespace NDEVR
43{
44 class Editor;
45 class ContainerWidgetBase;
46 class BasicThread;
47 class Button;
48 class QCustomTableWidget;
49 class DesignObjectDialog;
50 class QCustomTabWidget;
52 {
53 protected:
55 : generic_creation_callbacks(10)
56 {}
57 public:
59 {
60 static DesignObjectDialogFactory factory;
61 return factory;
62 }
63 void setupDialog(const String& type_name, const DynamicPointer<QTDesignObject>& object, DesignObjectDialog* dialog);
64 void addSetupCallback(const String& type, const std::function<void(DesignObjectDialog*, const DynamicPointer<QTDesignObject>&)>& callback);
65 void addSetupCallback(const std::function<void(DesignObjectDialog*, const DynamicPointer<QTDesignObject>&)>& callback);
68 };
69 class NDEVR_API DesignObjectDialog : public QWidget
70 {
71 Q_OBJECT
72 public:
75 QSize sizeHint() const;
76 void setType(const String& type);
77 void updateGUI();
78 TranslatedString getTitle() const;
79 const QTDesignObject& designObject() const;
80 void showCurrentIndex(uint04 index);
81 void setHorizontal(bool horizontal);
82 void addEditor(Editor* editor, uint04 index = Constant<uint04>::NaN);
83 void addTabDialog(QWidget* editor, uint04 index = Constant<uint04>::NaN);
84 void clearTabDialogs();
85 const DynamicPointer<QTDesignObject>& designObjectPtr() { return m_design_object; }
86 virtual bool fullscreenTouch() const;
87 virtual bool allowDocking() const;
88 virtual void enablePrint(bool enable_print);
89 void setCustomTitle(const TranslatedString& title);
90 TranslatedString title() const;
91 String icon() const;
92 virtual Buffer<QWidget*> printableWidgets();
93 const UnitManager& dialogUnits() const;
94 public:
95 //Find the dialog of type t_type and display it
96 template<class t_type>
98 {
99 for (uint04 i = 0; i < m_editors.size(); i++)
100 {
101 if (dynamic_cast<t_type*>(m_editors[i]))
102 {
103 showCurrentIndex(i);
104 return true;
105 }
106 }
107 return false;
108 }
109 signals:
116 protected slots:
117 void onDesignObjectUpdate();
118 void onCancelPressed();
119 void onConfirmPressed();
120 void checkIfBusy();
121 protected:
129 Button* m_save_button = nullptr;
130 Button* m_accept_button = nullptr;
131 Button* m_cancel_button = nullptr;
132 Button* m_print_button = nullptr;
133 Button* m_zoom_button = nullptr;
134 Button* m_units_button = nullptr;
136 };
137};
#define NDEVR_API
Definition DLLInfo.h:67
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition Button.h:60
Definition DesignObjectDialog.h:52
Dictionary< String, Buffer< std::function< void(DesignObjectDialog *, const DynamicPointer< QTDesignObject > &)> > > creation_callbacks
Definition DesignObjectDialog.h:66
static DesignObjectDialogFactory & DefaultInstance()
Definition DesignObjectDialog.h:58
Buffer< std::function< void(DesignObjectDialog *, const DynamicPointer< QTDesignObject > &)> > generic_creation_callbacks
Definition DesignObjectDialog.h:67
DesignObjectDialogFactory()
Definition DesignObjectDialog.h:54
Definition DesignObjectDialog.h:70
DynamicPointer< QTDesignObject > m_design_object
Definition DesignObjectDialog.h:126
Buffer< Editor * > m_editors
Definition DesignObjectDialog.h:123
ShowPropertiesSettings m_settings
Definition DesignObjectDialog.h:128
Buffer< QWidget * > m_tabs
Definition DesignObjectDialog.h:124
bool showSubDialog()
Definition DesignObjectDialog.h:97
TranslatedString m_custom_title
Definition DesignObjectDialog.h:122
UnitManager m_dialog_units
Definition DesignObjectDialog.h:135
SectionWidget * m_target_widget
Definition DesignObjectDialog.h:125
const DynamicPointer< QTDesignObject > & designObjectPtr()
Definition DesignObjectDialog.h:85
QCustomTabWidget * m_tab_menu
Definition DesignObjectDialog.h:127
Definition Dictionary.h:48
Definition Pointer.hpp:303
Definition Editor.h:45
Definition QCustomTabWidget.h:40
Definition QTDesignObject.h:81
Definition SectionWidget.h:55
Definition String.h:40
Definition TranslatedString.h:9
Definition UnitManager.h:126
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
Definition BaseValues.hpp:272
Definition ShowPropertySettings.h:22