KHtml

kjs_clientrect.h
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (C) 2013 Bernd Buschinski <[email protected]>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef KJS_CLIENTRECT_H
21 #define KJS_CLIENTRECT_H
22 
23 #include "ecma/kjs_dom.h"
24 
25 #include <kjs/object.h>
26 
27 #include <QRect>
28 #include <QList>
29 
30 namespace KJS
31 {
32 
33 class ClientRect : public JSObject
34 {
35 public:
36  ClientRect(ExecState *exec, float left, float top, float width, float height);
37  ClientRect(ExecState *exec, const QRectF &rect);
38  enum {
39  Top, Right, Bottom, Left, Width, Height
40  };
41  JSValue *getValueProperty(ExecState *exec, int token) const;
42 
43  using KJS::JSObject::getOwnPropertySlot;
44  bool getOwnPropertySlot(ExecState *exec, const Identifier &propertyName, PropertySlot &slot) override;
45 
46  float top() const;
47  float left() const;
48  float width() const;
49  float height() const;
50  float right() const;
51  float bottom() const;
52 
53  void setTop(float top);
54  void setLeft(float left);
55  void setWidth(float width);
56  void setHeight(float height);
57 
58 private:
59  const ClassInfo *classInfo() const override
60  {
61  return &info;
62  }
63  static const ClassInfo info;
64 
65  QRectF m_rect;
66 };
67 
68 class ClientRectList : public JSObject
69 {
70 public:
71  ClientRectList(ExecState *exec);
72  ClientRectList(ExecState *exec, const QList<QRectF> &list);
73  enum {
74  Length
75  };
76 
77  JSValue *getValueProperty(ExecState *exec, int token) const;
78  bool getOwnPropertySlot(ExecState *exec, unsigned int index, PropertySlot &slot) override;
79  bool getOwnPropertySlot(ExecState *exec, const Identifier &propertyName, PropertySlot &slot) override;
80 
81  unsigned length() const;
82  ClientRect *item(unsigned index);
83  void append(ClientRect *item);
84 
85 private:
86  const ClassInfo *classInfo() const override
87  {
88  return &info;
89  }
90  static const ClassInfo info;
91 
92  WTF::Vector< ProtectedPtr<ClientRect> > m_list;
93 };
94 
95 }
96 
97 #endif //KJS_CLIENTRECT_H
Left
QTextStream & right(QTextStream &stream)
QTextStream & left(QTextStream &stream)
Width
Right
Top
Height
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:47:57 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.