src/hbcore/gui/hbmainwindow.h
changeset 0 16d8024aca5e
child 1 f7ac710697a9
equal deleted inserted replaced
-1:000000000000 0:16d8024aca5e
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (developer.feedback@nokia.com)
       
     6 **
       
     7 ** This file is part of the HbCore module of the UI Extensions for Mobile.
       
     8 **
       
     9 ** GNU Lesser General Public License Usage
       
    10 ** This file may be used under the terms of the GNU Lesser General Public
       
    11 ** License version 2.1 as published by the Free Software Foundation and
       
    12 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
       
    13 ** Please review the following information to ensure the GNU Lesser General
       
    14 ** Public License version 2.1 requirements will be met:
       
    15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    16 **
       
    17 ** In addition, as a special exception, Nokia gives you certain additional
       
    18 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    20 **
       
    21 ** If you have questions regarding the use of this file, please contact
       
    22 ** Nokia at developer.feedback@nokia.com.
       
    23 **
       
    24 ****************************************************************************/
       
    25 
       
    26 #ifndef HBMAINWINDOW_H
       
    27 #define HBMAINWINDOW_H
       
    28 
       
    29 #include <QGraphicsView>
       
    30 
       
    31 #include <hbglobal.h>
       
    32 #include <hbnamespace.h>
       
    33 
       
    34 QT_BEGIN_NAMESPACE
       
    35 class QGraphicsWidget;
       
    36 QT_END_NAMESPACE
       
    37 
       
    38 class HbAction;
       
    39 class HbMainWindowPrivate;
       
    40 class HbView;
       
    41 
       
    42 class HB_CORE_EXPORT HbMainWindow : public QGraphicsView
       
    43 {
       
    44     Q_OBJECT
       
    45     //Deprecated
       
    46     Q_PROPERTY(int currentViewIndex READ currentViewIndex WRITE setCurrentViewIndex)
       
    47     //Deprecated
       
    48     Q_PROPERTY(int viewCount READ viewCount)
       
    49     Q_PROPERTY(Qt::Orientation orientation 
       
    50                READ orientation
       
    51                WRITE setOrientation
       
    52                RESET unsetOrientation
       
    53                NOTIFY orientationChanged )
       
    54 
       
    55 public:
       
    56 
       
    57     //deprecated
       
    58     enum Element {
       
    59         RootItem,
       
    60         ViewportItem,
       
    61         BackgroundItem
       
    62     };
       
    63 
       
    64     explicit HbMainWindow(QWidget *parent = 0, Hb::WindowFlags windowFlags = Hb::WindowFlagNone);
       
    65     ~HbMainWindow();
       
    66 
       
    67     // deprecated
       
    68     QGraphicsWidget *removeView(int index);
       
    69     // deprecated
       
    70     int currentViewIndex() const;
       
    71     // deprecated
       
    72     int viewCount() const;
       
    73     // deprecated
       
    74     int indexOfView(HbView *view) const;
       
    75     // deprecated
       
    76     HbView *viewAt(int index) const;
       
    77 
       
    78     HbView *addView(QGraphicsWidget *widget = 0);
       
    79     HbView *insertView(int index, QGraphicsWidget *widget = 0);
       
    80     void removeView(QGraphicsWidget *widget);
       
    81     QList<HbView *> views() const;
       
    82     HbView *currentView() const;
       
    83     void setCurrentView(HbView *view, bool animate = true, Hb::ViewSwitchFlags flags = Hb::ViewSwitchDefault);
       
    84 
       
    85     // Deprecated
       
    86     QGraphicsWidget *element(HbMainWindow::Element element) const;
       
    87 
       
    88     Qt::Orientation orientation() const;
       
    89     void setOrientation(Qt::Orientation orientation, bool animate = true);
       
    90     void unsetOrientation(bool animate = true);
       
    91     
       
    92     // Deprecated
       
    93     void showItems(Hb::SceneItems items);
       
    94     // Deprecated
       
    95     void hideItems(Hb::SceneItems items);
       
    96     // Deprecated
       
    97     Hb::SceneItems visibleItems() const;
       
    98     // Deprecated
       
    99     bool isItemVisible(Hb::SceneItem item)  const;
       
   100     // Deprecated
       
   101     void setItemVisible(Hb::SceneItem item, bool visible);
       
   102     
       
   103     WId nativeBackgroundWindow();
       
   104     void resetNativeBackgroundWindow();
       
   105 
       
   106     QRectF layoutRect() const;
       
   107 
       
   108     void setBackgroundImageName(Qt::Orientation orientation, const QString &name);
       
   109     QString backgroundImageName(Qt::Orientation orientation) const;
       
   110 
       
   111 public slots:
       
   112     // Deprecated
       
   113     void setCurrentViewIndex(int index);
       
   114     // Deprecated
       
   115     void nextView();
       
   116     // Deprecated
       
   117     void previousView();
       
   118 
       
   119     void broadcastEvent( int eventType );
       
   120 
       
   121     // Deprecated
       
   122     void toggleOrientation();
       
   123 
       
   124 signals:
       
   125     // deprecated
       
   126     void currentViewIndexChanged(int index);
       
   127     void viewReady();
       
   128     void currentViewChanged(HbView *view);
       
   129     void aboutToChangeOrientation();
       
   130     void aboutToChangeOrientation(Qt::Orientation newOrientation, bool animated);
       
   131     void orientationChanged(Qt::Orientation orientation);
       
   132 
       
   133 protected:
       
   134     void changeEvent(QEvent *event);
       
   135     void closeEvent(QCloseEvent *event);
       
   136     void keyPressEvent(QKeyEvent *event);
       
   137     void keyReleaseEvent(QKeyEvent *event);
       
   138     void resizeEvent(QResizeEvent *event);
       
   139     void customEvent(QEvent *event);
       
   140     void scrollContentsBy(int dx, int dy);
       
   141     void paintEvent(QPaintEvent *event);
       
   142 
       
   143     HbMainWindowPrivate *const d_ptr;
       
   144 
       
   145 private:
       
   146     Q_DISABLE_COPY(HbMainWindow)
       
   147     Q_DECLARE_PRIVATE_D(d_ptr, HbMainWindow)
       
   148     Q_PRIVATE_SLOT(d_func(), void rootItemFirstPhaseDone(const HbEffect::EffectStatus& status))
       
   149     Q_PRIVATE_SLOT(d_func(), void rootItemFinalPhaseDone(const HbEffect::EffectStatus& status))
       
   150     Q_PRIVATE_SLOT(d_func(), void orientationEffectFinished(const HbEffect::EffectStatus& status))
       
   151     Q_PRIVATE_SLOT(d_func(), void _q_viewChanged(int))
       
   152     Q_PRIVATE_SLOT(d_func(), void _q_viewRemoved(QGraphicsWidget *))
       
   153     Q_PRIVATE_SLOT(d_func(), void _q_viewTitleChanged(const QString &))
       
   154     Q_PRIVATE_SLOT(d_func(), void _q_viewToolBarChanged())
       
   155     Q_PRIVATE_SLOT(d_func(), void _q_viewDockWidgetChanged())
       
   156     Q_PRIVATE_SLOT(d_func(), void _q_launchMenu(const QPointF &))
       
   157     Q_PRIVATE_SLOT(d_func(), void _q_viewVisibleItemsChanged())
       
   158     Q_PRIVATE_SLOT(d_func(), void _q_contentFullScreenChanged())
       
   159     Q_PRIVATE_SLOT(d_func(), void _q_themeChanged())
       
   160     Q_PRIVATE_SLOT(d_func(), void _q_continueBroadcasting(int))
       
   161     Q_PRIVATE_SLOT(d_func(), void _q_restoreTitlePane())
       
   162     Q_PRIVATE_SLOT(d_func(), void _q_delayedConstruction())
       
   163     Q_PRIVATE_SLOT(d_func(), void _q_viewReady())
       
   164 
       
   165 };
       
   166 
       
   167 #endif // HBMAINWINDOW_H