telutils/dialpad/src/dialpadbutton.cpp
changeset 19 e44a8c097b15
parent 15 d7fc66ccd6fb
child 27 7eb70891911c
equal deleted inserted replaced
15:d7fc66ccd6fb 19:e44a8c097b15
    13 *
    13 *
    14 * Description: Custom button
    14 * Description: Custom button
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include <hbtextitem.h>
    18 
    19 #include <hbiconitem.h>
       
    20 #include <hbstyle.h>
       
    21 #include <hbcolorscheme.h>
       
    22 #include <hbevent.h>
    19 #include <hbevent.h>
       
    20 #include <hbframeitem.h>
    23 
    21 
    24 #include "dialpadbutton.h"
    22 #include "dialpadbutton.h"
    25 
    23 
    26 DialpadButton::DialpadButton(QGraphicsItem *parent)
    24 DialpadButton::DialpadButton(QGraphicsItem *parent)
    27     : HbPushButton(parent), mButtonType(NumericButton)
    25     : HbPushButton(parent), mButtonType(NumericButton)
    75     // HbPushButton::polish() prevents layouting
    73     // HbPushButton::polish() prevents layouting
    76     // text and additional-text horizontally.
    74     // text and additional-text horizontally.
    77     HbAbstractButton::polish( params );
    75     HbAbstractButton::polish( params );
    78 }
    76 }
    79 
    77 
       
    78 void DialpadButton::updatePrimitives()
       
    79 {
       
    80     HbPushButton::updatePrimitives();
       
    81 
       
    82     HbFrameItem* frame =
       
    83         qgraphicsitem_cast<HbFrameItem*>(HbWidget::primitive("background"));
       
    84 
       
    85     if (!frame) {
       
    86         return;
       
    87     }
       
    88 
       
    89     QString graphicsName;
       
    90 
       
    91     if (!isEnabled()) {
       
    92         graphicsName = "qtg_fr_input_btn_function_disabled";
       
    93     } else if (isDown()) {
       
    94         if (buttonType()==CallButton) {
       
    95             graphicsName = "qtg_fr_btn_green_pressed";
       
    96         } else if (buttonType()==FunctionButton) {
       
    97             graphicsName = "qtg_fr_input_btn_function_pressed";
       
    98         } else {
       
    99             graphicsName = "qtg_fr_input_btn_keypad_pressed";
       
   100         }
       
   101     } else {
       
   102         if (buttonType()==CallButton) {
       
   103             graphicsName = "qtg_fr_btn_green_normal";
       
   104         } else if (buttonType()==FunctionButton) {
       
   105             graphicsName = "qtg_fr_input_btn_function_normal";
       
   106         } else {
       
   107             graphicsName = "qtg_fr_input_btn_keypad_normal";
       
   108         }
       
   109     }
       
   110 
       
   111     frame->frameDrawer().setFrameGraphicsName(graphicsName);
       
   112 }