korganizer Library API Documentation

koagendaitem.h

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 #ifndef KOAGENDAITEM_H
00020 #define KOAGENDAITEM_H
00021 
00022 #include <qframe.h>
00023 #include <qlabel.h>
00024 #include <qdatetime.h>
00025 
00026 #include <libkcal/event.h>
00027 
00028 class QToolTipGroup;
00029 class QDragEnterEvent;
00030 class QDropEvent;
00031 
00032 using namespace KCal;
00033 
00034 /*
00035   The KOAgendaItem has to make sure that it receives all mouse events, which are
00036   to be used for dragging and resizing. That means it has to be installed as
00037   eventfiler for its children, if it has children, and it has to pass mouse
00038   events from the cildren to itself. See eventFilter().
00039 */
00040 class KOAgendaItem : public QFrame
00041 {
00042     Q_OBJECT
00043   public:
00044     KOAgendaItem(Event *event, QDate qd, QWidget *parent, const char *name=0,
00045                  WFlags f=0 );
00046 
00047     int cellX() { return mCellX; }
00048     int cellXWidth() { return mCellXWidth; }
00049     int cellYTop() { return mCellYTop; }
00050     int cellYBottom() { return mCellYBottom; }
00051     int cellHeight();
00052     int cellWidth();
00053     int subCell() { return mSubCell; }
00054     int subCells() { return mSubCells; }
00055 
00056     void setCellXY(int X, int YTop, int YBottom);
00057     void setCellY(int YTop, int YBottom);
00058     void setCellX(int XLeft, int XRight);
00059     void setCellXWidth(int xwidth);
00060     void setSubCell(int subCell);
00061     void setSubCells(int subCells);
00062 
00064     void startMove();
00066     void resetMove();
00067 
00068     void moveRelative(int dx,int dy);
00069     void expandTop(int dy);
00070     void expandBottom(int dy);
00071     void expandLeft(int dx);
00072     void expandRight(int dx);
00073 
00074     void setMultiItem(KOAgendaItem *first,KOAgendaItem *next,
00075                       KOAgendaItem *last);
00076     KOAgendaItem *firstMultiItem() { return mFirstMultiItem; }
00077     KOAgendaItem *nextMultiItem() { return mNextMultiItem; }
00078     KOAgendaItem *lastMultiItem() { return mLastMultiItem; }
00079 
00080     Event *itemEvent() { return mEvent; }
00081     QDate itemDate() { return mDate; }
00082     
00084     void setItemDate(QDate qd);
00085     
00086     void setText ( const QString & text ) { mItemLabel->setText(text); }
00087     QString text () { return mItemLabel->text(); }
00088 
00089     virtual bool eventFilter ( QObject *, QEvent * );
00090 
00091     static QToolTipGroup *toolTipGroup();
00092     
00093     QPtrList<KOAgendaItem> conflictItems();
00094     void setConflictItems(QPtrList<KOAgendaItem>);
00095     void addConflictItem(KOAgendaItem *ci);
00096 
00097   public slots:
00098     void updateIcons();
00099     void select(bool=true);
00100 
00101   protected:
00102     void dragEnterEvent(QDragEnterEvent *e);
00103     void dropEvent(QDropEvent *e);
00104 
00105   private:
00106     int mCellX;
00107     int mCellXWidth;
00108     int mCellYTop,mCellYBottom;
00109     int mSubCell;  // subcell number of this item
00110     int mSubCells;  // Total number of subcells in cell of this item
00111 
00112     // Variables to remember start position
00113     int mStartCellX;
00114     int mStartCellXWidth;
00115     int mStartCellYTop,mStartCellYBottom;
00116 
00117     // Multi item pointers
00118     KOAgendaItem *mFirstMultiItem;
00119     KOAgendaItem *mNextMultiItem;
00120     KOAgendaItem *mLastMultiItem;
00121 
00122     Event *mEvent; // corresponding event
00123     QDate mDate; //date this events occurs (for recurrence)
00124 
00125     QLabel *mItemLabel;
00126     QLabel *mIconAlarm,*mIconRecur,*mIconReadonly;
00127     QLabel *mIconReply,*mIconGroup,*mIconOrganizer;
00128 
00129     static QToolTipGroup *mToolTipGroup;
00130 
00131     bool mSelected;
00132     QPtrList<KOAgendaItem> mConflictItems;
00133 };
00134 
00135 #endif // KOAGENDAITEM_H
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:31 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001