API Documentation
Loading...
Searching...
No Matches
SectionContent.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: Widgets
28File: SectionContent
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/ButtonDialog.h>
35#include <NDEVR/RibbonArea.h>
36#include <NDEVR/UUID.h>
37#include <NDEVR/TranslatedString.h>
38#include <functional>
39class QWidget;
40
41namespace NDEVR
42{
43 class SectionTab;
44 class ContainerWidgetBase;
45 class FloatingWidget;
47 {
48 friend class ContainerWidgetBase;
49
50 private:
51
52 SectionContent(const SectionContent&) = delete;
54
55 SectionContent& operator=(const SectionContent&) = delete;
56
57 public:
58 SectionContent(ContainerWidgetBase* container, SectionTab* title, QWidget* content, RibbonArea prefered_ribbon_area);
59 SectionContent(ContainerWidgetBase* container, SectionTab* title, const std::function<void(SectionContent*)>& function, RibbonArea prefered_ribbon_area);
60 virtual ~SectionContent();
61 void onCheckedClick() override;
62 void setContainer(ContainerWidgetBase* container);
63 void setSectionWidget(SectionWidget* widget);
64 void setFloatingWidget(FloatingWidget* widget);
65 const TranslatedString& title() const { return m_title; }
66 void setTitle(const TranslatedString& title) { m_title = title; }
67 SectionWidget* sectionWidget() const { return m_section_widget; }
68 FloatingWidget* floatingWidget() const { return m_floating_widget; }
69 UUID uid() const;
70 ContainerWidgetBase* containerWidget() const;
71 SectionTab* sectionTab() const;
72 QWidget* contentWidget() const;
73 void setContentWidget(QWidget* widget);
74 RibbonArea preferredRibbonArea() const { return m_prefered_ribbon_area; }
75 void setPreferredRibbonArea(RibbonArea area);
76 const std::function<void(SectionContent*)>& specialCallback() { return m_special_callback; }
77 bool hasSpecialCallback() const { return m_special_callback != nullptr; }
78 void setSpecialCallback(const std::function<void(SectionContent*)>& callback) { m_special_callback = callback; }
79 void runSpecialCallback() { m_special_callback(this); }
80 void setAllowHide(bool allow_hide) { m_allow_hide = allow_hide; }
81 bool allowHide() const { return m_allow_hide; }
82 void setAllowAutoHideTitle(bool allow_hide) { m_allow_auto_hide_title = allow_hide; }
83 bool allowAutoHideTitle() const { return m_allow_auto_hide_title; }
84 void retranslate();
85 private:
86 const UUID m_uid;
87
88 ContainerWidgetBase* m_container_widget;
89 SectionTab* m_title_widget;
90 SectionWidget* m_section_widget;
91 FloatingWidget* m_floating_widget;
92 std::function<void(SectionContent*)> m_special_callback;
93 QWidget* m_widget;
94 // Optional attributes
95 TranslatedString m_title;
96
97 RibbonArea m_prefered_ribbon_area;
98 bool m_allow_hide;
99 bool m_allow_auto_hide_title = false;
100 };
101}
#define NDEVR_WIDGETS_API
Definition DLLInfo.h:81
Definition ButtonDialog.h:41
Definition ContainerWidget.h:85
Definition FloatingWidget.h:45
Definition SectionContent.h:47
bool allowHide() const
Definition SectionContent.h:81
void runSpecialCallback()
Definition SectionContent.h:79
bool hasSpecialCallback() const
Definition SectionContent.h:77
RibbonArea preferredRibbonArea() const
Definition SectionContent.h:74
void setTitle(const TranslatedString &title)
Definition SectionContent.h:66
void setAllowHide(bool allow_hide)
Definition SectionContent.h:80
bool allowAutoHideTitle() const
Definition SectionContent.h:83
void setSpecialCallback(const std::function< void(SectionContent *)> &callback)
Definition SectionContent.h:78
SectionWidget * sectionWidget() const
Definition SectionContent.h:67
void setAllowAutoHideTitle(bool allow_hide)
Definition SectionContent.h:82
FloatingWidget * floatingWidget() const
Definition SectionContent.h:68
const std::function< void(SectionContent *)> & specialCallback()
Definition SectionContent.h:76
Definition SectionTab.h:44
Definition SectionWidget.h:55
Definition TranslatedString.h:9
Definition UUID.h:66
Definition ACIColor.h:37
RibbonArea
Definition RibbonArea.h:68
Definition File.h:213