korganizer

datenavigator.h
1/*
2 This file is part of KOrganizer.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20 As a special exception, permission is given to link this program
21 with any edition of TQt, and distribute the resulting executable,
22 without including the source code for TQt in the source distribution.
23*/
24#ifndef DATENAVIGATOR_H
25#define DATENAVIGATOR_H
26
27#include <libkcal/incidencebase.h>
28
29#include <tqobject.h>
30
36class DateNavigator : public TQObject
37{
38 TQ_OBJECT
39
40 public:
41 DateNavigator( TQObject *parent = 0, const char *name = 0 );
43
44 KCal::DateList selectedDates();
45
46 int datesCount() const;
47
48 public slots:
49 void selectDates( const KCal::DateList & );
50 void selectDate( const TQDate & );
51
52 void selectDates( int count );
53 void selectDates( const TQDate &, int count, const TQDate &preferredMonth = TQDate() );
54
55 void selectWeek();
56 void selectWeek( const TQDate &, const TQDate &preferredMonth = TQDate() );
57
58 void selectWorkWeek();
59 void selectWorkWeek( const TQDate & );
60
61 void selectWeekByDay( int weekDay, const TQDate &, const TQDate &preferredMonth = TQDate() );
62
63 void selectToday();
64
65 void selectPreviousYear();
66 void selectPreviousMonth( const TQDate &currentMonth = TQDate(),
67 const TQDate &selectionLowerLimit = TQDate(),
68 const TQDate &selectionUpperLimit = TQDate() );
69 void selectPreviousWeek();
70 void selectNextWeek();
71 void selectNextMonth( const TQDate &currentMonth = TQDate(),
72 const TQDate &selectionLowerLimit = TQDate(),
73 const TQDate &selectionUpperLimit = TQDate() );
74 void selectNextYear();
75
76 void selectPrevious();
77 void selectNext();
78
79 void selectMonth( int month );
80 void selectYear( int year );
81
82 signals:
83 /* preferredMonth is useful when the datelist crosses months,
84 if valid, any month-like component should honour it
85 */
86 void datesSelected( const KCal::DateList &, const TQDate &preferredMonth );
87
88 protected:
89 void emitSelected( const TQDate &preferredMonth = TQDate() );
90
91 private:
92
93 /*
94 Selects next month if offset equals 1, or previous month
95 if offset equals -1.
96 Bigger offsets are accepted.
97 */
98 void shiftMonth( const TQDate &date,
99 const TQDate &selectionLowerLimit,
100 const TQDate &selectionUpperLimit,
101 int offset );
102
103 KCal::DateList mSelectedDates;
104
105 enum {
106 MAX_SELECTABLE_DAYS = 50
107 };
108};
109
110#endif
This class controls date navigation.
Definition: datenavigator.h:37