ads_globals.h
Go to the documentation of this file.
1 #ifndef ads_globalsH
2 #define ads_globalsH
3 /*******************************************************************************
4 ** Qt Advanced Docking System
5 ** Copyright (C) 2017 Uwe Kindler
6 **
7 ** This library is free software; you can redistribute it and/or
8 ** modify it under the terms of the GNU Lesser General Public
9 ** License as published by the Free Software Foundation; either
10 ** version 2.1 of the License, or (at your option) any later version.
11 **
12 ** This library is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ** Lesser General Public License for more details.
16 **
17 ** You should have received a copy of the GNU Lesser General Public
18 ** License along with this library; If not, see <http://www.gnu.org/licenses/>.
19 ******************************************************************************/
20 
21 
22 //============================================================================
27 //============================================================================
28 
29 
30 //============================================================================
31 // INCLUDES
32 //============================================================================
33 #include <QPair>
34 #include <QtCore/QtGlobal>
35 #include <QPixmap>
36 #include <QWidget>
37 #include <QDebug>
38 #include <QStyle>
39 
40 #ifdef Q_OS_LINUX
41 #include <xcb/xcb.h>
42 #endif
43 
44 QT_FORWARD_DECLARE_CLASS(QAbstractButton)
45 
46 #ifndef ADS_STATIC
47 #ifdef ADS_SHARED_EXPORT
48 #define ADS_EXPORT Q_DECL_EXPORT
49 #else
50 #define ADS_EXPORT Q_DECL_IMPORT
51 #endif
52 #else
53 #define ADS_EXPORT
54 #endif
55 
56 // Define ADS_DEBUG_PRINT to enable a lot of debug output
57 #ifdef ADS_DEBUG_PRINT
58 #define ADS_PRINT(s) qDebug() << s
59 #else
60 #define ADS_PRINT(s)
61 #endif
62 
63 // Set ADS_DEBUG_LEVEL to enable additional debug output and to enable layout
64 // dumps to qDebug and std::cout after layout changes
65 #define ADS_DEBUG_LEVEL 0
66 
67 QT_FORWARD_DECLARE_CLASS(QSplitter)
68 
69 namespace ads
70 {
71 class CDockSplitter;
72 
74 {
81 
85 };
86 Q_DECLARE_FLAGS(DockWidgetAreas, DockWidgetArea)
87 
88 
90 {
94 };
95 
100 {
105 };
106 
110 enum eIcon
111 {
116 
118 };
119 
124 {
127 };
128 
129 
130 namespace internal
131 {
132 static const bool RestoreTesting = true;
133 static const bool Restore = false;
134 static const char* const ClosedProperty = "close";
135 static const char* const DirtyProperty = "dirty";
136 
137 #ifdef Q_OS_LINUX
138 // Utils to directly communicate with the X server
142 xcb_atom_t xcb_get_atom(const char *name);
143 
147 void xcb_add_prop(bool state, WId window, const char *type, const char *prop);
151 void xcb_update_prop(bool set, WId window, const char *type, const char *prop, const char *prop2 = nullptr);
155 bool xcb_dump_props(WId window, const char *type);
161 QString windowManager();
162 #endif
163 
167 void replaceSplitterWidget(QSplitter* Splitter, QWidget* From, QWidget* To);
168 
173 void hideEmptyParentSplitters(CDockSplitter* FirstParentSplitter);
174 
179 class CDockInsertParam : public QPair<Qt::Orientation, bool>
180 {
181 public:
182  using QPair::QPair;
183  Qt::Orientation orientation() const {return this->first;}
184  bool append() const {return this->second;}
185  int insertOffset() const {return append() ? 1 : 0;}
186 };
187 
191 CDockInsertParam dockAreaInsertParameters(DockWidgetArea Area);
192 
202 template <class T>
203 T findParent(const QWidget* w)
204 {
205  QWidget* parentWidget = w->parentWidget();
206  while (parentWidget)
207  {
208  T ParentImpl = qobject_cast<T>(parentWidget);
209  if (ParentImpl)
210  {
211  return ParentImpl;
212  }
213  parentWidget = parentWidget->parentWidget();
214  }
215  return 0;
216 }
217 
223 QPixmap createTransparentPixmap(const QPixmap& Source, qreal Opacity);
224 
225 
229 template <class T>
230 void setFlag(T& Flags, typename T::enum_type flag, bool on = true)
231 {
232 #if QT_VERSION >= 0x050700
233  Flags.setFlag(flag, on);
234 #else
235  if(on)
236  {
237  Flags |= flag;
238  }
239  else
240  {
241  Flags &= ~flag;
242  }
243 #endif
244 }
245 
246 
251 template <class QObjectPtr>
252 void setToolTip(QObjectPtr obj, const QString &tip)
253 {
254 #ifndef QT_NO_TOOLTIP
255  obj->setToolTip(tip);
256 #else
257  Q_UNUSED(obj);
258  Q_UNUSED(tip);
259 #endif
260 }
261 
262 
276 void setButtonIcon(QAbstractButton* Button, QStyle::StandardPixmap StandarPixmap,
277  ads::eIcon CustomIconId);
278 
279 
281 {
285 };
286 
292 
293 
294 } // namespace internal
295 } // namespace ads
296 
297 //---------------------------------------------------------------------------
298 #endif // ads_globalsH
ads::internal::dockAreaInsertParameters
CDockInsertParam dockAreaInsertParameters(DockWidgetArea Area)
Definition: ads_globals.cpp:299
ads::DockAreaMenuIcon
@ DockAreaMenuIcon
DockAreaMenuIcon.
Definition: ads_globals.h:113
ads::BitwiseOr
@ BitwiseOr
Definition: ads_globals.h:126
ads::DraggingFloatingWidget
@ DraggingFloatingWidget
DraggingFloatingWidget.
Definition: ads_globals.h:104
detail::first
auto first(const T &value, const Tail &...) -> const T &
Definition: compile.h:60
ads::internal::CDockInsertParam::orientation
Qt::Orientation orientation() const
Definition: ads_globals.h:183
detail::state
state
Definition: core.h:2305
ads::DraggingTab
@ DraggingTab
DraggingTab.
Definition: ads_globals.h:103
ads::internal::CDockInsertParam
Definition: ads_globals.h:179
backward::ColorMode::type
type
Definition: backward.hpp:3600
ads::internal::CDockInsertParam::insertOffset
int insertOffset() const
Definition: ads_globals.h:185
ads::DockWidgetArea
DockWidgetArea
Definition: ads_globals.h:73
ads::eBitwiseOperator
eBitwiseOperator
Definition: ads_globals.h:123
ads::internal::RepolishIgnoreChildren
@ RepolishIgnoreChildren
Definition: ads_globals.h:282
ads::internal::DirtyProperty
static const char *const DirtyProperty
Definition: ads_globals.h:135
ads::TitleBarButtonClose
@ TitleBarButtonClose
Definition: ads_globals.h:93
setButtonIcon
static void setButtonIcon(QPushButton *button, QIcon icon)
Definition: plot_docker_toolbar.cpp:40
ads::BitwiseAnd
@ BitwiseAnd
Definition: ads_globals.h:125
ads::eIcon
eIcon
Definition: ads_globals.h:110
ads::internal::RepolishChildrenRecursively
@ RepolishChildrenRecursively
Definition: ads_globals.h:284
ads::TitleBarButtonTabsMenu
@ TitleBarButtonTabsMenu
Definition: ads_globals.h:91
ads::AllDockAreas
@ AllDockAreas
Definition: ads_globals.h:84
ads::TitleBarButtonUndock
@ TitleBarButtonUndock
Definition: ads_globals.h:92
append
QCXXHighlighter::QCXXHighlighter(QTextDocument *document) m_highlightRule append)({ QRegularExpression(R"(#[a-zA-Z_]+)"), "Preprocessor" })
Definition: QCXXHighlighter.cpp:60
ads::internal::ClosedProperty
static const char *const ClosedProperty
Definition: ads_globals.h:134
ads::TabCloseIcon
@ TabCloseIcon
TabCloseIcon.
Definition: ads_globals.h:112
ads
Definition: ads_globals.h:69
ads::DockAreaUndockIcon
@ DockAreaUndockIcon
DockAreaUndockIcon.
Definition: ads_globals.h:114
ads::CDockSplitter
Definition: DockSplitter.h:44
ads::LeftDockWidgetArea
@ LeftDockWidgetArea
Definition: ads_globals.h:76
ads::TopDockWidgetArea
@ TopDockWidgetArea
Definition: ads_globals.h:78
robot_state_pb2.enum_type
enum_type
Definition: robot_state_pb2.py:183
ads::internal::CDockInsertParam::append
bool append() const
Definition: ads_globals.h:184
ads::eDragState
eDragState
Definition: ads_globals.h:99
ads::DockAreaCloseIcon
@ DockAreaCloseIcon
DockAreaCloseIcon.
Definition: ads_globals.h:115
ads::internal::setToolTip
void setToolTip(QObjectPtr obj, const QString &tip)
Definition: ads_globals.h:252
ads::internal::hideEmptyParentSplitters
void hideEmptyParentSplitters(CDockSplitter *FirstParentSplitter)
Definition: ads_globals.cpp:328
ads::IconCount
@ IconCount
just a delimiter for range checks
Definition: ads_globals.h:117
ads::CenterDockWidgetArea
@ CenterDockWidgetArea
Definition: ads_globals.h:80
ads::internal::replaceSplitterWidget
void replaceSplitterWidget(QSplitter *Splitter, QWidget *From, QWidget *To)
Definition: ads_globals.cpp:291
ads::internal::eRepolishChildOptions
eRepolishChildOptions
Definition: ads_globals.h:280
ads::RightDockWidgetArea
@ RightDockWidgetArea
Definition: ads_globals.h:77
ads::internal::RepolishDirectChildren
@ RepolishDirectChildren
Definition: ads_globals.h:283
ads::DraggingMousePressed
@ DraggingMousePressed
DraggingMousePressed.
Definition: ads_globals.h:102
ads::TitleBarButton
TitleBarButton
Definition: ads_globals.h:89
ads::internal::Restore
static const bool Restore
Definition: ads_globals.h:133
ads::BottomDockWidgetArea
@ BottomDockWidgetArea
Definition: ads_globals.h:79
ads::OuterDockAreas
@ OuterDockAreas
Definition: ads_globals.h:83
ads::DraggingInactive
@ DraggingInactive
DraggingInactive.
Definition: ads_globals.h:101
ads::InvalidDockWidgetArea
@ InvalidDockWidgetArea
Definition: ads_globals.h:82
ads::internal::repolishStyle
void repolishStyle(QWidget *w, eRepolishChildOptions Options=RepolishIgnoreChildren)
Definition: ads_globals.cpp:367
ads::internal::findParent
T findParent(const QWidget *w)
Definition: ads_globals.h:203
ads::internal::createTransparentPixmap
QPixmap createTransparentPixmap(const QPixmap &Source, qreal Opacity)
Definition: ads_globals.cpp:316
range_format::set
@ set
ads::internal::RestoreTesting
static const bool RestoreTesting
Definition: ads_globals.h:132
ads::NoDockWidgetArea
@ NoDockWidgetArea
Definition: ads_globals.h:75
ads::internal::setFlag
void setFlag(T &Flags, typename T::enum_type flag, bool on=true)
Definition: ads_globals.h:230


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:43