korganizer

multiagendaview.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_MULTIAGENDAVIEW_H_H
00020 #define KORG_MULTIAGENDAVIEW_H_H
00021 
00022 #include "agendaview.h"
00023 #include "calendarview.h"
00024 
00025 class TQScrollView;
00026 class TQHBox;
00027 class TQSplitter;
00028 class KOAgendaView;
00029 class TimeLabels;
00030 class TQScrollBar;
00031 
00032 namespace KCal {
00033   class ResourceCalendar;
00034 }
00035 
00036 namespace KOrg {
00037 
00041 class MultiAgendaView : public AgendaView
00042 {
00043   Q_OBJECT
00044   TQ_OBJECT
00045   public:
00046     explicit MultiAgendaView( Calendar* cal, CalendarView *calendarView,
00047                               TQWidget *parent = 0, const char *name = 0 );
00048     ~MultiAgendaView();
00049 
00050     KOAgendaView *selectedAgendaView();
00051     void deSelectAgendaView() { mSelectedAgendaView = 0; }
00052     Incidence::List selectedIncidences();
00053     DateList selectedIncidenceDates();
00054     int currentDateCount();
00055     int maxDatesHint();
00056 
00057     bool eventDurationHint(TQDateTime &startDt, TQDateTime &endDt, bool &allDay);
00058 
00059     void setTypeAheadReceiver( TQObject *o );
00060 
00061   public slots:
00062     void showDates( const TQDate &start, const TQDate &end );
00063     void showIncidences( const Incidence::List &incidenceList, const TQDate &date );
00064     void updateView();
00065     void changeIncidenceDisplay( Incidence *incidence, int mode );
00066     void updateConfig();
00067 
00068     void setIncidenceChanger( IncidenceChangerBase *changer );
00069 
00070     void finishTypeAhead();
00071 
00072     void show();
00073 
00074     void resourcesChanged();
00075 
00076   protected:
00077     void resizeEvent( TQResizeEvent *ev );
00078     bool eventFilter( TQObject *obj, TQEvent *event );
00079 
00080   private:
00081     void addView( const TQString &label, KCal::ResourceCalendar *res, const TQString &subRes = TQString() );
00082     void deleteViews();
00083     void recreateViews();
00084     void setupViews();
00085     void resizeScrollView( const TQSize &size );
00086     void installSplitterEventFilter( TQSplitter *splitter );
00087 
00088   private slots:
00089     void slotSelectionChanged();
00090     void slotClearTimeSpanSelection();
00091     void resizeSplitters();
00092     void resizeSpacers( int );
00093     void setupScrollBar();
00094     void zoomView( const int delta, const TQPoint &pos, const Qt::Orientation ori );
00095     void slotResizeScrollView();
00096 
00097   private:
00098     KOAgendaView *mSelectedAgendaView;
00099     TQValueList<KOAgendaView*> mAgendaViews;
00100     TQValueList<TQWidget*> mAgendaWidgets;
00101     TQHBox *mTopBox;
00102     TQScrollView *mScrollView;
00103     TimeLabels *mTimeLabels;
00104     TQSplitter *mLeftSplitter, *mRightSplitter;
00105     TQSplitter *mLastMovedSplitter;
00106     TQScrollBar *mScrollBar;
00107     TQWidget *mLeftTopSpacer, *mRightTopSpacer;
00108     TQWidget *mLeftBottomSpacer, *mRightBottomSpacer;
00109     TQDate mStartDate, mEndDate;
00110     bool mUpdateOnShow;
00111     bool mPendingChanges;
00112     CalendarView *mCalendarView;
00113 };
00114 
00115 }
00116 
00117 #endif