• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kde-runtime API Reference
  • KDE Home
  • Contact Us
 

PlasmaCore

  • sources
  • kde-4.14
  • kde-runtime
  • plasma
  • declarativeimports
  • core
dialog.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 Marco Martin <mart@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Library General Public License as
6  * published by the Free Software Foundation; either version 2, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef DIALOG_PROXY_P
21 #define DIALOG_PROXY_P
22 
23 #include <QDeclarativeItem>
24 #include <QWeakPointer>
25 #include <QPoint>
26 
27 #include <Plasma/Plasma>
28 
29 class QGraphicsObject;
30 
31 namespace Plasma
32 {
33  class Dialog;
34 }
35 
36 class DeclarativeItemContainer;
37 
38 class DialogMargins : public QObject
39 {
40  Q_OBJECT
41 
45  Q_PROPERTY(int left READ left NOTIFY leftChanged)
46 
47 
50  Q_PROPERTY(int top READ top NOTIFY topChanged)
51 
55  Q_PROPERTY(int right READ right NOTIFY rightChanged)
56 
60  Q_PROPERTY(int bottom READ bottom NOTIFY bottomChanged)
61 
62 public:
63  DialogMargins(Plasma::Dialog *dialog, QObject *parent = 0);
64 
65  int left() const;
66  int top() const;
67  int right() const;
68  int bottom() const;
69 
70 Q_SIGNALS:
71  void leftChanged();
72  void rightChanged();
73  void topChanged();
74  void bottomChanged();
75 
76 protected:
77  void checkMargins();
78 
79 private:
80  int m_left;
81  int m_top;
82  int m_right;
83  int m_bottom;
84  Plasma::Dialog *m_dialog;
85  friend class DialogProxy;
86 };
87 
93 class DialogProxy : public QDeclarativeItem
94 {
95  Q_OBJECT
96 
100  Q_PROPERTY(QGraphicsObject *mainItem READ mainItem WRITE setMainItem NOTIFY mainItemChanged)
101 
102 
105  Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
106 
110  Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged)
111 
115  Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged)
116  //to set the size try to force doing so from the inner item
117 
121  Q_PROPERTY(int width READ width NOTIFY widthChanged)
122 
126  Q_PROPERTY(int height READ height NOTIFY heightChanged)
127 
131  Q_PROPERTY(int windowFlags READ windowFlags WRITE setWindowFlags)
132 
137  Q_PROPERTY(QObject *margins READ margins CONSTANT)
138 
142  Q_PROPERTY(bool activeWindow READ isActiveWindow NOTIFY activeWindowChanged)
143 
147  Q_PROPERTY(int location READ location WRITE setLocation NOTIFY locationChanged)
148 //This won't be available on windows, but should be used only by kwin and never by applets anyways
149 #ifndef Q_WS_WIN
150 
153  Q_PROPERTY(qulonglong windowId READ windowId CONSTANT)
154 #endif
155 
156 public:
157  enum WidgetAttribute {
158  WA_X11NetWmWindowTypeDock = Qt::WA_X11NetWmWindowTypeDock
159  };
160 
161  DialogProxy(QDeclarativeItem *parent = 0);
162  ~DialogProxy();
163 
164  QGraphicsObject *mainItem() const;
165  void setMainItem(QGraphicsObject *mainItem);
166 
167  bool isVisible() const;
168  void setVisible(const bool visible);
169 
170  int x() const;
171  void setX(int x);
172 
173  int y() const;
174  void setY(int y);
175 
176  int width() const;
177  int height() const;
178 
179  bool isActiveWindow() const;
180 
185  Q_INVOKABLE void activateWindow();
186 
187  //FIXME: passing an int is ugly
188  int windowFlags() const;
189  void setWindowFlags(const int);
190 
191  int location() const;
192  void setLocation(int location);
193 
194  QObject *margins() const;
195 
196 #ifndef Q_WS_WIN
197  qulonglong windowId() const;
198 #endif
199 
205  //FIXME: alignment should be Qt::AlignmentFlag
206  Q_INVOKABLE QPoint popupPosition(QGraphicsObject *item, int alignment=Qt::AlignLeft) ;
207 
214  //FIXME:: Qt::WidgetAttribute should be already
215  Q_INVOKABLE void setAttribute(int attribute, bool on);
216 
217 Q_SIGNALS:
218  void mainItemChanged();
219  void visibleChanged();
220  void xChanged();
221  void yChanged();
222  void widthChanged();
223  void heightChanged();
224  void activeWindowChanged();
225  void locationChanged();
226 
227 protected Q_SLOTS:
228  void syncMainItem();
229 
230 protected:
231  bool eventFilter(QObject *watched, QEvent *event);
232 
233 private:
234  Plasma::Dialog *m_dialog;
235  Qt::WindowFlags m_flags;
236  DeclarativeItemContainer *m_declarativeItemContainer;
237  QWeakPointer<QGraphicsObject> m_mainItem;
238  DialogMargins *m_margins;
239  bool m_activeWindow;
240  Plasma::Location m_location;
241  static int offscreenX;
242  static int offscreenY;
243 };
244 
245 #endif
QEvent
DeclarativeItemContainer
Definition: declarativeitemcontainer_p.h:29
DialogProxy::WidgetAttribute
WidgetAttribute
Definition: dialog.h:157
DialogMargins::checkMargins
void checkMargins()
Definition: dialog.cpp:49
DialogMargins::DialogProxy
friend class DialogProxy
Definition: dialog.h:85
DialogProxy
QML wrapper for kdelibs Plasma::Dialog.
Definition: dialog.h:93
DialogMargins::bottomChanged
void bottomChanged()
QPoint
DialogMargins::bottom
int bottom() const
QObject::event
virtual bool event(QEvent *e)
QObject
QObject::eventFilter
virtual bool eventFilter(QObject *watched, QEvent *event)
QGraphicsObject
DialogMargins::leftChanged
void leftChanged()
DialogMargins::top
int top() const
DialogMargins
Definition: dialog.h:38
QWeakPointer< QGraphicsObject >
DialogMargins::left
int left() const
Qt::WindowFlags
typedef WindowFlags
QDeclarativeItem
QObject::parent
QObject * parent() const
DialogMargins::right
int right() const
DialogMargins::rightChanged
void rightChanged()
DialogMargins::topChanged
void topChanged()
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:08:28 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

PlasmaCore

Skip menu "PlasmaCore"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kde-runtime API Reference

Skip menu "kde-runtime API Reference"
  • KCMShell
  • KNotify
  • Plasma Runtime
  •     PlasmaCore
  •     DragAndDrop
  •     PlasmaComponents
  •     PlasmaExtraComponents
  •     QtExtraComponents

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal