videoplayback/hbvideoplaybackview/tsrc/testdetailsplaybackwindow/stub/src/hbpushbutton.cpp
changeset 36 8aed59de29f9
child 20 b9e04db066d4
equal deleted inserted replaced
35:3738fe97f027 36:8aed59de29f9
       
     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:  Implementation of HbPushButton
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version:  3 %
       
    19 
       
    20 #include <qgraphicswidget>
       
    21 
       
    22 #include "mpxvideo_debug.h"
       
    23 #include "hbpushbutton.h"
       
    24 
       
    25 // -------------------------------------------------------------------------------------------------
       
    26 // HbPushButton::HbPushButton
       
    27 // -------------------------------------------------------------------------------------------------
       
    28 //
       
    29 HbPushButton::HbPushButton()
       
    30     : mVisible( false )
       
    31     , mEnabled( false )
       
    32     , mSelected( false )
       
    33 {
       
    34     MPX_ENTER_EXIT(_L("HbPushButton::HbPushButton()"));
       
    35 
       
    36     mBackground = new QGraphicsWidget();
       
    37 }
       
    38 
       
    39 // -------------------------------------------------------------------------------------------------
       
    40 // HbPushButton::~HbPushButton
       
    41 // -------------------------------------------------------------------------------------------------
       
    42 //
       
    43 HbPushButton::~HbPushButton()
       
    44 {
       
    45     MPX_DEBUG(_L("HbPushButton::HbPushButton") );
       
    46 
       
    47     if ( mBackground )
       
    48     {
       
    49         delete mBackground;
       
    50         mBackground = NULL;
       
    51     }
       
    52 }
       
    53 
       
    54 // -------------------------------------------------------------------------------------------------
       
    55 // HbPushButton::setEnabled
       
    56 // -------------------------------------------------------------------------------------------------
       
    57 //
       
    58 void HbPushButton::setEnabled( bool enabled )
       
    59 {
       
    60     MPX_DEBUG(_L("HbPushButton::setEnabled %d"), enabled );
       
    61 
       
    62     mEnabled = enabled;
       
    63 }
       
    64 
       
    65 // -------------------------------------------------------------------------------------------------
       
    66 // HbPushButton::isEnabled
       
    67 // -------------------------------------------------------------------------------------------------
       
    68 //
       
    69 bool HbPushButton::isEnabled()
       
    70 {
       
    71     MPX_DEBUG(_L("HbPushButton::isEnabled %d"), mEnabled );
       
    72 
       
    73     return mEnabled;
       
    74 }
       
    75 
       
    76 // -------------------------------------------------------------------------------------------------
       
    77 // HbPushButton::setVisible
       
    78 // -------------------------------------------------------------------------------------------------
       
    79 //
       
    80 void HbPushButton::setVisible( bool visible )
       
    81 {
       
    82     MPX_DEBUG(_L("HbPushButton::setVisible %d"), visible );
       
    83 
       
    84     mVisible = visible;
       
    85 }
       
    86 
       
    87 // -------------------------------------------------------------------------------------------------
       
    88 // HbPushButton::isVisible
       
    89 // -------------------------------------------------------------------------------------------------
       
    90 //
       
    91 bool HbPushButton::isVisible()
       
    92 {
       
    93     MPX_DEBUG(_L("HbPushButton::isVisible %d"), mVisible );
       
    94 
       
    95     return mVisible;
       
    96 }
       
    97 
       
    98 // -------------------------------------------------------------------------------------------------
       
    99 // HbPushButton::setSelected
       
   100 // -------------------------------------------------------------------------------------------------
       
   101 //
       
   102 void HbPushButton::setSelected( bool selected )
       
   103 {
       
   104     MPX_DEBUG(_L("HbPushButton::setSelected %d"), selected );
       
   105 
       
   106     mSelected = selected;
       
   107 }
       
   108 
       
   109 // -------------------------------------------------------------------------------------------------
       
   110 // HbPushButton::isSelected
       
   111 // -------------------------------------------------------------------------------------------------
       
   112 //
       
   113 bool HbPushButton::isSelected()
       
   114 {
       
   115     MPX_DEBUG(_L("HbPushButton::isSelected %d"), mSelected );
       
   116 
       
   117     return mSelected;
       
   118 }
       
   119 
       
   120 // -------------------------------------------------------------------------------------------------
       
   121 // HbPushButton::primitive
       
   122 // -------------------------------------------------------------------------------------------------
       
   123 //
       
   124 QGraphicsItem* HbPushButton::primitive( HbStyle::Primitive primitive ) const
       
   125 {
       
   126     MPX_DEBUG(_L("HbPushButton::primitive") );
       
   127 
       
   128     Q_UNUSED( primitive );
       
   129     return mBackground;
       
   130 }
       
   131 
       
   132 // -------------------------------------------------------------------------------------------------
       
   133 // HbPushButton::press
       
   134 // -------------------------------------------------------------------------------------------------
       
   135 //
       
   136 void HbPushButton::press()
       
   137 {
       
   138     MPX_DEBUG(_L("HbPushButton::press") );
       
   139 
       
   140     emit pressed();
       
   141 }
       
   142 
       
   143 // -------------------------------------------------------------------------------------------------
       
   144 // HbPushButton::release
       
   145 // -------------------------------------------------------------------------------------------------
       
   146 //
       
   147 void HbPushButton::release()
       
   148 {
       
   149     MPX_DEBUG(_L("HbPushButton::release") );
       
   150 
       
   151     emit released();
       
   152 }
       
   153 
       
   154 // End of file