|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef INFOWIDGETLAYOUTMANAGER_H |
|
19 #define INFOWIDGETLAYOUTMANAGER_H |
|
20 |
|
21 #include <QObject> |
|
22 #include <QList> |
|
23 #include <QSizeF> |
|
24 #include <QRectF> |
|
25 #include <QMap> |
|
26 #include <hbdocumentloader.h> |
|
27 |
|
28 class QGraphicsLayout; |
|
29 class QGraphicsWidget; |
|
30 class HbLabel; |
|
31 class HbIconItem; |
|
32 class HbPushButton; |
|
33 class HbMarqueeItem; |
|
34 class HbCheckBox; |
|
35 |
|
36 /*! |
|
37 */ |
|
38 class InfoWidgetDocumentLoader : public HbDocumentLoader |
|
39 { |
|
40 public: |
|
41 InfoWidgetDocumentLoader(); |
|
42 virtual QObject *createObject(const QString& type, |
|
43 const QString &name); |
|
44 }; |
|
45 |
|
46 class InfoWidgetLayoutManager : public QObject |
|
47 { |
|
48 Q_OBJECT |
|
49 |
|
50 public: |
|
51 |
|
52 enum LayoutItemRole { |
|
53 RoleUndefined = 0, |
|
54 // Content widget, the main widget from document |
|
55 RoleContent, |
|
56 // Marquee items |
|
57 RoleMcnMarqueeItem, |
|
58 // Labels |
|
59 RoleHomeZoneLabel, |
|
60 RoleMcnLabel, |
|
61 RoleActiveLineLabel, |
|
62 RoleSatTextLabel, |
|
63 // Icons |
|
64 RoleHomeZoneIcon, |
|
65 RoleMcnIcon, |
|
66 RoleActiveLineIcon, |
|
67 RoleSatTextIcon, |
|
68 // Check boxes |
|
69 RoleHomeZoneCheckBox, |
|
70 RoleMcnCheckBox, |
|
71 RoleActiveLineCheckBox, |
|
72 RoleSatTextCheckBox, |
|
73 // Buttons |
|
74 RoleOkButton, |
|
75 // Layout containers |
|
76 RoleContainer, |
|
77 RoleSettingsContainer, |
|
78 // Must be the last enumeration |
|
79 RoleLastEnum |
|
80 }; |
|
81 |
|
82 enum DisplayRole { |
|
83 InfoDisplay, |
|
84 SettingsDisplay |
|
85 }; |
|
86 |
|
87 InfoWidgetLayoutManager(QObject *parent = 0); |
|
88 ~InfoWidgetLayoutManager(); |
|
89 |
|
90 DisplayRole currentDisplayRole(); |
|
91 QList<LayoutItemRole> currentWidgetRoles(); |
|
92 |
|
93 int layoutRows() const; |
|
94 void setLayoutRows(int rows); |
|
95 |
|
96 QGraphicsLayout* layoutInfoDisplay(); |
|
97 QGraphicsLayout* layoutSettingsDisplay(); |
|
98 |
|
99 const QList<InfoWidgetLayoutManager::LayoutItemRole> widgetRoles( |
|
100 DisplayRole displayRole) const; |
|
101 |
|
102 bool loadWidgets(const DisplayRole displayRole, |
|
103 const QList<LayoutItemRole> &displayWidgets, |
|
104 QMap<LayoutItemRole, QGraphicsWidget *> &widgetMap); |
|
105 |
|
106 QGraphicsWidget* loadWidget(InfoWidgetDocumentLoader &loader, |
|
107 DisplayRole displayRole, |
|
108 LayoutItemRole widgetRole); |
|
109 |
|
110 QGraphicsWidget* getWidget(LayoutItemRole itemRole); |
|
111 QGraphicsWidget* contentWidget(); |
|
112 |
|
113 void hideWidget(LayoutItemRole itemRole); |
|
114 void hideAll(); |
|
115 void showAll(); |
|
116 |
|
117 private: |
|
118 QMap<LayoutItemRole, QGraphicsWidget *> m_widgets; |
|
119 QMap<LayoutItemRole, QGraphicsWidget *> m_infoDisplayWidgets; |
|
120 QMap<LayoutItemRole, QGraphicsWidget *> m_settingsDisplayWidgets; |
|
121 |
|
122 InfoWidgetDocumentLoader *m_documentLoader; |
|
123 DisplayRole m_displayRole; |
|
124 int m_layoutRows; |
|
125 |
|
126 }; |
|
127 |
|
128 |
|
129 #endif // INFOWIDGETLAYOUTMANAGER_H |
|
130 |