[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Mon Apr 5 09:28:48 CEST 2004


CVS commit by staikos: 

some notes and geometry code


  M +12 -0     kstborderedviewobject.cpp   1.4
  M +37 -0     kstborderedviewobject.h   1.3
  M +4 -0      kstviewobject.cpp   1.5
  M +1 -0      kstviewobject.h   1.5


--- kdeextragear-2/kst/kst/kstborderedviewobject.cpp  #1.3:1.4
@@ -95,4 +95,16 @@ int KstBorderedViewObject::padding() con
 }
 
+
+QRect KstBorderedViewObject::contentsRect() const {
+  QRect rc;
+  int mpb = _margin + _padding + _borderWidth;
+  rc.setX(position().x() + mpb);
+  rc.setY(position().y() + mpb);
+  rc.setWidth(size().width() + 2 * mpb);
+  rc.setHeight(size().height() + 2 * mpb);
+  return rc;
+}
+
+
 #include "kstborderedviewobject.moc"
 // vim: ts=2 sw=2 et

--- kdeextragear-2/kst/kst/kstborderedviewobject.h  #1.2:1.3
@@ -22,4 +22,38 @@
 #include <qcolor.h>
 
+
+/***************************************************************************
+
+ (position().x(), position().y())
+      +-------------------------------------------------------+  ---
+      |                   Margin                              |   ^
+      |   +---------------------------- Border -----------+   |   |
+      |   |            Padding                            |   |   |
+      |   |                                               |   |   |
+      |   |     +-----------------------------------+     |   |   |
+      |   |     |        Object contents            |     |   |   |
+      |   |     |                                   |     |   |  Height
+      |   |     |                                   |     |   |   |
+      |   |     |                                   |     |   |   |
+      |   |     |                                   |     |   |   |
+      |   |     +-----------------------------------+     |   |   |
+      |   |                                               |   |   |
+      |   |                                               |   |   |
+      |   +-----------------------------------------------+   |   |
+      |                                                       |   V
+      +-------------------------------------------------------+  ---
+
+      |<----------------------- Width ----------------------->|
+
+
+Contents Rect
+-------------
+object.width = width() - 2*(margin() + padding() + borderWidth());
+object.height = height() - 2*(margin() + padding() + borderWidth());
+object.x = position().x() + margin() + padding() + borderWidth();
+object.y = position().y() + margin() + padding() + borderWidth();
+
+***************************************************************************/
+
 class KstBorderedViewObject : public KstViewObject {
   Q_OBJECT
@@ -44,4 +78,7 @@ class KstBorderedViewObject : public Kst
     int padding() const;
 
+    // See above for gross details
+    QRect contentsRect() const;
+
   public slots:
     virtual void paint(QPainter& p);

--- kdeextragear-2/kst/kst/kstviewobject.cpp  #1.4:1.5
@@ -183,4 +183,8 @@ void KstViewObject::cleanup(int cols) {
 
 
+QPoint KstViewObject::position() const {
+  return _pos;
+}
+
 #include "kstviewobject.moc"
 // vim: ts=2 sw=2 et

--- kdeextragear-2/kst/kst/kstviewobject.h  #1.4:1.5
@@ -45,4 +45,5 @@ class KstViewObject : public KstObject {
     virtual void resize(const QSize& size);
     virtual QSize size() const;
+    virtual QPoint position() const;
 
     virtual void readLock() const;





More information about the Kst mailing list