[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Mon Mar 29 03:24:18 CEST 2004


CVS commit by staikos: 

more of the new view code


  A            kst2dplot.cpp   1.1 [GPL (v2+)]
  A            kst2dplot.h   1.1 [GPL (v2+)]
  A            kstplotbase.cpp   1.1 [GPL (v2+)]
  A            kstplotbase.h   1.1 [GPL (v2+)]
  M +2 -0      Makefile.am   1.77
  M +10 -0     kstborderedviewobject.cpp   1.3
  M +4 -4      kstplot.h   1.23
  M +36 -1     kstviewobject.cpp   1.4
  M +12 -1     kstviewobject.h   1.4


--- kdeextragear-2/kst/kst/Makefile.am  #1.76:1.77
@@ -33,4 +33,6 @@
         kstvectortable.cpp \
         kstlogtable.cpp \
+        kstplotbase.cpp \
+        kst2dplot.cpp \
         kstviewwidget.cpp \
         kstviewobject.cpp \

--- kdeextragear-2/kst/kst/kstborderedviewobject.cpp  #1.2:1.3
@@ -19,4 +19,5 @@
 
 #include <qpainter.h>
+#include <qpen.h>
 
 KstBorderedViewObject::KstBorderedViewObject()
@@ -43,4 +44,13 @@ void KstBorderedViewObject::save(QTextSt
 
 void KstBorderedViewObject::paint(QPainter& p) {
+  QPen pen(_borderColor, _borderWidth);
+  p.setPen(pen);
+  QRect r;
+  r.setX(_pos.x() + _margin);
+  r.setY(_pos.y() + _margin);
+  r.setWidth(_size.width() - 2 * _margin);
+  r.setHeight(_size.height() - 2 * _margin);
+  p.drawRect(r);
+  KstViewObject::paint(p);
 }
 

--- kdeextragear-2/kst/kst/kstplot.h  #1.22:1.23
@@ -143,8 +143,8 @@ public:
   void setpixrect(int x0, int y0);
 
-  void setBackgroundColor(QColor in_color) {BackgroundColor = in_color;}
-  void setForegroundColor(QColor in_color) {ForegroundColor = in_color;}
-  QColor backgroundColor() {return (BackgroundColor);}
-  QColor foregroundColor() {return (ForegroundColor);};
+  void setBackgroundColor(QColor in_color) { BackgroundColor = in_color; }
+  void setForegroundColor(QColor in_color) { ForegroundColor = in_color; }
+  QColor backgroundColor() const { return BackgroundColor; }
+  QColor foregroundColor() const { return ForegroundColor; }
 
 private:

--- kdeextragear-2/kst/kst/kstviewobject.cpp  #1.3:1.4
@@ -19,4 +19,5 @@
 
 #include <assert.h>
+#include <math.h>
 #include <qpainter.h>
 
@@ -116,5 +117,5 @@ void KstViewObject::resize(const QSize& 
 
 
-const QSize& KstViewObject::size() const {
+QSize KstViewObject::size() const {
   return _size;
 }
@@ -148,4 +149,38 @@ void KstViewObject::parentResized(const 
 }
 
+
+void KstViewObject::setBackgroundColor(const QColor& color) {
+  _backgroundColor = color;
+}
+
+
+QColor KstViewObject::backgroundColor() const {
+  return _backgroundColor;
+}
+
+
+
+void KstViewObject::setForegroundColor(const QColor& color) {
+  _foregroundColor = color;
+}
+
+
+QColor KstViewObject::foregroundColor() const {
+  return _foregroundColor;
+}
+
+
+void KstViewObject::cleanup(int cols) {
+  if (cols <= 0) {
+    cols = sqrt(_children.count());
+  }
+
+  int pos = 0;
+  
+  for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i, ++pos) {
+  }
+}
+
+
 #include "kstviewobject.moc"
 // vim: ts=2 sw=2 et

--- kdeextragear-2/kst/kst/kstviewobject.h  #1.3:1.4
@@ -21,4 +21,5 @@
 #include "kstobject.h"
 
+#include <qcolor.h>
 #include <qdom.h>
 #include <qpoint.h>
@@ -39,6 +40,9 @@ class KstViewObject : public KstObject {
     virtual void save(QTextStream& ts);
 
+    // If cols <= 0, optimal is chosen automatically
+    virtual void cleanup(int cols = -1);
+
     virtual void resize(const QSize& size);
-    virtual const QSize& size() const;
+    virtual QSize size() const;
 
     virtual void readLock() const;
@@ -54,4 +58,10 @@ class KstViewObject : public KstObject {
     const KstViewObjectList& children() const;
 
+    virtual void setBackgroundColor(const QColor& color);
+    virtual QColor backgroundColor() const;
+
+    virtual void setForegroundColor(const QColor& color);
+    virtual QColor foregroundColor() const;
+
   public slots:
     virtual void paint(QPainter& p);
@@ -62,4 +72,5 @@ class KstViewObject : public KstObject {
     QSize _size;
     QPoint _pos;
+    QColor _backgroundColor, _foregroundColor;
 };
 





More information about the Kst mailing list