7#include <dtkcore_global.h>
8#include <dtkwidget_config.h>
10#include <QtCore/QMetaMethod>
12#define DWIDGET_NAMESPACE Widget
13#define DTK_WIDGET_NAMESPACE DTK_NAMESPACE::Widget
15#define DWIDGET_BEGIN_NAMESPACE namespace DTK_NAMESPACE { namespace DWIDGET_NAMESPACE {
16#define DWIDGET_END_NAMESPACE }}
17#define DWIDGET_USE_NAMESPACE using namespace DTK_WIDGET_NAMESPACE;
19#if defined(DTK_STATIC_LIB)
20void inline dtk_windget_init_resource()
22 Q_INIT_RESOURCE(icons);
23 Q_INIT_RESOURCE(dui_theme_dark);
24 Q_INIT_RESOURCE(dui_theme_light);
26#if defined(DTK_STATIC_TRANSLATION)
27 Q_INIT_RESOURCE(dtkwidget_translations);
37#if defined(DTK_STATIC_LIB)
38#define DWIDGET_INIT_RESOURCE() \
40 dtk_windget_init_resource(); \
47#if defined(DTK_STATIC_LIB)
48# define LIBDTKWIDGETSHARED_EXPORT
50#if defined(LIBDTKWIDGET_LIBRARY)
51# define LIBDTKWIDGETSHARED_EXPORT Q_DECL_EXPORT
53# define LIBDTKWIDGETSHARED_EXPORT Q_DECL_IMPORT
57#define DTKWIDGET_DECL_DEPRECATED D_DECL_DEPRECATED
59#define D_THEME_INIT_WIDGET(className, ...) do{\
60 DThemeManager * manager = DThemeManager::instance(); \
61 {const QString &sheet = this->styleSheet() + manager->getQssForWidget(#className, this); \
62 if (!sheet.isEmpty()) this->setStyleSheet(sheet); \
64 connect(manager, &DThemeManager::themeChanged, this, [this, manager] (QString) { \
65 const QString &sheet = manager->getQssForWidget(#className, this); \
66 if (!sheet.isEmpty()) this->setStyleSheet(sheet); \
68 connect(manager, &DThemeManager::widgetThemeChanged, this, [this, manager] (QWidget *w, QString) { \
69 if (w == this) this->setStyleSheet(manager->getQssForWidget(#className, this)); \
71 QStringList list = QString(#__VA_ARGS__).replace(" ", "").split(",");\
72 const QMetaObject *self = metaObject();\
73 Q_FOREACH (const QString &str, list) {\
76 connect(this, self->property(self->indexOfProperty(str.toLatin1().data())).notifySignal(),\
77 manager, manager->metaObject()->method(manager->metaObject()->indexOfMethod("updateQss()")));\