33 #include "hbiconimpl_p.h" |
33 #include "hbiconimpl_p.h" |
34 |
34 |
35 class HB_AUTOTEST_EXPORT HbMaskableIconImpl |
35 class HB_AUTOTEST_EXPORT HbMaskableIconImpl |
36 { |
36 { |
37 public: |
37 public: |
38 HbMaskableIconImpl(HbIconImpl * icon) |
38 HbMaskableIconImpl(HbIconImpl *icon) { |
39 { |
39 this->icon = icon; |
40 this->icon = icon; |
40 data = 0; |
41 data = 0; |
41 maskApplied = false; |
42 maskApplied = false; |
|
43 } |
42 } |
44 |
43 |
45 QPixmap pixmap() |
44 QPixmap pixmap() { |
46 { |
|
47 return icon->pixmap(); |
45 return icon->pixmap(); |
48 } |
46 } |
49 |
47 |
50 void paint(QPainter* painter, const QRectF &childRect, |
48 void paint(QPainter *painter, const QRectF &childRect, |
51 Qt::Alignment alignment, |
49 Qt::Alignment alignment, |
52 const QPainterPath &clipPath = QPainterPath()) |
50 const QPainterPath &clipPath = QPainterPath()) { |
53 { |
|
54 icon->paint(painter, childRect, alignment, clipPath, this); |
51 icon->paint(painter, childRect, alignment, clipPath, this); |
55 maskApplied = false; |
52 maskApplied = false; |
56 } |
53 } |
57 |
54 |
58 HbIconImpl * iconImpl() |
55 HbIconImpl *iconImpl() { |
59 { |
|
60 return icon; |
56 return icon; |
61 } |
57 } |
62 |
58 |
63 bool maskChanged() |
59 bool maskChanged() { |
64 { |
|
65 return maskApplied; |
60 return maskApplied; |
66 } |
61 } |
67 |
62 |
68 void setPixmap(QPixmap pixmap) |
63 void setPixmap(QPixmap pixmap) { |
69 { |
64 maskBitmap = pixmap; |
70 maskBitmap = pixmap; |
|
71 } |
65 } |
72 |
66 |
73 QSize defaultSize() const |
67 QSize defaultSize() const { |
74 { |
|
75 return icon->defaultSize(); |
68 return icon->defaultSize(); |
76 } |
69 } |
77 |
70 |
78 void setMask(const QBitmap& mask) |
71 void setMask(const QBitmap &mask) { |
79 { |
72 if (!mask.isNull()) { |
80 if(!mask.isNull()) { |
|
81 maskBitmap = mask; |
73 maskBitmap = mask; |
82 maskApplied = true; |
74 maskApplied = true; |
83 } |
75 } |
84 } |
76 } |
85 |
77 |
86 QBitmap mask() |
78 QBitmap mask() { |
87 { |
|
88 return maskBitmap; |
79 return maskBitmap; |
89 } |
80 } |
90 |
81 |
91 QSize size() |
82 QSize size() { |
92 { |
|
93 return icon->size(); |
83 return icon->size(); |
94 } |
84 } |
95 |
85 |
96 void setColor(const QColor &color) |
86 void setColor(const QColor &color) { |
97 { |
87 icon->setColor(color); |
98 icon->setColor(color); |
|
99 } |
88 } |
100 |
89 |
101 QColor color() |
90 QColor color() { |
102 { |
|
103 return icon->color(); |
91 return icon->color(); |
104 } |
92 } |
105 |
93 |
106 HbSharedIconInfo iconData() const |
94 HbSharedIconInfo iconData() const { |
107 { |
|
108 return icon->iconData(); |
95 return icon->iconData(); |
109 } |
96 } |
110 |
97 |
111 QString iconFileName() const |
98 QString iconFileName() const { |
112 { |
|
113 return icon->iconFileName(); |
99 return icon->iconFileName(); |
114 } |
100 } |
115 |
101 |
116 QSizeF keySize() const |
102 QSizeF keySize() const { |
117 { |
|
118 return icon->keySize(); |
103 return icon->keySize(); |
119 } |
104 } |
120 |
105 |
121 Qt::AspectRatioMode iconAspectRatioMode() const |
106 Qt::AspectRatioMode iconAspectRatioMode() const { |
122 { |
|
123 return icon->iconAspectRatioMode(); |
107 return icon->iconAspectRatioMode(); |
124 } |
108 } |
125 |
109 |
126 QIcon::Mode iconMode() const |
110 QIcon::Mode iconMode() const { |
127 { |
|
128 return icon->iconMode(); |
111 return icon->iconMode(); |
129 } |
112 } |
130 |
113 |
131 bool isMirrored() const |
114 bool isMirrored() const { |
132 { |
|
133 return icon->isMirrored(); |
115 return icon->isMirrored(); |
134 } |
116 } |
135 |
117 |
136 bool isCreatedOnServer() const |
118 bool isCreatedOnServer() const { |
137 { |
|
138 return icon->isCreatedOnServer(); |
119 return icon->isCreatedOnServer(); |
139 } |
120 } |
140 |
121 |
141 void incrementRefCount() |
122 void incrementRefCount() { |
142 { |
|
143 icon->incrementRefCount(); |
123 icon->incrementRefCount(); |
144 } |
124 } |
145 |
125 |
146 uint refCount() |
126 uint refCount() { |
147 { |
|
148 return icon->refCount(); |
127 return icon->refCount(); |
149 } |
128 } |
150 |
129 |
151 void decrementRefCount() |
130 void decrementRefCount() { |
152 { |
|
153 icon->decrementRefCount(); |
131 icon->decrementRefCount(); |
154 } |
132 } |
155 |
133 |
156 void dispose() |
134 void dispose() { |
157 { |
|
158 icon->destroyMaskedData(data); |
135 icon->destroyMaskedData(data); |
159 icon->dispose(); |
136 icon->dispose(); |
160 delete this; |
137 delete this; |
161 } |
138 } |
162 |
139 |
163 void setImplData(HbIconMaskedData *data) |
140 void setImplData(HbIconMaskedData *data) { |
164 { |
|
165 this->data = data; |
141 this->data = data; |
166 } |
142 } |
167 |
143 |
168 HbIconMaskedData * implData() const |
144 HbIconMaskedData *implData() const { |
169 { |
|
170 return data; |
145 return data; |
171 } |
146 } |
172 |
147 |
173 private: |
148 private: |
174 ~HbMaskableIconImpl() |
149 ~HbMaskableIconImpl() { |
175 { |
|
176 } |
150 } |
177 |
151 |
178 HbIconImpl *icon; |
152 HbIconImpl *icon; |
179 HbIconMaskedData *data; |
153 HbIconMaskedData *data; |
180 QBitmap maskBitmap; |
154 QBitmap maskBitmap; |