timelineitem.h
00001 /* 00002 Copyright (c) 2007 Volker Krause <vkrause@kde.org> 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef KORG_TIMELINEITEM_H 00020 #define KORG_TIMELINEITEM_H 00021 00022 #define private protected 00023 #include <kdgantt/KDGanttViewTaskItem.h> 00024 #undef protected 00025 00026 #include <tqmap.h> 00027 #include <tqvaluelist.h> 00028 00029 class KDGanttView; 00030 class KDCanvasPolygon; 00031 00032 namespace KCal { 00033 class Calendar; 00034 class ResourceCalendar; 00035 class Incidence; 00036 } 00037 00038 namespace KOrg { 00039 00040 class TimelineSubItem; 00041 00042 class TimelineItem : public KDGanttViewTaskItem 00043 { 00044 public: 00045 TimelineItem( const TQString &label, KCal::Calendar *calendar, KDGanttView* parent ); 00046 00047 void insertIncidence( KCal::Incidence *incidence, 00048 const TQDateTime &start = TQDateTime(), 00049 const TQDateTime &end = TQDateTime() ); 00050 void removeIncidence( KCal::Incidence *incidence ); 00051 00052 void moveItems( KCal::Incidence* incidence, int delta, int duration ); 00053 00054 private: 00055 KCal::Calendar *mCalendar; 00056 TQMap<KCal::Incidence*, TQValueList<TimelineSubItem*> > mItemMap; 00057 }; 00058 00059 class TimelineSubItem : public KDGanttViewTaskItem 00060 { 00061 public: 00062 TimelineSubItem( KCal::Calendar *calendar, KCal::Incidence *incidence, TimelineItem *parent ); 00063 ~TimelineSubItem(); 00064 00065 KCal::Incidence* incidence() const { return mIncidence; } 00066 00067 TQDateTime originalStart() const { return mStart; } 00068 void setOriginalStart( const TQDateTime &dt ) { mStart = dt; } 00069 00070 private: 00071 void showItem( bool show = true, int coordY = 0 ); 00072 00073 private: 00074 KCal::Incidence *mIncidence; 00075 TQDateTime mStart; 00076 KDCanvasPolygon *mLeft, *mRight; 00077 int mMarkerWidth; 00078 }; 00079 00080 } 00081 00082 #endif