calendarui/views/dayview/inc/calendayinfo.h
changeset 45 b6db4fd4947b
equal deleted inserted replaced
23:fd30d51f876b 45:b6db4fd4947b
       
     1 /*
       
     2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Storage class for day and week views.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef  CALENDAYINFO_H
       
    19 #define  CALENDAYINFO_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32std.h>
       
    23 #include <QList>
       
    24 #include <QDateTime>
       
    25 #include <QAbstractItemModel>
       
    26 
       
    27 #include <calinstance.h>
       
    28 #include "caleninstanceid.h"
       
    29 
       
    30 
       
    31 //
       
    32 /** Scrolling directions **/
       
    33 enum TScrollDirection
       
    34     {
       
    35     EScrollUp,
       
    36     EScrollDown,
       
    37     EScrollLeft,
       
    38     EScrollRight
       
    39     };
       
    40 
       
    41 //Constants
       
    42 const int KFSCalMaxDescriptionLength = 100;
       
    43 const int KFSCalStartingHour = 8;
       
    44 const int KFSCalSlotsInHour = 2;
       
    45 
       
    46 /**
       
    47  * An interval containing a start and end slot.
       
    48  * The start slot belongs to the interval, the end slot
       
    49  * is the first slot outside of the interval. If the end slot
       
    50  * is before or at the same slot as the start slot, the interval
       
    51  * is considered empty.
       
    52  */
       
    53 class CalenSlotInterval
       
    54     {
       
    55 public:
       
    56     /**
       
    57      * Check if this interval overlaps the second interval.
       
    58      */
       
    59     bool Overlaps( const CalenSlotInterval& aInterval ) const;
       
    60 
       
    61     /**
       
    62      * Add aOffset to all slot coordinates later than aPos
       
    63      */
       
    64     void AddOffset( int aOffset, int aPos );
       
    65 
       
    66     /**
       
    67      * Set this interval to be the minimum interval
       
    68      * containing both this original interval and aInterval.
       
    69      */
       
    70     void Union( const CalenSlotInterval& aInterval );
       
    71 
       
    72     /**
       
    73      * Check if aInterval lies directly next to this interval.
       
    74      */
       
    75     bool Adjacent( const CalenSlotInterval& aInterval ) const;
       
    76 
       
    77     /**
       
    78      * Check if this interval is empty.
       
    79      */
       
    80     bool IsEmpty() const;
       
    81 
       
    82     /**
       
    83      * Set this interval to be the area contained in both
       
    84      * this interval and to aInterval.
       
    85      */
       
    86     void Intersect( const CalenSlotInterval& aInterval );
       
    87 
       
    88     /**
       
    89      * Remove aInterval from this interval. If aInterval lies
       
    90      * within this interval, the result is two separate intervals.
       
    91      * This object contains one of them, aSecondPart contains the other one.
       
    92      * If the result is just one single interval, this interval contains that
       
    93      * and aSecondPart is set to an empty interval.
       
    94      */
       
    95     void Subtract( const CalenSlotInterval& aInterval, CalenSlotInterval& aSecondPart );
       
    96 
       
    97     /**
       
    98      * Check if this interval starts later than aInterval.
       
    99      */
       
   100     bool operator>( const CalenSlotInterval& aInterval ) const;
       
   101 
       
   102     /**
       
   103      * The starting slot of the interval. This is the first slot
       
   104      * that belongs to the interval.
       
   105      */
       
   106     int iStartSlot;
       
   107     
       
   108     /**
       
   109      * The ending slot of the interval. This is the first slot
       
   110      * that doesn't belong to the interval.
       
   111      */
       
   112     int iEndSlot;
       
   113     };
       
   114 
       
   115 
       
   116 /**
       
   117  * Class for storing a calendar instance and the range it occupies.
       
   118  */
       
   119 struct CalenTimedEventInfo : public CalenSlotInterval
       
   120     {
       
   121 public:
       
   122     /**
       
   123      * The id of the calendar instance
       
   124      */
       
   125     TCalenInstanceId iId;
       
   126     
       
   127     /**
       
   128      * Status of the entry, needed for setting the displayed color later
       
   129      */
       
   130     AgendaEntry::Status iStatus;
       
   131     
       
   132     /**
       
   133      * Replication status of the entry, needed for setting the displayed color
       
   134      * later.
       
   135      */
       
   136 //    AgendaEntry::TReplicationStatus iReplicationStatus;
       
   137     };
       
   138 
       
   139 /**
       
   140  * Class for storing general time intervals and their associated
       
   141  * status (needed for displaying the interval).
       
   142  */
       
   143 struct CalenEventInterval : public CalenSlotInterval
       
   144     {
       
   145 public:
       
   146     /**
       
   147      * The status of this interval, if it represents only one calendar
       
   148      * instance.
       
   149      */
       
   150     AgendaEntry::Status iStatus;
       
   151     
       
   152     /**
       
   153      * The replication status of this interval, if it represents only one
       
   154      * calendar instance.
       
   155      */
       
   156 //    AgendaEntry::TReplicationStatus iReplicationStatus;
       
   157     
       
   158     /**
       
   159      * A flag saying that this interval represents a conflict between two or
       
   160      * more calendar instances.
       
   161      */
       
   162     bool iOverlap;
       
   163     };
       
   164 
       
   165 
       
   166 
       
   167 /**
       
   168  * A class containing a sequence of non-overlapping events,
       
   169  * visualised as a column.
       
   170  */
       
   171 class CalenTimeColumn : public CalenSlotInterval
       
   172     {
       
   173 public:
       
   174 
       
   175     /**
       
   176      * Explicitly frees the memory used by the event array.
       
   177      */
       
   178     void Close();
       
   179 
       
   180     /**
       
   181      * Add a new event to this column. Events must be added sequentially,
       
   182      * and must not overlap earlier events in this column.
       
   183      */
       
   184     void AddEvent( const CalenTimedEventInfo& aEvent );
       
   185 
       
   186     /**
       
   187      * Check if a new event can be added to this column.
       
   188      */
       
   189     bool CanFitEvent( const CalenTimedEventInfo& aEvent );
       
   190 
       
   191     /**
       
   192      * Check if this column contains an event with the id aId.
       
   193      */
       
   194     bool ContainsEvent( const TCalenInstanceId& aId );
       
   195 
       
   196     /**
       
   197      * Add aOffset to all slot coordinates later than aPos
       
   198      */
       
   199     void AddOffset( int aOffset, int aPos );
       
   200 
       
   201     /**
       
   202      * Event array.
       
   203      */
       
   204     QList<CalenTimedEventInfo> iEventArray;
       
   205     };
       
   206 
       
   207 
       
   208 /**
       
   209  * A class containing one or more columns with events,
       
   210  * where every event overlaps at least one event in some other
       
   211  * column. (Otherwise that event should be added to a separate region.)
       
   212  */
       
   213 class CalenTimeRegion : public CalenSlotInterval
       
   214     {
       
   215 public:
       
   216     
       
   217     /**
       
   218      * Explicitly frees the memory used by data structures.
       
   219      */
       
   220     void Close();
       
   221 
       
   222     /**
       
   223      * Check if the given interval overlaps with this region.
       
   224      */
       
   225     bool Overlaps( const CalenSlotInterval& aInterval ) const;
       
   226 
       
   227     /**
       
   228      * Add an event to this region. Events must be added sequentially,
       
   229      * and must overlap this region (unless it's the first event of the region).
       
   230      */
       
   231     void AddEvent( const CalenTimedEventInfo& aEvent );
       
   232 
       
   233     /**
       
   234      * Add aOffset to all slot coordinates later than aPos
       
   235      */
       
   236     void AddOffset( int aOffset, int aPos );
       
   237 
       
   238 private:
       
   239     
       
   240     /**
       
   241      * Add the event to the bookkeeping of overlapping/nonoverlapping
       
   242      * intervals.
       
   243      */
       
   244     void AddInterval( const CalenTimedEventInfo& aEvent );
       
   245     
       
   246 public:
       
   247 
       
   248     QList<CalenTimeColumn> iColumns;
       
   249     QList<CalenEventInterval> iIntervals;
       
   250     };
       
   251 
       
   252 
       
   253 /**
       
   254  * A container struct, used by the clients of the slot info storage,
       
   255  * to provide data in.
       
   256  */
       
   257 struct SCalenApptInfo
       
   258     {
       
   259     QModelIndex iIndex;
       
   260     QDateTime iStartTime;
       
   261     QDateTime iEndTime;
       
   262     bool iAllDay;
       
   263     TCalenInstanceId iId;
       
   264     AgendaEntry::Status iStatus;
       
   265 //    AgendaEntry::TReplicationStatus iReplicationStatus;
       
   266     TBufC<KFSCalMaxDescriptionLength> iSummary;
       
   267     TUint32 iColor;
       
   268     };
       
   269 
       
   270 
       
   271 /**
       
   272  * Storage class for storing all calendar instances within one day. This
       
   273  * class organises the data according to the way it will be needed in the
       
   274  * day and week view.
       
   275  */
       
   276 class CalenDayInfo
       
   277     {
       
   278 public:
       
   279 
       
   280     enum TSlotsInHour
       
   281         {
       
   282         EOne = 1,
       
   283         ETwo,
       
   284         EThree,
       
   285         EFour
       
   286         };
       
   287 
       
   288 public:  // Constructors and destructor
       
   289 
       
   290     /**
       
   291      * C++ default constructor.
       
   292      */
       
   293     CalenDayInfo( TSlotsInHour aSlotsInHour );
       
   294     
       
   295     /**
       
   296      * Destructor
       
   297      */
       
   298     virtual ~CalenDayInfo();
       
   299 
       
   300 
       
   301 public:     // New functions
       
   302 
       
   303     /**
       
   304      * Reset the storage, remove all data and set the state back to normal.
       
   305      */
       
   306     void Reset();
       
   307 
       
   308     /**
       
   309      * Add a timed event. All timed events must be added in increasing
       
   310      * order (sorted by starting time).
       
   311      */
       
   312     void InsertTimedEvent( const SCalenApptInfo& aItemInfo );
       
   313     
       
   314     /**
       
   315      * Add an untimed event.
       
   316      */
       
   317 //    void InsertUntimedEventL( const CCalInstance& aInstance );
       
   318     
       
   319     /**
       
   320      * Add an untimed event. (Nonleaving version, useful for testing.)
       
   321      */
       
   322     void InsertUntimedEvent( AgendaEntry::Type aType,
       
   323                              const TCalenInstanceId& aId );
       
   324     /**
       
   325      * Add an allday event.
       
   326      */
       
   327     void InsertAlldayEvent( const SCalenApptInfo& aItemInfo );
       
   328 
       
   329     /**
       
   330      * Is the given event allday event
       
   331      * @param aStart time to be checked
       
   332      * @param aEnd time to be checked
       
   333      * @return true if this is allday event, false otherwise
       
   334      */
       
   335     static bool IsAlldayEvent( QDateTime aStart, QDateTime aEnd );
       
   336 
       
   337     /**
       
   338      * Is the given event allday event
       
   339      * @param aInstance Instance to be checked
       
   340      * @return true if this is allday event, false otherwise
       
   341      */
       
   342 //    static bool IsAlldayEvent( const CCalInstance& aInstance );
       
   343 
       
   344     /**
       
   345      * Return the slot number where this class would insert the
       
   346      * untimed events if nothing else is specified.
       
   347      */
       
   348     int SuggestedUntimedSlotPos();
       
   349     
       
   350     /**
       
   351      * Return how many untimed slots is needed for this day.
       
   352      */
       
   353     int NeededUntimedSlotCount();
       
   354 
       
   355     /**
       
   356      * Update the indexing to take the current amount of untimed slots
       
   357      * into account. This must be called after all untimed events
       
   358      * have been added.
       
   359      *
       
   360      * @param aSlot the slot where the untimed events are to be added.
       
   361      *              If negative, uses the default, otherwise aSlot must
       
   362      *              be less than or equal to the default position as
       
   363      *              returned by SuggestedUntimedSlotPos().
       
   364      * @param aUntimedCount the number of slots to insert for untimed events. If
       
   365      *                      aSlot is specified, this must be larger or equal
       
   366      *                      to NeededUntimedSlotCount().
       
   367      */
       
   368     int UpdateUntimedPos( int aSlot = -1, int aUntimedCount = 0 );
       
   369 
       
   370     /**
       
   371      * Return the first slot containing a non-allday event.
       
   372      * If this class doesn't contain any data, returns KErrNotFound.
       
   373      */
       
   374     int FirstOccupiedSlot();
       
   375     
       
   376     /**
       
   377      * Return the last slot containing a non-allday event.
       
   378      * If this class doesn't contain any data, returns KErrNotFound.
       
   379      */
       
   380     int LastOccupiedSlot();
       
   381 
       
   382     int EarliestEndSlot();
       
   383     int LastStartSlot();
       
   384 
       
   385 
       
   386     /**
       
   387      * Convert a starting time into a slot index.
       
   388      */
       
   389     int SlotIndexForStartTime( QDateTime aStartTime );
       
   390     
       
   391     /**
       
   392      * Convert an ending time into a slot index.
       
   393      */
       
   394     int SlotIndexForEndTime( QDateTime aStartTime );
       
   395 
       
   396     /**
       
   397      * Get information about where the item aItemInfo
       
   398      * should be displayed. The parameters are filled
       
   399      * on return.
       
   400      *
       
   401      * @param aStartSlot    the first slot of the event
       
   402      * @param aEndSlot      the first slot after the event
       
   403      * @param aColumnIndex  the column in which this event is located
       
   404      * @param aColumns      the total number of columns in the region
       
   405      *                      this event belongs to
       
   406      */
       
   407     void GetLocation( const SCalenApptInfo& aItemInfo,
       
   408                       int& aStartSlot,
       
   409                       int& aEndSlot,
       
   410                       int& aColumnIndex,
       
   411                       int& aColumns );
       
   412 
       
   413     /**
       
   414      * Get the number of allday events
       
   415      */
       
   416     int AlldayCount();
       
   417     
       
   418     /**
       
   419      * Get the number of todo events
       
   420      */
       
   421     int TodoCount();
       
   422 
       
   423     /**
       
   424      * Check if a slot is the first slot of an hour.
       
   425      */
       
   426     bool IsHourStartSlot( const int& aSlotIndex ) const;
       
   427     
       
   428     /**
       
   429      * Check if a slot is an extra slot (for untimed events).
       
   430      */
       
   431     bool IsExtraSlot( const int& aSlotIndex ) const;
       
   432     
       
   433     /**
       
   434      * Convert a slot index into a hour
       
   435      */
       
   436     int HourFromSlotIndex( const int& aSlotIndex ) const;
       
   437     
       
   438     /**
       
   439      * Convert a hour into a slot index.
       
   440      */
       
   441     int SlotIndexFromHour( int aHour );
       
   442 
       
   443     /**
       
   444      * Rounds the slot number up (towards earlier hours) to an even hour
       
   445      */
       
   446     int RoundHourUp( int aSlot );
       
   447 
       
   448     /**
       
   449      * Rounds the slot number down (towards later hours) to an even hour
       
   450      */
       
   451     int RoundHourDown( int aSlot );
       
   452 
       
   453     /**
       
   454      * Get the starting slot of the current selection
       
   455      */
       
   456     void GetSelectedSlot( int& aSlot, int& aRegion, int& aColumnIndex, int& aColumns );
       
   457     
       
   458     /**
       
   459      * Try to move the selection in the given direction
       
   460      *
       
   461      * @return true if able to move the selection, false if
       
   462      *         unable to move (indicating that the selection should move
       
   463      *         to the next/previous day).
       
   464      */
       
   465     bool MoveSelection( TScrollDirection aDirection );
       
   466 
       
   467     /**
       
   468      * Move the selected slot within the currently selected event.
       
   469      */
       
   470     void MoveSelectionInEvent( TScrollDirection aDirection );
       
   471 
       
   472     /**
       
   473      * Make sure the selected slot within the currently selected event is valid.
       
   474      */
       
   475     void UpdateSelectionInEvent();
       
   476 
       
   477     /**
       
   478      * Check if any event currently is selected.
       
   479      */
       
   480     bool IsEventSelected() const;
       
   481     
       
   482     /**
       
   483      * Check if the current selection actually denotes
       
   484      * more than one event (the todo event slot is selected,
       
   485      * containing more than one todo).
       
   486      */
       
   487     bool IsMultipleEventsSelected() const;
       
   488     
       
   489     /**
       
   490      * Check if an allday event currently is selected.
       
   491      */
       
   492     bool IsAlldayEventSelected() const;
       
   493 
       
   494     /**
       
   495      * Get the instance id of the currently selected event.
       
   496      */
       
   497     TCalenInstanceId SelectedEvent();
       
   498 
       
   499     /**
       
   500      * Update the state to make the given calendar instance selected
       
   501      *
       
   502      * @return KErrNotFound if the instance isn't found, KErrNone otherwise.
       
   503      */
       
   504     int SelectEvent( const TCalenInstanceId& aId );
       
   505 
       
   506     /**
       
   507      * Get the instance id of an untimed event. Maximally one
       
   508      * todo event is counted into this, i.e. aIndex = 1 never returns
       
   509      * a todo event even though there are more than one.
       
   510      */
       
   511     TCalenInstanceId UntimedEvent( int aIndex );
       
   512 
       
   513     /**
       
   514      * Get info about an allday event.
       
   515      */
       
   516     const CalenTimedEventInfo& AlldayEvent( int aIndex );
       
   517 
       
   518     /**
       
   519      * Move the selection to the given slot, possibly selecting
       
   520      * an event.
       
   521      */
       
   522     void SelectSlot( int aSlot );
       
   523 
       
   524     /**
       
   525      * Return the list of regions.
       
   526      */
       
   527     const QList<CalenTimeRegion>& RegionList() const;
       
   528 
       
   529     /**
       
   530      * Get the list of event intervals (for use in week view and ribbon).
       
   531      */
       
   532     void GetEventIntervals( QList<CalenEventInterval>& aArray ) const;
       
   533 
       
   534     /**
       
   535      * Return the interval which is selected currently.
       
   536      */
       
   537     CalenSlotInterval SelectedInterval();
       
   538     
       
   539     /**
       
   540      * Sets selection within a region
       
   541      * 
       
   542      * @param aRegion Region index.
       
   543      * @param aColumn Column index.
       
   544      * @param aSlot   Slot number (has to be aligned to full hour).
       
   545      */
       
   546     bool SetSelectionInRegion( int aRegion, int aColumn, int aSlot );
       
   547 
       
   548 private:
       
   549 
       
   550     enum TMoveDirection
       
   551         {
       
   552         EMoveDirectionUp = -1,
       
   553         EMoveDirectionDown = 1
       
   554         };
       
   555 
       
   556     /**
       
   557      * See if any region overlaps the given interval. Regions are searched
       
   558      * in the direction specified by aDirection, e.g. if aDirection < 0,
       
   559      * this returns the last overlapping region, if aDirection > 0, returns
       
   560      * the first overlapping instead.
       
   561      *
       
   562      * @return the index of the found overlapping region, or -1 if no
       
   563      *         matching region was found.
       
   564      */
       
   565     int FindRegion( const CalenSlotInterval& aInterval, int aDirection );
       
   566 
       
   567     /**
       
   568      * See if any event overlaps the given interval within the current column.
       
   569      * Events are searched in the direction specified by aDirection,
       
   570      * e.g. if aDirection < 0, this returns the last overlapping event,
       
   571      * if aDirection > 0, returns the first overlapping instead.
       
   572      *
       
   573      * @return the index within the column of the overlapping event, or -1 if no
       
   574      *         matching event was found.
       
   575      */
       
   576     int FindEvent( const CalenSlotInterval& aInterval, int aDirection );
       
   577 
       
   578     /**
       
   579      * Update the selection state by selecting the first event which ends at
       
   580      * the end of the current region.
       
   581      */
       
   582     void EnterRegionFromBelow();
       
   583     
       
   584     /**
       
   585      * Update the selection state by selecting the first event which starts
       
   586      * at the start of the current region.
       
   587      */
       
   588     void EnterRegionFromAbove();
       
   589 
       
   590     /**
       
   591      * Try to move the selection in the given direction, when an
       
   592      * empty area is selected.
       
   593      *
       
   594      * @return true if able to move the selection, false if
       
   595      *         unable to move (indicating that the selection should move
       
   596      *         to the next/previous day).
       
   597      */
       
   598     bool MoveInEmptyArea( TScrollDirection aDirection );
       
   599     
       
   600     /**
       
   601      * Try to move the selection in the given direction, when the
       
   602      * selection is in a region.
       
   603      *
       
   604      * @return true if able to move the selection, false if
       
   605      *         unable to move (indicating that the selection should move
       
   606      *         to the next/previous day).
       
   607      */
       
   608     bool MoveInRegion( TScrollDirection aDirection );
       
   609     
       
   610     /**
       
   611      * Try to move the selection in the given direction, when an
       
   612      * allday event is selected
       
   613      *
       
   614      * @return true if able to move the selection, false if
       
   615      *         unable to move (indicating that the selection should move
       
   616      *         to the next/previous day).
       
   617      */
       
   618     bool MoveInAlldayEvent( TScrollDirection aDirection );
       
   619 
       
   620     /**
       
   621      * Update the selection state by moving from one ordinary event column
       
   622      * to another, in the given direction
       
   623      */
       
   624     void MoveBetweenColumns( TScrollDirection aDirection );
       
   625 
       
   626     /**
       
   627      * Update the selection state by moving in the given direction
       
   628      */
       
   629     void MoveInColumn( int aDirection );
       
   630     
       
   631     /**
       
   632      * The selection should be moved out of the current region (in the given
       
   633      * direction), update the selection state according to what there is
       
   634      * outside of the region.
       
   635      */
       
   636     void MoveOutFromRegion( int aDirection );
       
   637 
       
   638     /**
       
   639      * Set the selected slot within the current event according to the selection
       
   640      * direction.
       
   641      */
       
   642     void SetSelectionInEvent( int aDirection );
       
   643 
       
   644     /**
       
   645      * Determines how large area to scan for new events/regions when moving in the
       
   646      * given direction.
       
   647      *
       
   648      * I.e., if moving upwards, returns the whole interval from the start of aInterval
       
   649      * up to the next slot which can be focused as an empty slot. If aInterval doesn't
       
   650      * start on an even hour, the returned interval is from the start of the first whole
       
   651      * hour before the interval, to the start of aInterval.
       
   652      *
       
   653      * If moving downwards, returns the whole interval from the end of aInterval to the
       
   654      * end of the next whole hour after the interval.
       
   655      *
       
   656      */
       
   657     CalenSlotInterval NextFocusArea( const CalenSlotInterval& aInterval, int aDirection );
       
   658 
       
   659     /**
       
   660      * Return the next slot to focus if moving in the given direction from the interval
       
   661      * and focusing an empty slot.
       
   662      */
       
   663     int NextEmptyFocusSlot( const CalenSlotInterval& aInterval, int aDirection );
       
   664     
       
   665     /**
       
   666      * Return the interval which the current selection state represents, if
       
   667      * an empty area is selected.
       
   668      */
       
   669     CalenSlotInterval EmptySelectionInterval();
       
   670 
       
   671     /**
       
   672      * Backup the whole selection state.
       
   673      */
       
   674     void StoreOrigSelection();
       
   675     
       
   676     /**
       
   677      * Check if the current selection state is valid, if not, reset it
       
   678      * to the backed up copy
       
   679      * @return true if selection state is valid, false if not.
       
   680      */
       
   681     bool ValidateSelection();
       
   682 
       
   683 private:    // New data
       
   684 
       
   685     QList<CalenTimeRegion> iRegionList;
       
   686     QList<TCalenInstanceId> iUntimedEvents;
       
   687     QList<TCalenInstanceId> iTodoEvents;
       
   688     QList<CalenTimedEventInfo> iAlldayEvents;
       
   689 
       
   690     int iLastStartSlot;
       
   691     int iEarliestEndSlot;
       
   692     /**
       
   693      * The total number of untimed slots.
       
   694      */
       
   695     int iUntimedSlotCount;
       
   696     /**
       
   697      * The slot index of the first untimed slot.
       
   698      */
       
   699     int iFirstUntimedSlot;
       
   700     /**
       
   701      * The number of empty untimed slots.
       
   702      */
       
   703     int iEmptyUntimedSlots;
       
   704     /**
       
   705      * The number of slots per hour.
       
   706      */
       
   707     TSlotsInHour iSlotsInHour;
       
   708 
       
   709     /**
       
   710      * Chooses which allday event is selected. If none currently is selected,
       
   711      * this is negative. This variable overrides the rest selection variables.
       
   712      * If this points to an allday event, the other variables are ignored,
       
   713      * except iSelectedSlot which is used for returning to the original place
       
   714      * if moving back to the ordinary events.
       
   715      */
       
   716     int iSelectedAlldayEvent;
       
   717 
       
   718     /**
       
   719      * Chooses which region currently is selected. If none currently is selected,
       
   720      * this is negative. If this points to a region, iSelectedColumn and
       
   721      * iSelectedColumnEventIndex are taken into account.
       
   722      */
       
   723     int iSelectedRegion;
       
   724 
       
   725     /**
       
   726      * Chooses which column is selected within the currently selected region.
       
   727      * If this is equal to the number of columns, the last, implicit, empty column
       
   728      * is selected.
       
   729      */
       
   730     int iSelectedColumn;
       
   731     /**
       
   732      * Chooses which event is selected within the currently selected column. If
       
   733      * none is selected, this is negative.
       
   734      */
       
   735     int iSelectedColumnEventIndex;
       
   736     /**
       
   737      * Chooses which slot in the day currently is in focus. This must always point
       
   738      * to a valid slot. If an event is selected within a column, it points to an
       
   739      * slot within that event. If no event is selected, it points to the start
       
   740      * of the currently selected empty time region (which is iSlotsInHour slots long).
       
   741      * If an allday event is selected, this points to the last selected slot in the
       
   742      * ordinary day area.
       
   743      */
       
   744     int iSelectedSlot;
       
   745 
       
   746     // copies of the current selection state, to be used for reverting to the original
       
   747     // state if the selection is moved to an invalid position
       
   748     int iOrigSelectedAlldayEvent;
       
   749     int iOrigSelectedRegion;
       
   750     int iOrigSelectedColumn;
       
   751     int iOrigSelectedSlot;
       
   752     int iOrigSelectedColumnEventIndex;
       
   753 
       
   754     };
       
   755 
       
   756 #endif // CALENDAYINFO_H
       
   757 
       
   758 
       
   759 // End of File