1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
|
19 * |
|
20 */ |
|
21 #ifndef QHBSTYLE_P_H |
|
22 #define QHBSTYLE_P_H |
|
23 |
|
24 #include "qhbstyle.h" |
|
25 |
|
26 #ifndef QT_NO_STYLE_HB |
|
27 |
|
28 QT_BEGIN_NAMESPACE |
|
29 |
|
30 class HbStyle; |
|
31 class QParallelAnimationGroup; |
|
32 |
|
33 enum Item { |
|
34 SP_Arrow, |
|
35 SP_BoxButton, |
|
36 SP_CheckBoxIndicator, |
|
37 SP_CurrentFolderIcon, |
|
38 SP_ErasedNoteIcon, |
|
39 SP_ErrorNoteIcon, |
|
40 SP_HeaderOrderIndicator, |
|
41 SP_InfoNoteIcon, |
|
42 SP_ItemDecoration, |
|
43 SP_LargeMemoryCardIcon, |
|
44 SP_MenuIndicator, |
|
45 SP_MenuSeparator, |
|
46 SP_NewSmallFolderIcon, |
|
47 SP_OkNoteIcon, |
|
48 SP_QueryNoteIcon, |
|
49 SP_RadioButtonIndicator, |
|
50 SP_SelectedIndicator, |
|
51 SP_SeparatorLine, |
|
52 SP_SliderHandle, |
|
53 SP_SliderTick, |
|
54 SP_SmallFileIcon, |
|
55 SP_SmallFolderIcon, |
|
56 SP_SubMenuIndicator, |
|
57 SP_TreeViewCollapsed, |
|
58 SP_TreeViewExpanded, |
|
59 SP_WarningNoteIcon, |
|
60 }; |
|
61 |
|
62 enum MultiPartItem { |
|
63 SM_BoxFrame, |
|
64 SM_Dialog, |
|
65 SM_GroupBox, |
|
66 SM_GroupBoxTitle, |
|
67 SM_HeaderItem, |
|
68 SM_ItemViewItem, |
|
69 SM_LineEdit, |
|
70 SM_ListParent, |
|
71 SM_Menu, |
|
72 SM_MenuItem, |
|
73 SM_MenuScroller, |
|
74 SM_Panel, |
|
75 SM_ProgressBarGroove, |
|
76 SM_ProgressBarIndicator, |
|
77 SM_PushButton, |
|
78 SM_ScrollBarGroove, |
|
79 SM_ScrollBarHandle, |
|
80 SM_SliderGroove, |
|
81 SM_SliderProgress, |
|
82 SM_TableItem, |
|
83 SM_TabShape, |
|
84 SM_TextEdit, //todo: or combine this and SM_LineEdit to "SM_TextEditor"? |
|
85 SM_ThemeBackground, |
|
86 SM_ToolBar, |
|
87 SM_ToolBarButton, |
|
88 SM_ToolButton, |
|
89 SM_ToolTip, |
|
90 SM_ToolBarExtension, |
|
91 }; |
|
92 |
|
93 enum ItemState { |
|
94 SS_Active = 0x000001, // "On" |
|
95 SS_Inactive = 0x000002, // "Off" |
|
96 SS_Pressed = 0x000004, |
|
97 SS_Latched = 0x000008, // similar to SS_Pressed, but state remains ("toggled") |
|
98 SS_Disabled = 0x000010, |
|
99 SS_Filled = 0x000020, |
|
100 SS_Horizontal = 0x000040, |
|
101 SS_Vertical = 0x000080, |
|
102 SS_Selected = 0x000100, // item is selected (not necessarily focused) |
|
103 SS_Beginning = 0x000200, // beginning part of multipart item |
|
104 SS_Middle = 0x000400, // middle part of multipart item |
|
105 SS_End = 0x000800, // end part of multipart item |
|
106 SS_Flipped = 0x001000, // 180 degree rotation |
|
107 SS_Mirrored = 0x002000, // graphic is drawn mirrored |
|
108 SS_Down = 0x004000, |
|
109 SS_Up = 0x008000, |
|
110 SS_Left = 0x010000, |
|
111 SS_Right = 0x020000, |
|
112 SS_RotatedRight = 0x040000, |
|
113 SS_RotatedLeft = 0x080000, |
|
114 SS_Edited = 0x100000, |
|
115 SS_Alternate = 0x200000, |
|
116 SS_Focused = 0x400000 // item is focused (not necessarily selected) |
|
117 }; |
|
118 |
|
119 Q_DECLARE_FLAGS(ItemStates, ItemState) |
|
120 |
|
121 class QHbStylePrivate //: public QObjectPrivate |
|
122 { |
|
123 //Q_DECLARE_PUBLIC(QHbStyle) |
|
124 |
|
125 public: |
|
126 QHbStylePrivate(); |
|
127 |
|
128 virtual ~QHbStylePrivate(); |
|
129 |
|
130 //Call HbStyle styleManager to avoid name confusion |
|
131 HbStyle* styleManager(); |
|
132 void setStyleManager(HbStyle* style); |
|
133 |
|
134 QParallelAnimationGroup* animationGroup(); |
|
135 |
|
136 //These return true if drawing was done by the style successfully. |
|
137 bool drawItem(Item part, QPainter *painter, const QRect &rect, ItemStates state = ItemStates(SS_Active | SS_Horizontal), const QColor &color = QColor(QColor::Invalid)); |
|
138 bool drawMultiPartItem(MultiPartItem multiPart, QPainter *painter, const QRect &rect, ItemStates state = ItemStates(SS_Active | SS_Horizontal)); |
|
139 |
|
140 bool isDialog(const QWidget *widget); |
|
141 bool hbParameter(const QString ¶meterName, int &value); |
|
142 void polishFont(QWidget *widget); |
|
143 void polishPalette(QWidget *widget); |
|
144 |
|
145 private: |
|
146 HbStyle *m_styleManager; |
|
147 QScopedPointer<HbFrameDrawer> m_frameDrawer; |
|
148 QScopedPointer<QParallelAnimationGroup> m_animationGroup; |
|
149 }; |
|
150 |
|
151 QT_END_NAMESPACE |
|
152 |
|
153 #endif // QT_NO_STYLE_HB |
|
154 |
|
155 #endif //QHBSTYLE_P_H |
|