calendarwidgetplugin/inc/calendarwidget.h
changeset 0 db1bf15cefff
child 1 f8e7eccf5f96
equal deleted inserted replaced
-1:000000000000 0:db1bf15cefff
       
     1 /*
       
     2 * Copyright (c) 2009 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: Home screen calendar widget
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CALENDARWIDGET_H
       
    19 #define CALENDARWIDGET_H
       
    20 
       
    21 // System includes
       
    22 #include <hbwidget.h>
       
    23 
       
    24 // Forward declarations
       
    25 class HbLabel;
       
    26 class QGraphicsLinearLayout;
       
    27 class HbFrameDrawer;
       
    28 class HbFrameItem;
       
    29 class ContentLayoutHandler;
       
    30 class DateIconLayoutHandler;
       
    31 class MainLayoutHandler;
       
    32 /*!
       
    33     \class HbWidget
       
    34     \brief The super class for homescreen widgets.
       
    35 */
       
    36 class HbWidget;
       
    37 class XQServiceRequest;
       
    38 class HbDocumentLoader;
       
    39 class QTranslator;
       
    40 
       
    41 /*!
       
    42     \class CalendarWidget
       
    43     \brief The CalendarWidget class is the main class for the calendar widget project
       
    44 */
       
    45 // Class declaration
       
    46 class CalendarWidget : public HbWidget
       
    47 {
       
    48     Q_OBJECT
       
    49 
       
    50 public:
       
    51     /*! 
       
    52         \fn CalendarWidget::CalendarWidget(QGraphicsItem* parent, Qt::WindowFlags flags)
       
    53         
       
    54         Constructor of the CalendarWidget class.
       
    55      */
       
    56     CalendarWidget(QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0);
       
    57     /*!
       
    58         \fn CalendarWidget::~CalendarWidget()
       
    59 
       
    60         Destructor of the CalendarWidget class.
       
    61     */
       
    62     ~CalendarWidget();
       
    63     /*!
       
    64         \fn QRectF CalendarWidget::boundingRect() const
       
    65 
       
    66         Derived from HbWidget. Returns the bounding rectangle of the widget.
       
    67     */
       
    68     QRectF boundingRect() const;
       
    69     /*!
       
    70         \fn QPainterPath CalendarWidget::shape() const
       
    71 
       
    72         Derived from HbWidget. Returns the shape of the widget.
       
    73     */
       
    74     QPainterPath shape() const;
       
    75 
       
    76 signals:
       
    77     /*!
       
    78         \fn void CalendarWidget::mousePressed(QPointF& point)
       
    79 
       
    80         Emitted by the widget when mouse press event is received
       
    81         @param point The position in which the event took place.
       
    82     */
       
    83     void mousePressed(QPointF& point);
       
    84     /*!
       
    85         \fn void CalendarWidget::mouseReleased()
       
    86 
       
    87         Emitted by the widget when mouse release event is received.
       
    88     */
       
    89     void mouseReleased();
       
    90     /*!
       
    91         \fn void CalendarWidget::themeChanged()
       
    92 
       
    93         Emitted by the framework when a theme change event is received by the widget.
       
    94     */
       
    95     void themeChanged();
       
    96     /*!
       
    97         \fn void CalendarWidget::finished()
       
    98 
       
    99         Emitted by the widget if the initialization fails.
       
   100     */
       
   101     void finished();
       
   102         /*!
       
   103         \fn void CalendarWidget::tapGesture(QPointF& point)
       
   104 
       
   105         Emitted by the widget when the widget receives a tap gesture.
       
   106         @param point Position of the tap gesture
       
   107     */
       
   108     void tapGesture(QPointF& point);
       
   109 
       
   110 protected:
       
   111     /*!
       
   112         \fn bool CalendarWidget::event(QEvent *  event)
       
   113 
       
   114         Derived from HbWidget. Catches all the events that are directed to the widget.
       
   115         @param event The received event.
       
   116     */
       
   117     bool event(QEvent *  event);
       
   118     /*!
       
   119         \fn bool CalendarWidget::eventFilter(QObject * obj, QEvent * event)
       
   120 
       
   121         Reimplemented from QObject. Filters events when CalendarWidget has 
       
   122         been installed as an event filter for a watched object. Used for detecting 
       
   123         mouse press events before they arrive to HomeScreen application.
       
   124         @param obj The watched object.
       
   125         @param event The caught event.
       
   126     */
       
   127     bool eventFilter(QObject *obj, QEvent *event);
       
   128     /*!
       
   129         \fn void CalendarWidget::gestureEvent(QGestureEvent *event)
       
   130 
       
   131         Reimplemented from HbWidgetBase. Called by the framework when 
       
   132         a gesture event has been received.
       
   133         @param event The received event
       
   134     */
       
   135     void gestureEvent(QGestureEvent *event);
       
   136 
       
   137 public slots:
       
   138     /*!
       
   139         \fn void CalendarWidget::onShow()
       
   140 
       
   141         Called by the framework each time the widget is shown on the screen.
       
   142     */
       
   143     void onShow();
       
   144     /*!
       
   145         \fn void CalendarWidget::onHide()
       
   146 
       
   147         Called by the framework each time the widget is hidden from the screen.
       
   148     */
       
   149     void onHide();
       
   150     /*!
       
   151         \fn void CalendarWidget::onInitialize()
       
   152 
       
   153         Called by the framework each time the widget is initialized.
       
   154     */
       
   155     void onInitialize();
       
   156     /*!
       
   157         \fn void CalendarWidget::onUninitialize()
       
   158 
       
   159         Called by the framework each time the widget is deleted.
       
   160     */
       
   161     void onUninitialize();
       
   162 
       
   163 private:
       
   164     /*!
       
   165         \fn bool CalendarWidget::loadWidget()
       
   166 
       
   167         Used by CalendarWidget::onInitialize to load the DOCML and create the layout handlers. 
       
   168         Upon success it returns true. If initialization fails it returns false. 
       
   169     */
       
   170     bool loadWidget();
       
   171     /*!
       
   172         \fn void CalendarWidget::mousePressEvent(QGraphicsSceneMouseEvent *aEvent)
       
   173 
       
   174         Called by the framework when the mouse is pressed on the top of the widget.
       
   175         Does not currently do anything. Mouse press events are caught using an event filter.
       
   176         @param aEvent The received mouse event
       
   177     */
       
   178     void mousePressEvent(QGraphicsSceneMouseEvent *aEvent);
       
   179     /*!
       
   180         \fn void CalendarWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *aEvent)
       
   181 
       
   182         Called by the framework when the mouse is released on the top of the widget.
       
   183         @param aEvent The received mouse event
       
   184     */
       
   185     void mouseReleaseEvent(QGraphicsSceneMouseEvent *aEvent);
       
   186     /*!
       
   187         \fn void CalendarWidget::loadTranslator()
       
   188 
       
   189         Loads and installs the localization.
       
   190     */
       
   191     void loadTranslator();
       
   192     /*!
       
   193         \fn void CalendarWidget::connectLayoutHandler(HbWidget *widget, QObject *layoutHandler, HbDocumentLoader& loader)()
       
   194 
       
   195         Used by CalendarWidget::loadWidget() to initialize the layouts and to connect the widget's signals with 
       
   196         layout handler's slots.
       
   197         @param widget Main widget
       
   198         @param layoutHandler Layout handler to connect
       
   199         @param loader Document loader needed for getting the relevant objects
       
   200     */
       
   201     void connectLayoutHandler(HbWidget *widget, QObject *layoutHandler, HbDocumentLoader& loader);
       
   202     /*!
       
   203         \fn bool CalendarWidget::parseFile(QString& fileName, HbDocumentLoader& loader)
       
   204 
       
   205         Parses an XML file that describes the functionality of the widget.
       
   206         @param fileName Name of the XML file
       
   207         @param loader Document loader that contains the relevant objects
       
   208     */
       
   209     bool parseFile(QString& fileName, HbDocumentLoader& loader);
       
   210 
       
   211 private: // data
       
   212     Q_DISABLE_COPY(CalendarWidget)
       
   213     QTranslator* mCommonTranslator;
       
   214     
       
   215     //For documentation purpose
       
   216     ContentLayoutHandler* mContent;
       
   217 };
       
   218 
       
   219 #endif // CALENDARWIDGET_H