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 <tqobject.h>
00032 #include <tqdatetime.h> 
00033 #include <tqtextstream.h> 
00034 #include <tqptrlist.h> 
00035 #include <tqpainter.h>
00036 
00037 
00038 class KGanttItem;
00039 
00040 
00042 
00047 
00048 class KGanttRelation : public TQObject
00050 {
00051 
00052   Q_OBJECT
00053   
00054 
00055   friend class KGanttItem;
00056 
00057 public:
00058 
00059   enum Change { 
00060 
00061     NoChange        = 0,
00062     TextChanged     = 32,
00063 
00065     Selected        = 2048,
00066     
00068     Unselected      = 4096
00069   };
00070  
00071  
00072 
00073 
00075   /*
00076    *    Emits signal destroyed(KGanttRelation* this).
00077    */
00078   ~KGanttRelation();
00079   
00080  
00081 
00082 
00084 
00087   void select(bool f);
00088 
00089 
00091 
00097   void setEditable(bool f) {
00098     _editable = f;
00099   }
00100 
00101 
00102 
00104 
00107   bool isEditable() {
00108     return _editable;
00109   }
00110 
00111 
00112 
00114 
00117   TQPen& getSelectPen() {
00118     return _selectPen;
00119   }
00120 
00121 
00122 
00124 
00127   void setPen(const TQPen& pen);
00128 
00129 
00130 
00132 
00135   TQPen& getPen() {
00136     return _pen;
00137   }
00138 
00139 
00140 
00142 
00145   void setTextPen(const TQPen& pen) {
00146     _textPen = pen;
00147   }
00148 
00149 
00150 
00152 
00155   TQPen& getTextPen() {
00156     return _textPen;
00157   }
00158 
00159 
00160 
00162 
00165   void setText(const TQString& text);
00166 
00167 
00168 
00170 
00173   TQString getText() { return _text; }
00174   
00175 
00176 
00178 
00183   KGanttItem* getFrom();
00184 
00185 
00186 
00188 
00191   KGanttItem* getTo();
00192 
00193 
00194 
00196 
00199   void dump(TQTextOStream& cout, const TQString& pre);
00200 
00201 
00202   TQString ChangeAsString(Change c);
00203 
00204 
00205 signals:
00206 
00208 
00212   void changed(KGanttRelation*, KGanttRelation::Change);
00213 
00214 
00215 
00217 
00221   void destroyed(KGanttRelation*);
00222 
00223 
00224 public slots:
00225 
00226   void itemDestroyed(KGanttItem* item);
00227 
00228 
00229 protected:
00230 
00232 
00235   KGanttRelation(KGanttItem* from, KGanttItem* to,
00236          const TQString& text );
00237 
00238 
00239 private:
00240 
00241 
00242   bool _selected;
00243 
00244   bool _editable;
00245 
00246   KGanttItem* _from;
00247   KGanttItem* _to;
00248   
00249   TQString _text;
00250 
00251   TQPen _pen, _textPen;
00252   
00253   static TQPen _selectPen;
00254 
00255 };
00256 
00257 #endif