ginebra2/ActionButtonSnippet.h
changeset 3 0954f5dd2cd0
parent 0 1450b09d0cfd
child 16 3c88a81ff781
equal deleted inserted replaced
1:b0dd75e285d2 3:0954f5dd2cd0
     1 /*
     1 /*
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     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 *
     4 *
     9 * Initial Contributors:
     5 * This program is free software: you can redistribute it and/or modify
    10 * Nokia Corporation - initial contribution.
     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.
    11 *
     8 *
    12 * Contributors:
     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 *
    13 *
    14 * Description: 
    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:
    15 *
    19 *
    16 */
    20 */
    17 
       
    18 
    21 
    19 #ifndef __gva_actionbuttonsnippet_h__
    22 #ifndef __gva_actionbuttonsnippet_h__
    20 #define __gva_actionbuttonsnippet_h__
    23 #define __gva_actionbuttonsnippet_h__
    21 
    24 
    22 #include "ChromeSnippet.h"
    25 #include "ChromeSnippet.h"
    24 #include "ActionButton.h"
    27 #include "ActionButton.h"
    25 
    28 
    26 namespace GVA {
    29 namespace GVA {
    27 
    30 
    28 
    31 
       
    32 
    29   class ActionButtonSnippet : public ChromeSnippet
    33   class ActionButtonSnippet : public ChromeSnippet
    30   {
    34   {
    31     Q_OBJECT
    35     Q_OBJECT
    32     public:
    36     public:
    33        ActionButtonSnippet(const QString & elementId, ChromeWidget * chrome, QGraphicsWidget * widget, const QWebElement & element);
    37        ActionButtonSnippet(const QString & elementId, ChromeWidget * chrome, QGraphicsWidget * widget, const QWebElement & element);
    34        virtual ~ActionButtonSnippet() {;}
    38        virtual ~ActionButtonSnippet() {;}
       
    39        static ActionButtonSnippet * instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element);
       
    40        QAction * getDefaultAction();
       
    41        void setDefaultAction( QAction * action, bool triggerOnDown =false, bool triggerOnUp=true);
       
    42        QIcon icon();
       
    43        bool isChecked();
       
    44        void setActive( bool active );
       
    45        void setActiveOnPress( bool );
    35 
    46 
    36     public slots:
    47     public slots:
    37        void setIcon( const QString & icon );
    48        void setIcon( const QString & icon );
    38        void setDisabledIcon( const QString & icon );
    49        void setDisabledIcon( const QString & icon );
    39        void setSelectedIcon( const QString & icon );
       
    40        void setActiveIcon( const QString & icon );
    50        void setActiveIcon( const QString & icon );
    41        void connectAction ( const QString & action, const QString & view, const QString & inputEvent = "Down" );
    51        void connectAction( const QString & action, const QString & view, bool onDown = false, bool onUp = true);
       
    52 
    42        void setEnabled( bool enabled );
    53        void setEnabled( bool enabled );
    43        void setLatched( bool latched );
    54        void updateButtonState(bool state);
    44        void setInputEvent( const QString & inputEvent );
    55 
    45     signals:
       
    46        void activated();
       
    47        void contextMenuEvent();
       
    48   };
    56   };
    49 }
    57 }
    50 
    58 
    51 #endif // ICONSNIPPET_H
    59 #endif // ACTIONBUTTONSNIPPET_H