korganizer

koviewmanager.h
00001 /*
00002   This file is part of KOrganizer.
00003 
00004   Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00005   Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00006 
00007   This program is free software; you can redistribute it and/or modify
00008   it under the terms of the GNU General Public License as published by
00009   the Free Software Foundation; either version 2 of the License, or
00010   (at your option) any later version.
00011 
00012   This program is distributed in the hope that it will be useful,
00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015   GNU General Public License for more details.
00016 
00017   You should have received a copy of the GNU General Public License
00018   along with this program; if not, write to the Free Software
00019   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020 
00021   As a special exception, permission is given to link this program
00022   with any edition of TQt, and distribute the resulting executable,
00023   without including the source code for TQt in the source distribution.
00024 */
00025 #ifndef KOVIEWMANAGER_H
00026 #define KOVIEWMANAGER_H
00027 
00028 #include <tqobject.h>
00029 class TQWidget;
00030 class TQTabWidget;
00031 
00032 class CalendarView;
00033 
00034 class KOListView;
00035 class KOAgendaView;
00036 class KOMonthView;
00037 class KOTodoView;
00038 class KOWhatsNextView;
00039 class KOJournalView;
00040 class KOTimelineView;
00041 
00042 namespace KOrg {
00043   class BaseView;
00044   class MultiAgendaView;
00045 }
00046 using namespace KCal;
00047 
00052 class KOViewManager : public TQObject
00053 {
00054     Q_OBJECT
00055   
00056   public:
00057 
00058     enum AgendaMode {
00059       AGENDA_NONE,
00060       AGENDA_DAY,
00061       AGENDA_WORK_WEEK,
00062       AGENDA_WEEK,
00063       AGENDA_NEXTX,
00064       AGENDA_OTHER // for example, showing 8 days
00065     };
00066 
00067     KOViewManager( CalendarView * );
00068     virtual ~KOViewManager();
00069 
00071     void showView( KOrg::BaseView * );
00072 
00073     void readSettings( TDEConfig *config );
00074     void writeSettings( TDEConfig *config );
00075 
00077     void readCurrentView( TDEConfig * );
00079     void writeCurrentView( TDEConfig * );
00080 
00081     KOrg::BaseView *currentView();
00082 
00083     void setDocumentId( const TQString & );
00084 
00085     void updateView();
00086     void updateView( const TQDate &start, const TQDate &end );
00087 
00088     void goMenu( bool enable );
00089     void raiseCurrentView();
00090 
00091     void connectView( KOrg::BaseView * );
00092     void addView( KOrg::BaseView * );
00093 
00094     Incidence *currentSelection();
00095     TQDate currentSelectionDate();
00096 
00097     KOAgendaView *agendaView() const { return mAgendaView; }
00098     KOrg::MultiAgendaView *multiAgendaView() const { return mAgendaSideBySideView; }
00099     KOTodoView *todoView() const { return mTodoView; }
00100     KOMonthView *monthView() const { return mMonthView; }
00101 
00102     void updateMultiCalendarDisplay();
00103 
00104     /*
00105     * Returns true if the agenda is the current view.
00106     *
00107     * Never use the pointer returned by agendaView()
00108     * to know if agenda is selected, because agenda has other modes
00109     * (tabbed, side by side). Use this function instead.
00110     */
00111     bool agendaIsSelected() const;
00112 
00117     AgendaMode agendaMode() const { return mAgendaMode; }
00118 
00119   public slots:
00120     void showWhatsNextView();
00121     void showListView();
00122     void showAgendaView();
00123     void showDayView();
00124     void showWorkWeekView();
00125     void showWeekView();
00126     void showNextXView();
00127     void showMonthView();
00128     void showTodoView();
00129     void showTimelineView();
00130     void showJournalView();
00131 
00132     void showEventView();
00133 
00134     void connectTodoView( KOTodoView *todoView );
00135 
00136     void zoomInHorizontally();
00137     void zoomOutHorizontally();
00138     void zoomInVertically();
00139     void zoomOutVertically();
00140 
00141     void resourcesChanged();
00142 
00143   private slots:
00144     void currentAgendaViewTabChanged( TQWidget* );
00145   private:
00146     TQWidget* widgetForView( KOrg::BaseView* ) const;
00147     CalendarView *mMainView;
00148 
00149     KOAgendaView    *mAgendaView;
00150     MultiAgendaView *mAgendaSideBySideView;
00151     KOListView      *mListView;
00152     KOMonthView     *mMonthView;
00153     KOTodoView      *mTodoView;
00154     KOWhatsNextView *mWhatsNextView;
00155     KOJournalView   *mJournalView;
00156     KOTimelineView  *mTimelineView;
00157 
00158     KOrg::BaseView *mCurrentView;
00159 
00160     KOrg::BaseView *mLastEventView;
00161     TQTabWidget *mAgendaViewTabs;
00162     int mAgendaViewTabIndex;
00163 
00164     AgendaMode mAgendaMode;
00165 
00166 };
00167 
00168 #endif