KGantt.h
00001 #ifndef _KGANTT_H_ 00002 #define _KGANTT_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 : KGantt.h 00024 date : 26 oct 2000 00025 00026 00027 changelog : 23 nov 2000, jh 00028 00029 24 nov 2000, jh 00030 00031 10 jan 2001m jh, changed to KDE : 00032 xQGantt -> KGantt 00033 00034 */ 00035 00036 00037 #include <tqwidget.h> 00038 #include <tqsplitter.h> 00039 00040 #include <tdepopupmenu.h> 00041 #include <tdepimmacros.h> 00042 00043 #include "KGanttItem.h" 00044 #include "xQGanttListView.h" 00045 #include "xQGanttBarView.h" 00046 00047 00048 00084 00085 00089 00090 class KDE_EXPORT KGantt : public TQWidget 00092 { 00093 00094 Q_OBJECT 00095 00096 00097 00098 public: 00099 00100 00102 00105 KGantt(KGanttItem* toplevelitem = 0, 00106 TQWidget* parent = 0, const char * name=0, WFlags f=0 ); 00107 00108 00110 00113 ~KGantt(); 00114 00115 00116 00118 00124 void setToplevelItem(KGanttItem* item) { 00125 if(_deleteItem) 00126 delete _toplevelitem; 00127 _toplevelitem = item; 00128 } 00129 00130 00131 00133 00136 KGanttItem* getToplevelItem() { 00137 return _toplevelitem; 00138 } 00139 00140 00141 00143 00146 xQGanttBarView* barView() { 00147 return _ganttbar; 00148 } 00149 00150 00151 00153 00156 xQGanttListView* listView() { 00157 return _ganttlist; 00158 } 00159 00160 00161 00162 TQSplitter* splitter() { 00163 return _splitter; 00164 } 00165 00166 00167 00169 00172 void zoom(double factor) { 00173 barView()->viewport()->zoom(factor); 00174 } 00175 00176 00177 00179 00182 TDEPopupMenu* menu() { 00183 return _ganttbar->viewport()->menu(); 00184 } 00185 00186 00187 00189 00198 TDEToolBar* toolbar(TQMainWindow* mw = 0) { 00199 return _ganttbar->viewport()->toolbar(mw); 00200 } 00201 00202 00203 00205 /* 00206 * 00207 */ 00208 void dumpItems(); 00209 00210 00211 00213 00216 void getSelectedItems(TQPtrList<KGanttItem>& list) { 00217 _ganttbar->viewport()->getSelectedItems(list); 00218 } 00219 00220 00221 00222 void addHoliday(int y, int m, int d) { 00223 _ganttbar->viewport()->addHoliday(y,m,d); 00224 } 00225 00226 00227 00228 void removeHoliday(int y, int m, int d) { 00229 _ganttbar->viewport()->addHoliday(y,m,d); 00230 } 00231 00232 00233 00234 public slots: 00235 00236 00237 void setSelect() { 00238 _ganttbar->viewport()->setSelect(); 00239 } 00240 00241 void setZoom() { 00242 _ganttbar->viewport()->setZoom(); 00243 } 00244 00245 void setMove() { 00246 _ganttbar->viewport()->setMove(); 00247 } 00248 00249 00250 void zoomIn() { 00251 _ganttbar->viewport()->zoomIn(); 00252 } 00253 00254 void zoomOut() { 00255 _ganttbar->viewport()->zoomOut(); 00256 } 00257 00258 void zoomAll() { 00259 _ganttbar->viewport()->zoomAll(); 00260 } 00261 00262 void selectAll() { 00263 _ganttbar->viewport()->selectAll(); 00264 } 00265 00266 void unselectAll() { 00267 _ganttbar->viewport()->unselectAll(); 00268 } 00269 00270 void deleteSelectedItems() { 00271 _ganttbar->viewport()->deleteSelectedItems(); 00272 } 00273 00274 void insertIntoSelectedItem() { 00275 _ganttbar->viewport()->insertIntoSelectedItem(); 00276 } 00277 00278 00280 00283 void showList() { 00284 _ganttlist->show(); 00285 } 00286 00287 00289 /* 00290 * 00291 */ 00292 void hideList() { 00293 _ganttlist->hide(); 00294 } 00295 00296 00297 protected: 00298 00299 00300 void resizeEvent(TQResizeEvent* /*e*/) { 00301 _splitter->resize(width(),height()); 00302 }; 00303 00304 00305 private: 00306 00307 KGanttItem* _toplevelitem; 00308 00309 TQSplitter *_splitter; 00310 00311 xQGanttBarView* _ganttbar; 00312 xQGanttListView* _ganttlist; 00313 00314 bool _deleteItem; 00315 00316 }; 00317 00318 00319 #endif