ginebra2/ContentToolbarChromeItem.h
changeset 3 0954f5dd2cd0
parent 0 1450b09d0cfd
child 16 3c88a81ff781
--- a/ginebra2/ContentToolbarChromeItem.h	Fri May 14 15:40:36 2010 +0300
+++ b/ginebra2/ContentToolbarChromeItem.h	Tue Jun 29 00:46:29 2010 -0400
@@ -1,25 +1,29 @@
 /*
 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, version 2.1 of the License.
 *
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU Lesser General Public License for more details.
 *
-* Contributors:
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program.  If not,
+* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
 *
-* Description: 
+* Description:
 *
 */
 
-
 #ifndef __GINEBRA_CONTENTTOOLBARCHROMEITEM_H
 #define __GINEBRA_CONTENTTOOLBARCHROMEITEM_H
 
 #include <QtGui>
+#include "Toolbar.h"
 #include "ToolbarChromeItem.h"
 
 class QTimeLine;
@@ -49,77 +53,50 @@
 
     private:
       QTimeLine *m_timeLine;
-      
+
   };
 
   class ContentToolbarChromeItem : public ToolbarChromeItem
   {
     Q_OBJECT
 
-
-
-    enum  ContentToolbarState {
-
-      CONTENT_TOOLBAR_STATE_FULL, 
-      CONTENT_TOOLBAR_STATE_PARTIAL, 
-      CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL, 
-      CONTENT_TOOLBAR_STATE_ANIM_TO_FULL, 
-      CONTENT_TOOLBAR_STATE_INVALID 
-    };
-
-    enum ContentToolbarInactivityTimerState {
-
-      CONTENT_TOOLBAR_INACTIVITY_TIMER_NONE,
-      CONTENT_TOOLBAR_INACTIVITY_TIMER_ALLOWED
-
-    };
-/*
-    typedef void (ContentToolbarChromeItem::*EnterFunctionType)(bool);
-    typedef void (ContentToolbarChromeItem::*ExitFunctionType)();
-
-    struct ContentToolbarState_t {
-    
-      EnterFunctionType enterFunc;
-      ExitFunctionType exitFunc;
-
-    };
-
-*/
     public:
-      ContentToolbarChromeItem(QGraphicsItem* parent = 0);
+      ContentToolbarChromeItem(ChromeSnippet* snippet, QGraphicsItem* parent = 0);
       virtual ~ContentToolbarChromeItem();
       virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* opt, QWidget* widget);
-      virtual void setSnippet(WebChromeContainerSnippet * snippet);
+      virtual void setSnippet(ChromeSnippet * s);
+      void addLinkedChild(ChromeSnippet * s);
+
+      void toggleMiddleSnippet();
+      bool autoHideToolbar() { return  m_autoHideToolbar ;}
 
     protected:
       virtual void resizeEvent(QGraphicsSceneResizeEvent * ev);
-  
-  
+      /// Reimplemented to consume the events
+      virtual void mousePressEvent( QGraphicsSceneMouseEvent * ev );
+      virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent * ev );
+
+
+
     private slots:
-      void onChromeComplete(); 
-      void onLoadStarted(); 
-      void onLoadFinished(bool); 
+      void onChromeComplete();
+      void stopInactivityTimer();
+      void onLoadFinished(bool);
+      void onLoadStarted();
+      void resetTimer();
       void onInactivityTimer();
+      void onSnippetMouseEvent( QEvent::Type type);
+
       void onAnimFinished();
       void onUpdateVisibility(qreal);
-      void onSnippetMouseEvent( QEvent::Type type);
-      void onWebViewMouseEvents( QEvent::Type type);
-      void onSnippetShow();
-      void onSnippetHide();
       void onMVCloseComplete();
 
     private:
-      void handleMousePress();
-      void handleMouseRelease();
       void addFullBackground();
       void changeState( ContentToolbarState state, bool animate = false);
       void onStateEntry(ContentToolbarState state, bool animate);
-      void onStateExit(ContentToolbarState state);
-      void resetInactivityTimer();
       bool mvSnippetVisible();
-
-
-      //void initStates(); 
+      void hideLinkedChildren() ;
 
       // State Enter and Exit functions
       void  stateEnterFull(bool);
@@ -129,15 +106,13 @@
 
       ToolbarFadeAnimator * m_animator;
       QPainterPath* m_background;
-      ChromeSnippet* m_middleSnippet;
       QTimer* m_inactivityTimer;
+      QList <ChromeSnippet *> m_linkedChildren;
       qreal m_bgopacity;
+      qreal m_maxOpacity;
       ContentToolbarState m_state;
-      ContentToolbarInactivityTimerState m_inactiveTimerState;
-    
-      //ContentToolbarState_t m_states[10];
-      
-
+      bool m_autoHideToolbar;
+      ContentToolbarTimerState m_timerState;
   };
 
 } // end of namespace GVA