kgantt Library API Documentation

KGanttRelation.cpp

00001 // 00002 // file : KGanttRelation.cpp 00003 // date : 17 feb 2001 00004 // changed : 00005 // author : jh 00006 // 00007 00008 00009 #include "KGanttRelation.h" 00010 #include "KGanttItem.h" 00011 00012 00013 QPen KGanttRelation::_selectPen(QColor(255,0,0)); 00014 00015 00016 KGanttRelation::KGanttRelation(KGanttItem* from, KGanttItem* to, 00017 const QString& text ) 00018 : QObject() 00020 { 00021 _from = from; 00022 _to = to; 00023 _text = text; 00024 _pen = QPen(QColor(20,20,20),1); 00025 00026 connect(from, SIGNAL(destroyed(KGanttItem*)), 00027 this, SLOT(itemDestroyed(KGanttItem*))); 00028 00029 connect(to, SIGNAL(destroyed(KGanttItem*)), 00030 this, SLOT(itemDestroyed(KGanttItem*))); 00031 00032 } 00033 00034 00035 00036 00037 KGanttRelation::~KGanttRelation() 00039 { 00040 #ifdef _DEBUG_ 00041 printf("-> delete Relation %s \n", getText().latin1() ); 00042 #endif 00043 00044 emit destroyed(this); 00045 00046 #ifdef _DEBUG_ 00047 printf("<- delete Relation %s \n", getText().latin1() ); 00048 #endif 00049 } 00050 00051 00052 00053 KGanttItem* 00054 KGanttRelation::getFrom() 00055 { 00056 return _from; 00057 } 00058 00059 00060 00061 00062 KGanttItem* 00063 KGanttRelation::getTo() 00065 { 00066 return _to; 00067 } 00068 00069 00070 00071 void 00072 KGanttRelation::itemDestroyed(KGanttItem* item) 00073 { 00074 delete this; 00075 } 00076 00077 00078 00079 void 00080 KGanttRelation::setText(const QString& text) 00081 00082 { 00083 if(!_editable) return; 00084 if(text != _text) { 00085 _text = text; 00086 emit changed(this,TextChanged); 00087 } 00088 } 00089 00090 00091 00092 void 00093 KGanttRelation::select(bool f) 00095 { 00096 if(!_editable) return; 00097 if(f != _selected) { 00098 _selected = f; 00099 if(_selected) 00100 emit changed(this, Selected); 00101 else 00102 emit changed(this, Unselected); 00103 } 00104 } 00105 00106 00107 00108 00109 void 00110 KGanttRelation::setPen(const QPen& pen) 00111 { 00112 _pen = pen; 00113 } 00114 00115 00116 00117 00118 void 00119 KGanttRelation::dump(QTextOStream& cout, const QString& pre) 00120 { 00121 cout << pre << "<Relation. text = [" << _text << "]>\n"; 00122 00123 cout << pre << "| from : " << getFrom()->getText().latin1() << endl; 00124 cout << pre << "| to : " << getTo()->getText().latin1() << endl; 00125 00126 if(_editable) 00127 cout << pre << "| - editable " << endl; 00128 else 00129 cout << pre << "| - not editable " << endl; 00130 00131 if(_selected) 00132 cout << pre << "| - selected " << endl; 00133 else 00134 cout << pre << "| - not selected " << endl; 00135 00136 cout << pre << "</Relation>\n"; 00137 00138 } 00139 00140 00141 QString 00142 KGanttRelation::ChangeAsString(Change c) 00144 { 00145 QString ret; 00146 00147 /* 00148 if(c & StartChanged) ret += "StartChanged, "; 00149 if(c & EndChanged) ret += "EndChanged, "; 00150 if(c & HeightChanged) ret += "HeightChanged, "; 00151 if(c & TotalHeightChanged) ret += "TotalHeightChanged, "; 00152 if(c & StyleChanged) ret += "StyleChanged, "; 00153 */ 00154 if(c & TextChanged) ret += "TextChanged, "; 00155 /* 00156 if(c & ModeChanged) ret += "ModeChanged, "; 00157 if(c & MinChanged) ret += "MinChanged, "; 00158 if(c & MaxChanged) ret += "MaxChanged, "; 00159 if(c & Opened) ret += "Opened, "; 00160 if(c & Closed) ret += "Closed, "; 00161 if(c & Selected) ret += "Selected, "; 00162 if(c & Unselected) ret += "Unselected, "; 00163 if(c & Unknown) ret += "Unknown, "; 00164 */ 00165 return ret; 00166 00167 } 00168 #include "KGanttRelation.moc"
KDE Logo
This file is part of the documentation for kgantt Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 21 19:46:14 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003