|
1 /* |
|
2 * Copyright (c) 2010 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 |
|
19 #include "ContentToolbarChromeItem.h" |
|
20 #include "GWebContentView.h" |
|
21 #include "mostvisitedsnippet.h" |
|
22 |
|
23 #include <QTimeLine> |
|
24 #include <QDebug> |
|
25 |
|
26 #define TOOLBAR_MARGIN 4 |
|
27 #define TOOBAR_ANIMATION_DURATION 200 |
|
28 #define TOOBAR_INACTIVITY_DURATION 5000 |
|
29 |
|
30 namespace GVA { |
|
31 |
|
32 ToolbarFadeAnimator::ToolbarFadeAnimator(): m_timeLine(NULL) |
|
33 { |
|
34 } |
|
35 |
|
36 |
|
37 ToolbarFadeAnimator::~ToolbarFadeAnimator() { |
|
38 |
|
39 if (m_timeLine) |
|
40 delete m_timeLine; |
|
41 } |
|
42 |
|
43 void ToolbarFadeAnimator::start(bool visible) { |
|
44 //qDebug() << __PRETTY_FUNCTION__ << visible; |
|
45 if (!m_timeLine) { |
|
46 m_timeLine = new QTimeLine(TOOBAR_ANIMATION_DURATION); |
|
47 connect(m_timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(valueChange(qreal))); |
|
48 connect(m_timeLine, SIGNAL(finished()), this, SIGNAL(finished())); |
|
49 } |
|
50 else { |
|
51 m_timeLine->stop(); |
|
52 } |
|
53 if (!visible) { |
|
54 m_timeLine->setDirection(QTimeLine::Forward); |
|
55 |
|
56 } |
|
57 else { |
|
58 m_timeLine->setDirection(QTimeLine::Backward); |
|
59 |
|
60 } |
|
61 m_timeLine->start(); |
|
62 |
|
63 } |
|
64 |
|
65 void ToolbarFadeAnimator::stop() { |
|
66 |
|
67 //qDebug() << __PRETTY_FUNCTION__ ; |
|
68 m_timeLine->stop(); |
|
69 } |
|
70 |
|
71 void ToolbarFadeAnimator::valueChange(qreal step) { |
|
72 qreal value = step - 0.25; |
|
73 value = (value > 0)? value: 0.0; |
|
74 emit updateVisibility(value); |
|
75 } |
|
76 |
|
77 ContentToolbarChromeItem::ContentToolbarChromeItem(QGraphicsItem* parent) |
|
78 : ToolbarChromeItem(parent), |
|
79 m_background(NULL), |
|
80 m_middleSnippet(NULL), |
|
81 m_bgopacity(0.75), |
|
82 m_state(CONTENT_TOOLBAR_STATE_FULL), |
|
83 m_inactiveTimerState(CONTENT_TOOLBAR_INACTIVITY_TIMER_NONE) |
|
84 { |
|
85 |
|
86 m_inactivityTimer = new QTimer(this); |
|
87 connect(m_inactivityTimer, SIGNAL(timeout()), this, SLOT(onInactivityTimer())); |
|
88 |
|
89 m_animator = new ToolbarFadeAnimator(); |
|
90 connect(m_animator, SIGNAL(updateVisibility(qreal)), this, SLOT(onUpdateVisibility(qreal))); |
|
91 connect(m_animator, SIGNAL(finished()), this, SLOT(onAnimFinished())); |
|
92 |
|
93 setFlags(QGraphicsItem::ItemDoesntPropagateOpacityToChildren); |
|
94 |
|
95 } |
|
96 |
|
97 ContentToolbarChromeItem::~ContentToolbarChromeItem() |
|
98 { |
|
99 if (m_background ) |
|
100 delete m_background; |
|
101 delete m_inactivityTimer; |
|
102 delete m_animator; |
|
103 |
|
104 } |
|
105 |
|
106 void ContentToolbarChromeItem::resizeEvent(QGraphicsSceneResizeEvent * ev) |
|
107 { |
|
108 //qDebug() << __PRETTY_FUNCTION__ << boundingRect(); |
|
109 ToolbarChromeItem::resizeEvent(ev); |
|
110 addFullBackground(); |
|
111 |
|
112 } |
|
113 |
|
114 void ContentToolbarChromeItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* opt, QWidget* widget) |
|
115 { |
|
116 Q_UNUSED(opt) |
|
117 Q_UNUSED(widget) |
|
118 |
|
119 // qDebug() << __PRETTY_FUNCTION__ << m_state; |
|
120 painter->save(); |
|
121 |
|
122 painter->setRenderHint(QPainter::Antialiasing); |
|
123 |
|
124 painter->setPen(pen()); |
|
125 painter->setOpacity(m_bgopacity); |
|
126 |
|
127 switch (m_state) { |
|
128 case CONTENT_TOOLBAR_STATE_PARTIAL: |
|
129 ToolbarChromeItem::paint(painter, opt, widget); |
|
130 break; |
|
131 case CONTENT_TOOLBAR_STATE_ANIM_TO_FULL: |
|
132 case CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL: |
|
133 ToolbarChromeItem::paint(painter, opt, widget); |
|
134 case CONTENT_TOOLBAR_STATE_FULL: |
|
135 // fill path with color |
|
136 painter->fillPath(*m_background,QBrush(grad())); |
|
137 painter->drawPath(*m_background); |
|
138 break; |
|
139 default: |
|
140 qDebug() << "ContentToolbarChromeItem::paint invalid state" ; |
|
141 break; |
|
142 } |
|
143 // restore painter |
|
144 painter->restore(); |
|
145 |
|
146 } |
|
147 |
|
148 |
|
149 void ContentToolbarChromeItem::setSnippet(WebChromeContainerSnippet* snippet) { |
|
150 |
|
151 //qDebug() << __func__ << snippet; |
|
152 ToolbarChromeItem::setSnippet(snippet); |
|
153 |
|
154 connect(snippet->chrome(), SIGNAL(chromeComplete()), this, SLOT(onChromeComplete())); |
|
155 connect(snippet, SIGNAL(snippetMouseEvent(QEvent::Type)), this, SLOT(onSnippetMouseEvent(QEvent::Type))); |
|
156 |
|
157 } |
|
158 |
|
159 void ContentToolbarChromeItem::onWebViewMouseEvents(QEvent::Type type) { |
|
160 |
|
161 // qDebug() << __PRETTY_FUNCTION__ << type; |
|
162 switch (type ) { |
|
163 case QEvent::GraphicsSceneMousePress: |
|
164 case QEvent::GraphicsSceneMouseDoubleClick: |
|
165 handleMousePress(); |
|
166 break; |
|
167 case QEvent::GraphicsSceneMouseRelease: |
|
168 handleMouseRelease(); |
|
169 break; |
|
170 default: |
|
171 break; |
|
172 |
|
173 } |
|
174 |
|
175 } |
|
176 |
|
177 void ContentToolbarChromeItem::onSnippetMouseEvent( QEvent::Type type) { |
|
178 |
|
179 |
|
180 // qDebug() << __PRETTY_FUNCTION__ << type; |
|
181 // Handle the snippet mouse events when we are in webview |
|
182 if ( getSnippet()->chrome()->currentView() == "webView") { |
|
183 |
|
184 if (type == QEvent::MouseButtonPress || type == QEvent::GraphicsSceneMousePress) { |
|
185 |
|
186 m_inactiveTimerState = CONTENT_TOOLBAR_INACTIVITY_TIMER_NONE; |
|
187 switch (m_state) { |
|
188 case CONTENT_TOOLBAR_STATE_PARTIAL: |
|
189 changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_FULL); |
|
190 break; |
|
191 case CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL: |
|
192 // Stop animation and change to full immediately |
|
193 m_animator->stop(); |
|
194 changeState(CONTENT_TOOLBAR_STATE_FULL, false); |
|
195 break; |
|
196 case CONTENT_TOOLBAR_STATE_ANIM_TO_FULL: |
|
197 // Do nothing here - will reset inactivity timer when |
|
198 // animation completes |
|
199 break; |
|
200 case CONTENT_TOOLBAR_STATE_FULL: |
|
201 resetInactivityTimer(); |
|
202 break; |
|
203 default: |
|
204 break; |
|
205 |
|
206 } |
|
207 } |
|
208 else if ( type == QEvent::MouseButtonRelease || type == QEvent::GraphicsSceneMouseRelease){ |
|
209 m_inactiveTimerState = CONTENT_TOOLBAR_INACTIVITY_TIMER_ALLOWED; |
|
210 if (m_state == CONTENT_TOOLBAR_STATE_FULL ){ |
|
211 resetInactivityTimer(); |
|
212 } |
|
213 } |
|
214 } |
|
215 } |
|
216 |
|
217 void ContentToolbarChromeItem::onChromeComplete() { |
|
218 |
|
219 GWebContentView* webView = static_cast<GWebContentView*> (getSnippet()->chrome()->getView("WebView")); |
|
220 //qDebug() << __PRETTY_FUNCTION__ << webView; |
|
221 if(webView){ |
|
222 connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool))); |
|
223 connect(webView, SIGNAL(loadStarted()), this, SLOT(onLoadStarted())); |
|
224 connect(webView, SIGNAL(contentViewMouseEvent(QEvent::Type)) , this, SLOT(onWebViewMouseEvents(QEvent::Type)) ); |
|
225 } |
|
226 // Get the middle snippet here for now |
|
227 m_middleSnippet = getSnippet()->chrome()->getSnippet("ButtonContainer"); |
|
228 connect(m_middleSnippet, SIGNAL(snippetMouseEvent(QEvent::Type)), this, SLOT(onSnippetMouseEvent(QEvent::Type))); |
|
229 QList <ChromeSnippet *> links = getSnippet()->links(); |
|
230 for (int i=0; i < links.count() ; i++) { |
|
231 |
|
232 connect(links.at(i), SIGNAL(snippetMouseEvent(QEvent::Type)), this, SLOT(onSnippetMouseEvent(QEvent::Type))); |
|
233 |
|
234 } |
|
235 |
|
236 // Connect to shown and hidden signals to reset the inactivity timer |
|
237 connect(getSnippet() , SIGNAL(shown()), this, SLOT(onSnippetHide())); |
|
238 connect(getSnippet() , SIGNAL(hidden()), this, SLOT(onSnippetShow())); |
|
239 } |
|
240 |
|
241 void ContentToolbarChromeItem::onSnippetShow() { |
|
242 |
|
243 // This is signal is received when the snippet is about to be hidden. So stop the timer |
|
244 //qDebug() << __PRETTY_FUNCTION__; |
|
245 if (m_inactivityTimer->isActive() ) |
|
246 m_inactivityTimer->stop(); |
|
247 } |
|
248 |
|
249 void ContentToolbarChromeItem::onSnippetHide() { |
|
250 |
|
251 //qDebug() << __PRETTY_FUNCTION__; |
|
252 changeState(CONTENT_TOOLBAR_STATE_FULL, false); |
|
253 } |
|
254 |
|
255 void ContentToolbarChromeItem::onMVCloseComplete() { |
|
256 |
|
257 // qDebug() << __PRETTY_FUNCTION__; |
|
258 ChromeSnippet * mv = getSnippet()->chrome()->getSnippet("MostVisitedViewId"); |
|
259 disconnect(mv, SIGNAL(mostVisitedSnippetCloseComplete()) , this, SLOT(onMVCloseComplete())); |
|
260 // MostVisitedSnippet animation complete, so let's do toolbar animation |
|
261 if (m_state == CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL) |
|
262 changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL, true); |
|
263 |
|
264 } |
|
265 |
|
266 void ContentToolbarChromeItem::onLoadFinished(bool ok) { |
|
267 |
|
268 Q_UNUSED(ok); |
|
269 //qDebug() << __PRETTY_FUNCTION__ << m_state; |
|
270 |
|
271 // We should be in STATE_FULL when load completes as we would have |
|
272 // changed to that state on starting a load |
|
273 //assert(m_state == CONTENT_TOOLBAR_STATE_FULL) |
|
274 m_inactiveTimerState = CONTENT_TOOLBAR_INACTIVITY_TIMER_ALLOWED; |
|
275 resetInactivityTimer(); |
|
276 |
|
277 } |
|
278 |
|
279 void ContentToolbarChromeItem::onLoadStarted() { |
|
280 |
|
281 //qDebug() << __PRETTY_FUNCTION__<< m_state; ; |
|
282 m_inactiveTimerState = CONTENT_TOOLBAR_INACTIVITY_TIMER_NONE; |
|
283 |
|
284 switch (m_state) { |
|
285 case CONTENT_TOOLBAR_STATE_PARTIAL: |
|
286 changeState(CONTENT_TOOLBAR_STATE_FULL, false); |
|
287 break; |
|
288 case CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL: |
|
289 case CONTENT_TOOLBAR_STATE_ANIM_TO_FULL: |
|
290 // Stop animation and change to full immediately |
|
291 m_animator->stop(); |
|
292 changeState(CONTENT_TOOLBAR_STATE_FULL, false); |
|
293 break; |
|
294 case CONTENT_TOOLBAR_STATE_FULL: |
|
295 resetInactivityTimer(); |
|
296 break; |
|
297 default: |
|
298 break; |
|
299 |
|
300 } |
|
301 //qDebug() << __PRETTY_FUNCTION__<< m_state; ; |
|
302 |
|
303 } |
|
304 |
|
305 void ContentToolbarChromeItem::onInactivityTimer() { |
|
306 |
|
307 //assert(m_state == CONTENT_TOOLBAR_STATE_PARTIAL); |
|
308 //qDebug() << __PRETTY_FUNCTION__ << m_state; |
|
309 if (mvSnippetVisible()) { |
|
310 changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL); |
|
311 |
|
312 } |
|
313 else { |
|
314 changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL, true); |
|
315 } |
|
316 } |
|
317 |
|
318 void ContentToolbarChromeItem::onUpdateVisibility(qreal step) { |
|
319 |
|
320 qreal value = 0.76 - step; |
|
321 //qDebug() << __PRETTY_FUNCTION__ << step << value << m_bgopacity << opacity(); |
|
322 if (m_bgopacity != step ) { |
|
323 m_bgopacity = step; |
|
324 getSnippet()->setOpacity(value); |
|
325 m_middleSnippet->widget()->setOpacity(step); |
|
326 update(); |
|
327 } |
|
328 } |
|
329 |
|
330 void ContentToolbarChromeItem::onAnimFinished() { |
|
331 |
|
332 //qDebug() << __PRETTY_FUNCTION__ << m_state; |
|
333 switch (m_state) { |
|
334 case CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL: |
|
335 changeState(CONTENT_TOOLBAR_STATE_PARTIAL); |
|
336 break; |
|
337 case CONTENT_TOOLBAR_STATE_ANIM_TO_FULL: |
|
338 changeState(CONTENT_TOOLBAR_STATE_FULL, true); |
|
339 break; |
|
340 default: |
|
341 break; |
|
342 |
|
343 } |
|
344 //qDebug() << __PRETTY_FUNCTION__ << m_state; |
|
345 |
|
346 } |
|
347 void ContentToolbarChromeItem::addFullBackground() { |
|
348 |
|
349 //qDebug() << __PRETTY_FUNCTION__ ; |
|
350 qreal roundness((boundingRect().height() -TOOLBAR_MARGIN)/2); |
|
351 QRectF r(1, 1, boundingRect().width()-TOOLBAR_MARGIN, boundingRect().height()-TOOLBAR_MARGIN); |
|
352 |
|
353 if (m_background ) { |
|
354 delete m_background; |
|
355 m_background = NULL; |
|
356 } |
|
357 m_background = new QPainterPath(); |
|
358 m_background->addRoundedRect(r, roundness, roundness); |
|
359 } |
|
360 |
|
361 void ContentToolbarChromeItem::resetInactivityTimer() { |
|
362 |
|
363 // qDebug() << __PRETTY_FUNCTION__ << m_inactiveTimerState; |
|
364 if (m_inactivityTimer->isActive() ) |
|
365 m_inactivityTimer->stop(); |
|
366 if (m_inactiveTimerState == CONTENT_TOOLBAR_INACTIVITY_TIMER_ALLOWED ) { |
|
367 m_inactivityTimer->start(TOOBAR_INACTIVITY_DURATION); |
|
368 } |
|
369 } |
|
370 |
|
371 void ContentToolbarChromeItem::stateEnterFull(bool animate) { |
|
372 |
|
373 //qDebug() <<__PRETTY_FUNCTION__ ; |
|
374 |
|
375 resetInactivityTimer(); |
|
376 // Show the middle snippet and reset the opacity if we are here directly with no aniamtion |
|
377 if (!animate) { |
|
378 m_bgopacity = 0.75; |
|
379 m_middleSnippet->show(); |
|
380 } |
|
381 |
|
382 m_state = CONTENT_TOOLBAR_STATE_FULL; |
|
383 m_middleSnippet->widget()->setOpacity(1.0); |
|
384 // TODO: specify the rect to be updated to avoid full repaint |
|
385 update(); |
|
386 } |
|
387 |
|
388 void ContentToolbarChromeItem::stateEnterPartial(bool animate) { |
|
389 |
|
390 //qDebug() <<__PRETTY_FUNCTION__ ; |
|
391 Q_UNUSED(animate); |
|
392 |
|
393 // Explicity hide the linked snippets so that toggle button javascript gets the right |
|
394 // signals that it is expecting |
|
395 QList <ChromeSnippet *> links = getSnippet()->links(); |
|
396 for (int i=0; i < links.count() ; i++) { |
|
397 //qDebug() << __PRETTY_FUNCTION__ << links.at(i)->elementId(); |
|
398 links.at(i)->hide(); |
|
399 } |
|
400 |
|
401 m_middleSnippet->hide(); |
|
402 m_state = CONTENT_TOOLBAR_STATE_PARTIAL; |
|
403 |
|
404 } |
|
405 |
|
406 void ContentToolbarChromeItem::stateEnterAnimToFull(bool animate) { |
|
407 |
|
408 //qDebug() <<__PRETTY_FUNCTION__ ; |
|
409 Q_UNUSED(animate); |
|
410 m_state = CONTENT_TOOLBAR_STATE_ANIM_TO_FULL; |
|
411 m_inactivityTimer->stop(); |
|
412 m_middleSnippet->show(); |
|
413 m_animator->start(false); |
|
414 |
|
415 } |
|
416 |
|
417 void ContentToolbarChromeItem::stateEnterAnimToPartial(bool animate) { |
|
418 |
|
419 //qDebug() <<__PRETTY_FUNCTION__ << animate ; |
|
420 m_inactivityTimer->stop(); |
|
421 m_state = CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL; |
|
422 |
|
423 if (animate ) { |
|
424 m_animator->start(true); |
|
425 } |
|
426 else { |
|
427 |
|
428 MostVisitedSnippet * mv = static_cast<MostVisitedSnippet *>(getSnippet()->chrome()->getSnippet("MostVisitedViewId")); |
|
429 connect(mv, SIGNAL(mostVisitedSnippetCloseComplete()) , this, SLOT(onMVCloseComplete())); |
|
430 mv->close(); |
|
431 } |
|
432 |
|
433 } |
|
434 |
|
435 void ContentToolbarChromeItem::changeState( ContentToolbarState state, bool animate){ |
|
436 |
|
437 onStateEntry(state, animate); |
|
438 } |
|
439 |
|
440 void ContentToolbarChromeItem::onStateEntry(ContentToolbarState state, bool animate){ |
|
441 |
|
442 //qDebug() << __PRETTY_FUNCTION__ ; |
|
443 switch (state) { |
|
444 case CONTENT_TOOLBAR_STATE_PARTIAL: |
|
445 stateEnterPartial(animate); |
|
446 break; |
|
447 case CONTENT_TOOLBAR_STATE_ANIM_TO_FULL: |
|
448 stateEnterAnimToFull(animate); |
|
449 break; |
|
450 case CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL: |
|
451 stateEnterAnimToPartial(animate); |
|
452 break; |
|
453 case CONTENT_TOOLBAR_STATE_FULL: |
|
454 stateEnterFull(animate); |
|
455 break; |
|
456 default: |
|
457 qDebug() << "ContentToolbarChromeItem::onStateEntry - invalid state" ; |
|
458 break; |
|
459 } |
|
460 } |
|
461 |
|
462 void ContentToolbarChromeItem::onStateExit(ContentToolbarState state){ |
|
463 |
|
464 //qDebug() << __PRETTY_FUNCTION__ ; |
|
465 switch (state) { |
|
466 case CONTENT_TOOLBAR_STATE_PARTIAL: |
|
467 break; |
|
468 case CONTENT_TOOLBAR_STATE_ANIM_TO_FULL: |
|
469 break; |
|
470 case CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL: |
|
471 break; |
|
472 case CONTENT_TOOLBAR_STATE_FULL: |
|
473 break; |
|
474 default: |
|
475 qDebug() << "ContentToolbarChromeItem::onStateExit - invalid state" ; |
|
476 break; |
|
477 } |
|
478 } |
|
479 |
|
480 void ContentToolbarChromeItem::handleMousePress() { |
|
481 |
|
482 // qDebug() << __PRETTY_FUNCTION__ << m_state; |
|
483 m_inactiveTimerState = CONTENT_TOOLBAR_INACTIVITY_TIMER_NONE; |
|
484 switch (m_state) { |
|
485 case CONTENT_TOOLBAR_STATE_PARTIAL: |
|
486 changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_FULL); |
|
487 break; |
|
488 case CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL: |
|
489 // Stop animation and change to full immediately |
|
490 m_animator->stop(); |
|
491 changeState(CONTENT_TOOLBAR_STATE_FULL, false); |
|
492 break; |
|
493 case CONTENT_TOOLBAR_STATE_ANIM_TO_FULL: |
|
494 // Do nothing here - will reset inactivity timer when |
|
495 // animation completes based on timer state then |
|
496 break; |
|
497 case CONTENT_TOOLBAR_STATE_FULL: |
|
498 resetInactivityTimer(); |
|
499 break; |
|
500 default: |
|
501 qDebug() << "ContentToolbarChromeItem::handleMousePress invalid state" ; |
|
502 break; |
|
503 |
|
504 } |
|
505 |
|
506 |
|
507 } |
|
508 |
|
509 void ContentToolbarChromeItem::handleMouseRelease() { |
|
510 |
|
511 // qDebug() << __PRETTY_FUNCTION__ << m_state; |
|
512 /* If in STATE_FULL, restart inactivity timer. In other states: |
|
513 * STATE_PARTIAL, STATE_ANIM_TO_PARTIAL - not possible |
|
514 * STATE_ANIM_TO_FULL - timer will be restarted on animation completion |
|
515 */ |
|
516 |
|
517 m_inactiveTimerState = CONTENT_TOOLBAR_INACTIVITY_TIMER_ALLOWED; |
|
518 if (m_state == CONTENT_TOOLBAR_STATE_FULL ){ |
|
519 resetInactivityTimer(); |
|
520 } |
|
521 } |
|
522 |
|
523 bool ContentToolbarChromeItem::mvSnippetVisible() { |
|
524 |
|
525 ChromeSnippet * mv = getSnippet()->chrome()->getSnippet("MostVisitedViewId"); |
|
526 bool result = false; |
|
527 |
|
528 if (mv && mv->isVisible() ) { |
|
529 result = true; |
|
530 } |
|
531 return result; |
|
532 } |
|
533 |
|
534 /* |
|
535 //Not using this method now - potential performance hit |
|
536 void ContentToolbarChromeItem::changeState( ContentToolbarState state, bool animate){ |
|
537 |
|
538 if ( m_states[m_state].exitFunc ) { |
|
539 |
|
540 (*this.*(m_states[m_state].exitFunc))(); |
|
541 } |
|
542 if ( m_states[state].enterFunc ) { |
|
543 (*this.*(m_states[state].enterFunc))(animate); |
|
544 |
|
545 } |
|
546 |
|
547 } |
|
548 |
|
549 void ContentToolbarChromeItem::initStates() { |
|
550 |
|
551 |
|
552 m_states[CONTENT_TOOLBAR_STATE_FULL].enterFunc = &ContentToolbarChromeItem::stateEnterFull; |
|
553 m_states[CONTENT_TOOLBAR_STATE_FULL].exitFunc = NULL; |
|
554 |
|
555 m_states[CONTENT_TOOLBAR_STATE_PARTIAL].enterFunc = &ContentToolbarChromeItem::stateEnterpartial; |
|
556 m_states[CONTENT_TOOLBAR_STATE_PARTIAL].exitFunc = NULL; |
|
557 |
|
558 m_states[CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL].enterFunc = &ContentToolbarChromeItem::stateEnterAnimToPartial; |
|
559 m_states[CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL].exitFunc = NULL; |
|
560 |
|
561 m_states[CONTENT_TOOLBAR_STATE_ANIM_TO_FULL].enterFunc = &ContentToolbarChromeItem::stateEnterAnimToFull; |
|
562 m_states[CONTENT_TOOLBAR_STATE_ANIM_TO_FULL].exitFunc = NULL; |
|
563 } |
|
564 */ |
|
565 } // end of namespace GVA |
|
566 |
|
567 |