1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
6#include "nsISupports.idl"
7
8interface calICalendar;
9interface calIDateTime;
10interface calICalendarViewController;
11interface calIItemBase;
12
13/**
14 * An interface for view widgets containing calendaring data.
15 *
16 * @note Code that implements this interface is intended to be pure
17 * widgetry and thus not have any preference dependencies.
18 */
19
20[scriptable, uuid(0e392744-4b2e-4b64-8862-2fb707d900a7)]
21interface calICalendarView : nsISupports
22{
23
24  /**
25   * Oftentimes other elements in the DOM in which a calIDecoratedView is
26   * used want to be aware of whether or not the view is selected.  An element
27   * whose ID is observerID can be included in that DOM, and will be set to be
28   * enabled or disabled depending on whether the view is selected.
29   */
30  readonly attribute AUTF8String observerID;
31
32  /**
33   * Generally corresponds to whether or not the view has been previously shown.
34   * Strictly speaking, it reports whether displayCalendar, startDay and endDay
35   * are all non-null.
36   */
37  readonly attribute boolean initialized;
38
39  /**
40   * the calendar that this view is displaying
41   */
42  attribute calICalendar displayCalendar;
43
44  /**
45   * the controller for this view
46   */
47  attribute calICalendarViewController controller;
48
49  /**
50   * If true, the view supports workdays only
51   */
52  readonly attribute boolean supportsWorkdaysOnly;
53
54  /**
55   * If this is set to 'true', the view should not display days specified to be
56   * non-workdays.  The implementor is responsible for obtaining what those
57   * days are on its own.
58   */
59  attribute boolean workdaysOnly;
60
61  /**
62   * Whether or not tasks are to be displayed in the calICalendarView
63   */
64  attribute boolean tasksInView;
65
66  /**
67   * If true, the view is rotatable
68   */
69  readonly attribute boolean supportsRotation;
70
71  /**
72   * If set, the view will be rotated (i.e time on top, date at left)
73   */
74  attribute boolean rotated;
75
76  /**
77   * If true, the view is zoomable
78   */
79  readonly attribute boolean supportsZoom;
80
81  /**
82   * Zoom view in one level. Defaults to one level.
83   */
84  void zoomIn([optional] in uint32_t level);
85
86  /**
87   * Zoom view out one level. Defaults to one level.
88   */
89  void zoomOut([optional] in uint32_t level);
90
91  /**
92   * Reset view zoom.
93   */
94  void zoomReset();
95
96  /**
97   * Whether or not completed tasks are shown in the calICalendarView
98   */
99  attribute boolean showCompleted;
100
101  /**
102   * Ensure that the given date is visible; the view is free
103   * to show more dates than the given date (e.g. week view
104   * would show the entire week).
105   */
106  void showDate(in calIDateTime aDate);
107
108  /**
109   * Set a date range for the view to display, from aStartDate
110   * to aEndDate, inclusive.
111   *
112   * Some views may decide to utilize the time portion of these
113   * calIDateTimes; pass in calIDateTimes that are dates if you
114   * want to make sure this doesn't happen.
115   */
116  void setDateRange(in calIDateTime aStartDate, in calIDateTime aEndDate);
117
118  /**
119   * The start date of the view's display.  If the view is displaying
120   * disjoint dates, this will be the earliest date that's displayed.
121   */
122  readonly attribute calIDateTime startDate;
123
124  /**
125   * The end date of the view's display.  If the view is displaying
126   * disjoint dates, this will be the latest date that's displayed.
127   *
128   * Note that this won't be equivalent to the aEndDate passed to
129   * setDateRange, because that date isn't actually displayed!
130   */
131  readonly attribute calIDateTime endDate;
132
133  /**
134   * The first day shown in the embedded view
135   */
136  readonly attribute calIDateTime startDay;
137
138  /**
139   * The last day shown in the embedded view
140   */
141  readonly attribute calIDateTime endDay;
142
143  /**
144   * True if this view supports disjoint dates
145   */
146  readonly attribute boolean supportsDisjointDates;
147
148  /**
149   * True if this view currently has a disjoint date set.
150   */
151  readonly attribute boolean hasDisjointDates;
152
153  /**
154   * Returns the list of dates being shown by this calendar.
155   * If a date range is set, it will expand out the date range by
156   * day and return the full set.
157   */
158  Array<calIDateTime> getDateList();
159
160  /**
161   * Get the items currently selected in this view.
162   *
163   * @return the array of items currently selected in this.
164   */
165  Array<calIItemBase> getSelectedItems();
166
167   /**
168    * Select an array of items in the view.  Items outside the view's current
169    * display range will be ignored.
170    *
171    * @param aCount the number of items to select
172    * @param aItems an array of items to select
173    * @param aSuppressEvent if true, the 'itemselect' event will not be fired.
174    */
175  void setSelectedItems(in Array<calIItemBase> aItems, [optional] in boolean aSuppressEvent);
176
177  /**
178   * Make as many of the selected items as possible are visible in the view.
179   */
180  void centerSelectedItems();
181
182  /**
183   * Get or set the selected day.
184   */
185  attribute calIDateTime selectedDay;
186
187  /**
188   * Get or set the timezone that the view's elements should be displayed in.
189   * Setting this does not refresh the view.
190   */
191  attribute AUTF8String timezone;
192
193  /**
194   * Ensures that the given date is visible, and that the view is centered
195   * around this date.  aDate becomes the selectedDay of the view.  Calling
196   * this function with the current selectedDay effectively refreshes the view
197   *
198   * @param aDate       the date that must be shown in the view and becomes
199   *                    the selected day
200   */
201  void goToDay(in calIDateTime aDate);
202
203  /**
204   * Moves the view a specific number of pages.  Negative numbers correspond to
205   * moving the view backwards.  Note that it is up to the view to determine
206   * how the selected day ought to move as well.
207   *
208   * @param aNumber       the number of pages to move the view
209   */
210  void moveView(in long aNumber);
211
212  /**
213   * gets the description of the range displayed by the view
214   */
215  AString getRangeDescription();
216
217  /**
218   * The type of the view e.g "day", "week", "multiweek" or "month" that refers
219   * to the displayed time period.
220   */
221  readonly attribute string type;
222  /**
223   * removes the dropshadows that are inserted into childelements during a
224   * drag and drop session
225   */
226
227  void removeDropShadows();
228};
229