summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaitem.h
Unidiff
Diffstat (limited to 'korganizer/koagendaitem.h') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.h160
1 files changed, 160 insertions, 0 deletions
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h
new file mode 100644
index 0000000..7321af2
--- a/dev/null
+++ b/korganizer/koagendaitem.h
@@ -0,0 +1,160 @@
1/*
2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/
19#ifndef KOAGENDAITEM_H
20#define KOAGENDAITEM_H
21
22#include <qframe.h>
23#include <qlabel.h>
24#include <qpixmap.h>
25#include <qdatetime.h>
26#include <qpalette.h>
27
28#include <libkcal/incidence.h>
29
30class QToolTipGroup;
31class QDragEnterEvent;
32class QDropEvent;
33
34using namespace KCal;
35
36/*
37 The KOAgendaItem has to make sure that it receives all mouse events, which are
38 to be used for dragging and resizing. That means it has to be installed as
39 eventfiler for its children, if it has children, and it has to pass mouse
40 events from the cildren to itself. See eventFilter().
41*/
42class KOAgendaItem : public QWidget
43{
44 Q_OBJECT
45 public:
46 KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent, bool allday, const char *name=0,
47 WFlags f=0 );
48 ~KOAgendaItem();
49 void init ( Incidence *incidence, QDate qd );
50 int cellX() { return mCellX; }
51 int cellXWidth() { return mCellXWidth; }
52 int cellYTop() { return mCellYTop; }
53 int cellYBottom() { return mCellYBottom; }
54 int cellHeight();
55 int cellWidth();
56 int subCell() { return mSubCell; }
57 int subCells() { return mSubCells; }
58
59 void setCellXY(int X, int YTop, int YBottom);
60 void setCellY(int YTop, int YBottom);
61 void setCellX(int XLeft, int XRight);
62 void setCellXWidth(int xwidth);
63 void setSubCell(int subCell);
64 void setSubCells(int subCells);
65
66 /** Start movement */
67 void startMove();
68 /** Reset to original values */
69 void resetMove();
70
71 void moveRelative(int dx,int dy);
72 void expandTop(int dy);
73 void expandBottom(int dy);
74 void expandLeft(int dx);
75 void expandRight(int dx);
76 int mLastMoveXPos;
77
78 void setMultiItem(KOAgendaItem *first,KOAgendaItem *next,
79 KOAgendaItem *last);
80 KOAgendaItem *firstMultiItem() { return mFirstMultiItem; }
81 KOAgendaItem *nextMultiItem() { return mNextMultiItem; }
82 KOAgendaItem *lastMultiItem() { return mLastMultiItem; }
83
84 Incidence *incidence() const { return mIncidence; }
85 QDate itemDate() { return mDate; }
86
87 /** Update the date of this item's occurence (not in the event) */
88 void setItemDate(QDate qd);
89
90 void setText ( const QString & text ) { mDisplayedText = text; }
91 QString text () { return mDisplayedText; }
92
93 virtual bool eventFilter ( QObject *, QEvent * );
94
95 static QToolTipGroup *toolTipGroup();
96
97 QPtrList<KOAgendaItem> conflictItems();
98 void setConflictItems(QPtrList<KOAgendaItem>);
99 void addConflictItem(KOAgendaItem *ci);
100 void paintMe( bool, QPainter* painter = 0 );
101 void repaintMe();
102 static void resizePixmap( int, int );
103 static QPixmap * paintPix();
104 static QPixmap * paintPixSel();
105 static QPixmap * paintPixAllday();
106 void updateItem();
107 void computeText();
108 void recreateIncidence();
109 public slots:
110 bool updateIcons( QPainter *, bool );
111 void select(bool=true);
112
113 protected:
114 void dragEnterEvent(QDragEnterEvent *e);
115 void dropEvent(QDropEvent *e);
116 void paintEvent ( QPaintEvent * );
117 void resizeEvent ( QResizeEvent *ev );
118
119 private:
120 bool mAllDay;
121 int mCellX;
122 int mCellXWidth;
123 int mCellYTop,mCellYBottom;
124 int mSubCell; // subcell number of this item
125 int mSubCells; // Total number of subcells in cell of this item
126 int xPaintCoord;
127 int yPaintCoord;
128 int wPaintCoord;
129 int hPaintCoord;
130 // Variables to remember start position
131 int mStartCellX;
132 int mStartCellXWidth;
133 int mStartCellYTop,mStartCellYBottom;
134 int mLastMovePos;
135
136 // Multi item pointers
137 KOAgendaItem *mFirstMultiItem;
138 KOAgendaItem *mNextMultiItem;
139 KOAgendaItem *mLastMultiItem;
140
141 int mFontPixelSize;
142 Incidence *mIncidence; // corresponding event or todo
143 QDate mDate; //date this events occurs (for recurrence)
144 //void showIcon( QLabel*, int );
145 //QLabel *mTodoIconLabel;
146 //QLabel *mItemLabel;
147 //QWidget *mIconBox;
148 //QLabel *mIconAlarm,*mIconRecur,*mIconReadonly;
149 //QLabel *mIconReply,*mIconGroup,*mIconOrganizer;
150 //QLabel *mIconMoreInfo;
151 static QToolTipGroup *mToolTipGroup;
152
153 QColor mBackgroundColor;
154 QColorGroup mColorGroup;
155 QString mDisplayedText;
156 bool mSelected;
157 QPtrList<KOAgendaItem> mConflictItems;
158};
159
160#endif // KOAGENDAITEM_H