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