| Home · All Classes · Main Classes · Deprecated |
MObjectMenuView implements an object view "frogfoot" for the MApplicationMenu widget. More...


Public Member Functions | |
| MObjectMenuView (MObjectMenu *controller) | |
| virtual | ~MObjectMenuView () |
Protected Slots | |
| void | actionAdded (MAction *action) |
| void | actionModified (MAction *action) |
| void | actionRemoved (MAction *action) |
Protected Member Functions | |
| MObjectMenuView (MObjectMenuViewPrivate &dd, MObjectMenu *controller) | |
Protected Attributes | |
| MObjectMenuViewPrivate *const | d_ptr |
MObjectMenuView implements an object view "frogfoot" for the MApplicationMenu widget.
Definition at line 37 of file mobjectmenuview.h.
| MObjectMenuView::MObjectMenuView | ( | MObjectMenuViewPrivate & | dd, | |
| MObjectMenu * | controller | |||
| ) | [protected] |
Definition at line 63 of file mobjectmenuview.cpp.
:
MSceneWindowView(controller),
d_ptr(&dd)
{
Q_D(MObjectMenuView);
d->q_ptr = this;
d->controller = controller;
d->init();
}
| MObjectMenuView::MObjectMenuView | ( | MObjectMenu * | controller | ) |
Constructor.
| controller | Pointer to the MObjectMenu |
Definition at line 53 of file mobjectmenuview.cpp.
:
MSceneWindowView(controller),
d_ptr(new MObjectMenuViewPrivate)
{
Q_D(MObjectMenuView);
d->q_ptr = this;
d->controller = controller;
d->init();
}
| MObjectMenuView::~MObjectMenuView | ( | ) | [virtual] |
Destructor.
Definition at line 73 of file mobjectmenuview.cpp.
{
#ifdef HAVE_CONTENTACTION
Q_D(MObjectMenuView);
QHash<MAction*, ContentAction::Action>::iterator i = d->contentActions.begin(),
e = d->contentActions.end();
for(; i!=e; ++i) {
actionRemoved(i.key());
delete i.key();
}
d->contentActions.clear();
#endif
MActionList actions = model()->actions();
const int count = actions.count();
for (int i = 0; i < count; ++i) {
actionRemoved(actions.at(i));
}
delete d_ptr;
}

| void MObjectMenuView::actionAdded | ( | MAction * | action | ) | [protected, slot] |
Definition at line 95 of file mobjectmenuview.cpp.
{
Q_D(MObjectMenuView);
// show only if it is visible
if (action->isVisible()) {
// create button for this action
MButton *button = new MButton(action->iconID(), action->text(), d->controller);
d->controller->connect(button, SIGNAL(clicked(bool)), SLOT(dismiss()));
QObject::connect(button, SIGNAL(clicked(bool)), action, SIGNAL(triggered()));
button->setEnabled(action->isEnabled());
d->layout->addItem(button);
if(d->layout->count() == 1) {
// make the only button to use "single button" background
button->setLayoutPosition(M::DefaultPosition);
} else {
MButton* prev = (MButton*)d->layout->itemAt(d->layout->count() -2);
// we have more than one in layout
if(d->layout->count() == 2) {
prev->setLayoutPosition(M::VerticalTopPosition);
} else {
prev->setLayoutPosition(M::VerticalCenterPosition);
}
button->setLayoutPosition(M::VerticalBottomPosition);
}
d->buttons.insert(action, button);
}
}

| void MObjectMenuView::actionModified | ( | MAction * | action | ) | [protected, slot] |
Definition at line 139 of file mobjectmenuview.cpp.
{
Q_D(MObjectMenuView);
MButton *button = d->buttons.value(action, NULL);
if (button) {
if (!action->isVisible()) {
actionRemoved(action);
} else {
// update button data accordingly
button->setText(action->text());
button->setIconID(action->iconID());
button->setEnabled(action->isEnabled());
}
} else {
// there is no button yet, action must've been invisible
actionAdded(action);
}
}

| void MObjectMenuView::actionRemoved | ( | MAction * | action | ) | [protected, slot] |
Definition at line 128 of file mobjectmenuview.cpp.
{
Q_D(MObjectMenuView);
MButton *button = d->buttons.value(action, NULL);
if (button) {
d->buttons.remove(action);
delete button;
}
}
MObjectMenuViewPrivate* const MObjectMenuView::d_ptr [protected] |
Reimplemented from MWidgetView.
Definition at line 46 of file mobjectmenuview.h.
| Copyright © 2010 Nokia Corporation | Generated on Thu Nov 4 2010 18:14:26 (PDT) Doxygen 1.7.1 |
MeeGo Touch |