calendarui/views/dayview/inc/calendayutils.h
changeset 45 b6db4fd4947b
child 55 2c54b51f39c4
child 58 ef813d54df51
equal deleted inserted replaced
23:fd30d51f876b 45:b6db4fd4947b
       
     1 /*
       
     2 * Copyright (c) 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:  CalenDayUtils utility class header.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CALENDAYUTILS_H_
       
    19 #define CALENDAYUTILS_H_
       
    20 
       
    21 // Forward declarations
       
    22 class HbMainWindow;
       
    23 class QDateTime;
       
    24 class AgendaEntry;
       
    25 
       
    26 class CalenDayUtils
       
    27 {
       
    28 public:
       
    29     static CalenDayUtils *instance();
       
    30     ~CalenDayUtils();
       
    31     
       
    32     qreal screenWidth() const;
       
    33     qreal hourElementWidth() const;
       
    34     qreal hourElementHeight() const;
       
    35     qreal contentWidth() const;
       
    36     
       
    37     Qt::Orientation orientation() const;
       
    38     
       
    39     HbMainWindow* mainWindow();
       
    40     
       
    41     bool isHorizontalSwipe(qreal angle) const;
       
    42     
       
    43     /**
       
    44      * Get event's start/end time fromm agenda entry.
       
    45      * Start/end time are validated to be within the current day (the case of
       
    46      * multi-day events)
       
    47      * @param start [out] valid start time
       
    48      * @param end [out] valid end time
       
    49      * @param entry [in] agenda entry asociated with the event.
       
    50      * @param currentDate [in] current date
       
    51      */
       
    52     void getEventValidStartEndTime( QDateTime& start, QDateTime& end,
       
    53                                    AgendaEntry& entry, QDateTime& currentDate );
       
    54     
       
    55 protected:
       
    56     CalenDayUtils();
       
    57     
       
    58 private:
       
    59     qreal calculateHourElementWidth() const;
       
    60     qreal calculateHourElementHeight() const;
       
    61     
       
    62 private:    // data
       
    63     
       
    64     static CalenDayUtils* mInstance;
       
    65     
       
    66     HbMainWindow* mMainWindow;  //!< Pointer to main window
       
    67     
       
    68     qreal mHourElementWidth;    //!< The width of hour element
       
    69     qreal mHourElementHeight;   //!< The height of hour element
       
    70 };
       
    71 
       
    72 #endif /* CALENDAYUTILS_H_ */