kgantt

KGanttRelation.h

00001 #ifndef _KGANTTRELATION_H_
00002 #define _KGANTTRELATION_H_
00003  
00004 /*
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 
00021     author  : jh, jochen@ifb.bv.tu-berlin.de
00022 
00023     file    : KGanttRelation.h
00024     date    : 17.02.2001
00025 
00026     changelog :
00027 
00028 */
00029 
00030 
00031 #include <qobject.h>
00032 #include <qdatetime.h> 
00033 #include <qtextstream.h> 
00034 #include <qptrlist.h> 
00035 #include <qpainter.h>
00036 
00037 
00038 class KGanttItem;
00039 
00040 
00042 
00047 
00048 class KGanttRelation : public QObject
00050 {
00051 
00052   Q_OBJECT
00053 
00054   friend class KGanttItem;
00055 
00056 public:
00057 
00058   enum Change { 
00059 
00060     NoChange        = 0,
00061     TextChanged     = 32,
00062 
00064     Selected        = 2048,
00065     
00067     Unselected      = 4096
00068   };
00069  
00070  
00071 
00072 
00074   /*
00075    *    Emits signal destroyed(KGanttRelation* this).
00076    */
00077   ~KGanttRelation();
00078   
00079  
00080 
00081 
00083 
00086   void select(bool f);
00087 
00088 
00090 
00096   void setEditable(bool f) {
00097     _editable = f;
00098   }
00099 
00100 
00101 
00103 
00106   bool isEditable() {
00107     return _editable;
00108   }
00109 
00110 
00111 
00113 
00116   QPen& getSelectPen() {
00117     return _selectPen;
00118   }
00119 
00120 
00121 
00123 
00126   void setPen(const QPen& pen);
00127 
00128 
00129 
00131 
00134   QPen& getPen() {
00135     return _pen;
00136   }
00137 
00138 
00139 
00141 
00144   void setTextPen(const QPen& pen) {
00145     _textPen = pen;
00146   }
00147 
00148 
00149 
00151 
00154   QPen& getTextPen() {
00155     return _textPen;
00156   }
00157 
00158 
00159 
00161 
00164   void setText(const QString& text);
00165 
00166 
00167 
00169 
00172   QString getText() { return _text; }
00173   
00174 
00175 
00177 
00182   KGanttItem* getFrom();
00183 
00184 
00185 
00187 
00190   KGanttItem* getTo();
00191 
00192 
00193 
00195 
00198   void dump(QTextOStream& cout, const QString& pre);
00199 
00200 
00201   QString ChangeAsString(Change c);
00202 
00203 
00204 signals:
00205 
00207 
00211   void changed(KGanttRelation*, KGanttRelation::Change);
00212 
00213 
00214 
00216 
00220   void destroyed(KGanttRelation*);
00221 
00222 
00223 public slots:
00224 
00225   void itemDestroyed(KGanttItem* item);
00226 
00227 
00228 protected:
00229 
00231 
00234   KGanttRelation(KGanttItem* from, KGanttItem* to,
00235          const QString& text );
00236 
00237 
00238 private:
00239 
00240 
00241   bool _selected;
00242 
00243   bool _editable;
00244 
00245   KGanttItem* _from;
00246   KGanttItem* _to;
00247   
00248   QString _text;
00249 
00250   QPen _pen, _textPen;
00251   
00252   static QPen _selectPen;
00253 
00254 };
00255 
00256 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys