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