Home · All Namespaces · All Classes
Public Member Functions | Protected Slots | Protected Member Functions

SwitcherButtonWithTitleBarView Class Reference

SwitcherButtonWithTitleBarView implements a switcher view with a title bar. More...

#include <switcherbuttonwithtitlebarview.h>

Inheritance diagram for SwitcherButtonWithTitleBarView:
Inheritance graph
[legend]
Collaboration diagram for SwitcherButtonWithTitleBarView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SwitcherButtonWithTitleBarView (SwitcherButton *controller)
 Constructs a new SwitcherButtonWithTitleBarView.
virtual ~SwitcherButtonWithTitleBarView ()
 Destroys the SwitcherButtonWithTitleBarView.
virtual void applyStyle ()
 REIMPLEMENTATION

Protected Slots

virtual void updateData (const QList< const char * > &modifications)
 

Protected Member Functions

virtual void setupModel ()
 
virtual QPoint thumbnailPosition () const
 Returns the thumbnail position in parent coordinates.

Detailed Description

SwitcherButtonWithTitleBarView implements a switcher view with a title bar.

Definition at line 36 of file switcherbuttonwithtitlebarview.h.


Constructor & Destructor Documentation

SwitcherButtonWithTitleBarView::SwitcherButtonWithTitleBarView ( SwitcherButton controller  ) 

Constructs a new SwitcherButtonWithTitleBarView.

Parameters:
controller The button's controller

Definition at line 27 of file switcherbuttonwithtitlebarview.cpp.

                                                                                     :
    SwitcherButtonView(button)
{
    titleBarLayout = new QGraphicsLinearLayout(Qt::Horizontal, controller);
    titleBarLayout->setContentsMargins(0,0,0,0);

    titleLabel = new MLabel(controller);
    titleLabel->setContentsMargins(0,0,0,0);
    titleLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    titleBarLayout->addItem(titleLabel);

    closeButton = new MButton();
    closeButton->setViewType("extended");
    connect(closeButton, SIGNAL(clicked()), controller, SLOT(close()));
    titleBarLayout->addItem(closeButton);
    titleBarLayout->setAlignment(closeButton, Qt::AlignVCenter);

    controller->setLayout(titleBarLayout);
}

SwitcherButtonWithTitleBarView::~SwitcherButtonWithTitleBarView (  )  [virtual]

Destroys the SwitcherButtonWithTitleBarView.

Definition at line 47 of file switcherbuttonwithtitlebarview.cpp.

{
}


Member Function Documentation

void SwitcherButtonWithTitleBarView::applyStyle (  )  [virtual]

REIMPLEMENTATION

Reimplemented from SwitcherButtonView.

Definition at line 51 of file switcherbuttonwithtitlebarview.cpp.

{
    SwitcherButtonView::applyStyle();

    if (style()->croppingTop() > 0) {
        titleLabel->show();

        // Apply style to close button
        if (controller->objectName() == "DetailviewButton") {
            closeButton->setObjectName("CloseButtonDetailview");
            if (model()->viewMode() == SwitcherButtonModel::Large) {
                closeButton->show();
            } else {
                closeButton->hide();
            }
            titleLabel->setObjectName("SwitcherButtonTitleLabelDetailview");

        } else {
            if(model()->viewMode() == SwitcherButtonModel::Medium) {
                closeButton->setObjectName("CloseButtonOverviewMedium");
                titleLabel->setObjectName("SwitcherButtonTitleLabelOverviewMedium");
            } else {
                closeButton->setObjectName("CloseButtonOverviewLarge");
                titleLabel->setObjectName("SwitcherButtonTitleLabelOverviewLarge");
            }

            closeButton->show();
        }
        closeButton->setIconID(style()->closeIcon());
    } else {
        titleLabel->hide();
        closeButton->hide();
    }

    update();
}

void SwitcherButtonWithTitleBarView::setupModel (  )  [protected, virtual]

REIMPLEMENTATION

Reimplemented from SwitcherButtonView.

Definition at line 89 of file switcherbuttonwithtitlebarview.cpp.

{
    SwitcherButtonView::setupModel();

    titleLabel->setText(model()->text());
}

QPoint SwitcherButtonWithTitleBarView::thumbnailPosition (  )  const [protected, virtual]

Returns the thumbnail position in parent coordinates.

Reimplemented from SwitcherButtonView.

Definition at line 107 of file switcherbuttonwithtitlebarview.cpp.

{
    return QPoint(0, titleLabel->size().height());
}

void SwitcherButtonWithTitleBarView::updateData ( const QList< const char * > &  modifications  )  [protected, virtual, slot]

REIMPLEMENTATION

Reimplemented from SwitcherButtonView.

Definition at line 96 of file switcherbuttonwithtitlebarview.cpp.

{
    SwitcherButtonView::updateData(modifications);
    const char *member;
    foreach(member, modifications) {
        if(member == SwitcherButtonModel::Text) {
            titleLabel->setText(model()->text());
        }
    }
}


The documentation for this class was generated from the following files:

Copyright © 2010 Nokia Corporation Generated on Thu Nov 4 2010 18:20:42
Doxygen 1.7.1
MeeGo Touch