|
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 #ifndef HBVIEW_H |
|
26 #define HBVIEW_H |
|
27 |
|
28 #include <hbwidget.h> |
|
29 #include <hbglobal.h> |
|
30 #include <hbicon.h> |
|
31 #include <hbnamespace.h> |
|
32 #ifdef HB_EFFECTS |
|
33 #include <hbeffect.h> |
|
34 #endif // HB_EFFECTS |
|
35 |
|
36 class HbMenu; |
|
37 class HbToolBar; |
|
38 class HbViewPrivate; |
|
39 class HbAction; |
|
40 class HbDockWidget; |
|
41 |
|
42 class HB_CORE_EXPORT HbView : public HbWidget |
|
43 { |
|
44 Q_OBJECT |
|
45 Q_ENUMS(HbTitleBarFlag) |
|
46 Q_FLAGS(HbTitleBarFlags) |
|
47 Q_ENUMS(HbViewFlag) |
|
48 Q_FLAGS(HbViewFlags) |
|
49 Q_PROPERTY(QString title READ title WRITE setTitle) |
|
50 Q_PROPERTY(HbIcon icon READ icon WRITE setIcon) |
|
51 Q_PROPERTY(bool contentFullScreen READ isContentFullScreen WRITE setContentFullScreen) |
|
52 Q_PROPERTY(HbTitleBarFlags titleBarFlags READ titleBarFlags WRITE setTitleBarFlags) |
|
53 |
|
54 public: |
|
55 |
|
56 enum HbViewFlag |
|
57 { |
|
58 ViewFlagNone = 0, |
|
59 ViewTitleBarMinimizable = 0x01, |
|
60 ViewTitleBarMinimized = 0x02, |
|
61 ViewTitleBarHidden = 0x04, |
|
62 ViewTitleBarTransparent = 0x08, |
|
63 ViewTitleBarFloating = 0x10, |
|
64 ViewStatusBarHidden = 0x20, |
|
65 ViewStatusBarTransparent = 0x40, |
|
66 ViewStatusBarFloating = 0x80 |
|
67 }; |
|
68 Q_DECLARE_FLAGS(HbViewFlags, HbViewFlag) |
|
69 |
|
70 // Deprecated |
|
71 enum HbTitleBarFlag |
|
72 { |
|
73 TitleBarFlagNone = 0, |
|
74 TitleBarMinimizable = 0x00000001, |
|
75 TitleBarMinimized = 0x00000002, |
|
76 TitleBarHidden = 0x00000004, |
|
77 TitleBarTransparent = 0x00000008, |
|
78 TitleBarFloating = 0x00000010 |
|
79 }; |
|
80 Q_DECLARE_FLAGS(HbTitleBarFlags, HbTitleBarFlag) // Deprecated |
|
81 |
|
82 explicit HbView(QGraphicsItem *parent = 0); |
|
83 virtual ~HbView(); |
|
84 |
|
85 QString title() const; |
|
86 |
|
87 HbIcon icon() const; |
|
88 void setIcon(const HbIcon &icon); |
|
89 |
|
90 HbMenu *menu() const; |
|
91 void setMenu(HbMenu *menu); |
|
92 HbMenu* takeMenu(); |
|
93 |
|
94 HbToolBar *toolBar() const; |
|
95 void setToolBar(HbToolBar *toolBar); |
|
96 HbToolBar* takeToolBar(); |
|
97 |
|
98 HbDockWidget *dockWidget() const; |
|
99 void setDockWidget(HbDockWidget *dockWidget); |
|
100 |
|
101 QGraphicsWidget *widget() const; |
|
102 void setWidget(QGraphicsWidget *widget); |
|
103 QGraphicsWidget *takeWidget(); |
|
104 |
|
105 void showItems(Hb::SceneItems items); |
|
106 void hideItems(Hb::SceneItems items); |
|
107 Hb::SceneItems visibleItems() const; |
|
108 bool isItemVisible(Hb::SceneItem item) const; |
|
109 void setItemVisible(Hb::SceneItem item, bool visible); |
|
110 |
|
111 // Deprecated |
|
112 void unsetVisibleItems(); |
|
113 |
|
114 bool isContentFullScreen() const; |
|
115 HbTitleBarFlags titleBarFlags() const; // Deprecated |
|
116 HbViewFlags viewFlags() const; |
|
117 void setTitleBarVisible(bool visible); |
|
118 void setStatusBarVisible(bool visible); |
|
119 |
|
120 enum { Type = Hb::ItemType_View }; |
|
121 int type() const { return Type; } |
|
122 |
|
123 enum ActionContainer{ |
|
124 NotSpecified, |
|
125 OptionsMenu, |
|
126 ToolBar |
|
127 }; |
|
128 using HbWidget::addAction; |
|
129 void addAction(HbAction *action, ActionContainer preferredActionContainer); |
|
130 |
|
131 HbAction *navigationAction() const; |
|
132 void setNavigationAction(HbAction *action); |
|
133 |
|
134 public slots: |
|
135 void setTitle(const QString &title); |
|
136 void setContentFullScreen(bool enable = true); |
|
137 void setTitleBarFlags(HbTitleBarFlags flags = TitleBarFlagNone); // Deprecated |
|
138 void setViewFlags(HbViewFlags flags = ViewFlagNone); |
|
139 |
|
140 signals: |
|
141 void titleChanged(const QString &title); |
|
142 void iconChanged(const HbIcon &icon); |
|
143 void toolBarChanged(); |
|
144 void visibleItemsChanged(); |
|
145 void contentFullScreenChanged(); |
|
146 void dockWidgetChanged(); |
|
147 |
|
148 protected: |
|
149 HbView( HbViewPrivate &dd, QGraphicsItem *parent ); |
|
150 |
|
151 bool event(QEvent *event); |
|
152 |
|
153 private slots: |
|
154 #ifdef HB_EFFECTS |
|
155 void titleBarEffectFinished(const HbEffect::EffectStatus &status); |
|
156 void statusBarEffectFinished(const HbEffect::EffectStatus &status); |
|
157 #endif // HB_EFFECTS |
|
158 |
|
159 private: |
|
160 Q_DECLARE_PRIVATE_D(d_ptr, HbView) |
|
161 Q_DISABLE_COPY(HbView) |
|
162 }; |
|
163 |
|
164 Q_DECLARE_OPERATORS_FOR_FLAGS(HbView::HbTitleBarFlags) |
|
165 |
|
166 #endif // HBVIEW_H |