#define SCROLL_STEP 20
//**************************************************
-class CommandsArea: public QScrollArea
+class CommandsArea : public QScrollArea
{
-public:
+ public:
CommandsArea(QWidget* theParent)
: QScrollArea(theParent)
{
}
-protected:
+ protected:
virtual void resizeEvent(QResizeEvent * theEvent);
};
myCommandsArea = new CommandsArea(this);
aMainLayout->addWidget(myCommandsArea);
+ myCommandsArea->viewport()->installEventFilter(this);
myChildWidget = new QWidget(myCommandsArea);
myCommandsArea->setWidget(myChildWidget);
XGUI_MenuGroupPanel* aGroup = new XGUI_MenuGroupPanel(myChildWidget);
aGroup->setObjectName(theId);
myLayout->addWidget(aGroup);
- addSeparator();
+ if (theId != "Default") {
+ addSeparator();
+ }
myLayout->addStretch();
myGroups.append(aGroup);
return aGroup;
int aWgtWidth = myChildWidget->childrenRect().width();
return ((aVPWidth - aPos.x()) < aWgtWidth);
}
+
+bool XGUI_Workbench::eventFilter(QObject *theObj, QEvent *theEvent)
+{
+ if (theObj == myCommandsArea->viewport()) {
+ if (theEvent->type() == QEvent::Resize) {
+ myLeftButton->setVisible(isExceedsLeft());
+ myRightButton->setVisible(isExceedsRight());
+ }
+ }
+ return QWidget::eventFilter(theObj, theEvent);
+}
+
+XGUI_Command* XGUI_Workbench::feature(const QString& theId) const
+{
+ QList<XGUI_MenuGroupPanel*>::const_iterator aIt;
+ for (aIt = myGroups.constBegin(); aIt != myGroups.constEnd(); ++aIt) {
+ XGUI_Command* aCmd = (*aIt)->feature(theId);
+ if (aCmd)
+ return aCmd;
+ }
+ return 0;
+}
+
+QList<XGUI_Command*> XGUI_Workbench::features() const
+{
+ QList<XGUI_Command*> aList;
+ foreach (XGUI_MenuGroupPanel* aGroup, myGroups)
+ {
+ aList.append(aGroup->features());
+ }
+ return aList;
+}