diff --git a/src/Gui/QSint/actionpanel/actionbox.cpp b/src/Gui/QSint/actionpanel/actionbox.cpp new file mode 100644 index 000000000..28ea29564 --- /dev/null +++ b/src/Gui/QSint/actionpanel/actionbox.cpp @@ -0,0 +1,218 @@ +#include "actionbox.h" + +#include + + +namespace QSint +{ + + +const char* ActionBoxStyle = + "QSint--ActionBox {" + "background-color: white;" + "border: 1px solid white;" + "border-radius: 3px;" + "text-align: left;" + "}" + + "QSint--ActionBox:hover {" + "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F9FDFF, stop: 1 #EAF7FF);" + "border: 1px solid #DAF2FC;" + "}" + + + "QSint--ActionBox QSint--ActionLabel[class='header'] {" + "text-align: left;" + "font: 14px;" + "color: #006600;" + "background-color: transparent;" + "border: none;" + "}" + + "QSint--ActionBox QSint--ActionLabel[class='header']:hover {" + "color: #00cc00;" + "text-decoration: underline;" + "}" + + + "QSint--ActionBox QSint--ActionLabel[class='action'] {" + "background-color: transparent;" + "border: none;" + "color: #0033ff;" + "text-align: left;" + "font: 11px;" + "}" + + "QSint--ActionBox QSint--ActionLabel[class='action']:!enabled {" + "color: #999999;" + "}" + + "QSint--ActionBox QSint--ActionLabel[class='action']:hover {" + "color: #0099ff;" + "text-decoration: underline;" + "}" + + "QSint--ActionBox QSint--ActionLabel[class='action']:on {" + "background-color: #ddeeff;" + "color: #006600;" + "}" + +; + + +ActionBox::ActionBox(QWidget *parent) : + QFrame(parent) +{ + init(); +} + +ActionBox::ActionBox(const QString & headerText, QWidget *parent) : + QFrame(parent) +{ + init(); + headerLabel->setText(headerText); +} + +ActionBox::ActionBox(const QPixmap & icon, const QString & headerText, QWidget *parent) : + QFrame(parent) +{ + init(); + headerLabel->setText(headerText); + setIcon(icon); +} + +void ActionBox::init() +{ + setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Maximum); + + setStyleSheet(QString(ActionBoxStyle)); + + QHBoxLayout *mainLayout = new QHBoxLayout(this); + + QVBoxLayout *iconLayout = new QVBoxLayout(); + mainLayout->addLayout(iconLayout); + + iconLabel = new QLabel(this); + iconLayout->addWidget(iconLabel); + iconLayout->addStretch(); + + dataLayout = new QVBoxLayout(); + mainLayout->addLayout(dataLayout); + + headerLabel = createItem(""); + headerLabel->setProperty("class", "header"); +} + +void ActionBox::setIcon(const QPixmap & icon) +{ + iconLabel->setPixmap(icon); + iconLabel->setFixedSize(icon.size()); +} + +ActionLabel* ActionBox::createItem(QAction * action, QLayout * l) +{ + if (!action) + return 0; + + ActionLabel *act = createItem("", l); + act->setDefaultAction(action); + return act; +} + +QList ActionBox::createItems(QList actions) +{ + QList list; + + if (actions.isEmpty()) + return list; + + QLayout *l = createHBoxLayout(); + + foreach (QAction *action, actions) { + ActionLabel *act = createItem(action, l); + if (act) + list.append(act); + } + + return list; +} + +ActionLabel* ActionBox::createItem(const QString & text, QLayout * l) +{ + ActionLabel *act = new ActionLabel(this); + act->setText(text); + act->setProperty("class", "action"); + act->setStyleSheet(""); + + if (l) + l->addWidget(act); + else { + QHBoxLayout *hbl = new QHBoxLayout(); + hbl->addWidget(act); + createSpacer(hbl); + dataLayout->addLayout(hbl); + } + + return act; +} + +ActionLabel* ActionBox::createItem(const QPixmap & icon, const QString & text, QLayout * l) +{ + ActionLabel *act = createItem(text, l); + act->setIcon(QIcon(icon)); + return act; +} + +QSpacerItem* ActionBox::createSpacer(QLayout * l) +{ + QSpacerItem * spacer; + + if (l) // add horizontal spacer + l->addItem(spacer = new QSpacerItem(1,0,QSizePolicy::MinimumExpanding,QSizePolicy::Ignored)); + else // add vertical spacer + dataLayout->addItem(spacer = new QSpacerItem(0,1,QSizePolicy::Ignored,QSizePolicy::MinimumExpanding)); + + return spacer; +} + +QLayout* ActionBox::createHBoxLayout() +{ + QHBoxLayout *hbl = new QHBoxLayout(); + dataLayout->addLayout(hbl); + QHBoxLayout *hbl1 = new QHBoxLayout(); + hbl->addLayout(hbl1); + createSpacer(hbl); + return hbl1; +} + +void ActionBox::addLayout(QLayout * l) +{ + if (l) { + dataLayout->addLayout(l); + l->setParent(this); + } +} + +void ActionBox::addWidget(QWidget * w, QLayout * l) +{ + if (!w) return; + + w->setParent(this); + + if (l) + l->addWidget(w); + else { + QHBoxLayout *hbl = new QHBoxLayout(); + hbl->addWidget(w); + createSpacer(hbl); + dataLayout->addLayout(hbl); + } +} + +QSize ActionBox::minimumSizeHint() const +{ + return QSize(150,100); +} + + +} // namespace diff --git a/src/Gui/QSint/actionpanel/actionbox.h b/src/Gui/QSint/actionpanel/actionbox.h new file mode 100644 index 000000000..819593414 --- /dev/null +++ b/src/Gui/QSint/actionpanel/actionbox.h @@ -0,0 +1,251 @@ +#ifndef ACTIONBOX_H +#define ACTIONBOX_H + +#include "actionlabel.h" + +#include +#include + + +namespace QSint +{ + + +/** + \brief Class representing a panel of actions similar to Windows Vista/7 control panel items. + \since 0.2 + + \image html ActionBox.png An example of ActionBox + + ActionBox normally consists of an icon, clickable header and a list of actions. + Every action can have own icon as well, provide tooltips and status tips, + be clickable and checkable etc. i.e. behave like a normal ActionLabel. + + ActionBox objects are easily customizable via CSS technology - you can get + different look just by writing corresponding style sheet. + + Usage of ActionBox in the application + + 1. Create ActionBox using constructor (or in Designer as Promoted Objects). + Icon and header text can be passed to the constructor as well. For example: + + \code + ActionBox *box1 = new ActionBox(":/icons/box1icon.png", "Header Text", this); + \endcode + + 2. ActionBox header itself is a clickable item (based on ActionLabel), so you + can retrieve it and use, for example, to connect with a slot: + + \code + connect(box1->header(), SIGNAL(clicked()), this, SLOT(header1clicked())); + \endcode + + 3. To create an action, use one of createItem() functions. For example: + + \code + ActionLabel *action1 = box1->createItem(":/icons/action1icon.png", "Action1 Text"); + connect(action1, SIGNAL(clicked()), this, SLOT(action1clicked())); + + ActionLabel *action2 = box1->createItem(":/icons/action2icon.png", "Action2 Text"); + connect(action2, SIGNAL(clicked()), this, SLOT(action2clicked())); + \endcode + + createItem() also allows to create an ActionLabel from already existing QAction: + + \code + QAction myAction3(":/icons/action3icon.png", "Action3 Text"); + connect(myAction3, SIGNAL(clicked()), this, SLOT(action3clicked())); + + ActionLabel *action3 = box1->createItem(myAction3); + \endcode + + 4. By default, actions are arranged vertically, one per row. In order + to have more than one actions in a row, first add horizontal layout item + using createHBoxLayout() function, and then pass it to the createItem() to + create actions. + + \code + // create horizontal layout + QLayout *hbl1 = box1->createHBoxLayout(); + // create actions using this layout + ActionLabel *action3 = box1->createItem(":/icons/action3icon.png", "1st action in row", hbl1); + ActionLabel *action4 = box1->createItem("2nd action in row", hbl1); + \endcode + + 5. Sometimes you would like to have a spacer between the items. Use createSpacer() + function to insert an empty space into default or specified layout. + + \code + // create a spacer after two actions added before + box1->createSpacer(hbl1); + // create another action which will be preceded by the empty space (i.e. right-aligned) + ActionLabel *action5 = box1->createItem("3nd action in row", hbl1); + \endcode + + 6. You can insert arbitrary layout items and widgets into ActionBox using + addLayout() and addWidgets() functions. Please note that ownership of these items + transferred to ActionBox, so you must not delete them manually. + + Customization of ActionBox via CSS + + ActionBox items can be easily customized using CSS mechanism. Just create a new + style and apply it to the ActionBox with setStyleSheet(). + + See the following example of the complete ActionBox customization. Note that + \a QSint--ActionBox is used as a main class name. Headers are ActionLabels with + property \a class='header'. Actions are ActionLabels with + property \a class='action'. + + \code + // define a string representing CSS style + const char* ActionBoxNewStyle = + + // customization of ActionBox + "QSint--ActionBox {" + "background-color: white;" + "border: 1px solid white;" + "border-radius: 3px;" + "text-align: left;" + "}" + + "QSint--ActionBox:hover {" + "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F9FDFF, stop: 1 #EAF7FF);" + "border: 1px solid #DAF2FC;" + "}" + + // customization of ActionBox's header + "QSint--ActionBox QSint--ActionLabel[class='header'] {" + "text-align: left;" + "font: 14px;" + "color: #006600;" + "background-color: transparent;" + "border: none;" + "}" + + "QSint--ActionBox QSint--ActionLabel[class='header']:hover {" + "color: #00cc00;" + "text-decoration: underline;" + "}" + + // customization of ActionBox's actions + "QSint--ActionBox QSint--ActionLabel[class='action'] {" + "background-color: transparent;" + "border: none;" + "color: #0033ff;" + "text-align: left;" + "font: 11px;" + "}" + + "QSint--ActionBox QSint--ActionLabel[class='action']:hover {" + "color: #0099ff;" + "text-decoration: underline;" + "}" + + "QSint--ActionBox QSint--ActionLabel[class='action']:on {" + "background-color: #ddeeff;" + "color: #006600;" + "}" + ; + + // apply the style + box1->setStyleSheet(ActionBoxNewStyle); + \endcode + +*/ +class ActionBox : public QFrame +{ + Q_OBJECT + + Q_PROPERTY(QPixmap icon READ icon WRITE setIcon) + Q_PROPERTY(ActionLabel header READ header) + +public: + /** Constructor. + */ + explicit ActionBox(QWidget *parent = 0); + /** Constructor. + */ + explicit ActionBox(const QString & headerText, QWidget *parent = 0); + /** Constructor. + */ + explicit ActionBox(const QPixmap & icon, const QString & headerText, QWidget *parent = 0); + + /** Sets icon of the ActionBox to \a icon. + */ + void setIcon(const QPixmap & icon); + /** Returns icon of the ActionBox. + */ + inline const QPixmap* icon() const { return iconLabel->pixmap(); } + + /** Returns header item of the ActionBox. + */ + inline ActionLabel* header() const { return headerLabel; } + + /** Creates action item from the \a action and returns it. + + By default, action is added to the default vertical layout, i.e. subsequent + calls of this function will create several actions arranged vertically, + one below another. + + You can add action to the specified layout passing it as \a l parameter. + This allows to do custom actions arrangements, i.e. horizontal etc. + + \since 0.2 + */ + ActionLabel* createItem(QAction * action, QLayout * l = 0); + + /** Creates action items from the \a actions list and returns the list of action items. + \since 0.2 + */ + QList createItems(QList actions); + + /** Adds an action with \a text to the ActionBox and returns action item. + */ + ActionLabel* createItem(const QString & text = QString(), QLayout * l = 0); + /** Adds an action with \a icon and \a text to the ActionBox and returns action item. + + This function acts just like previous one. See the description above. + */ + ActionLabel* createItem(const QPixmap & icon, const QString & text, QLayout * l = 0); + + /** Adds a spacer and returns spacer item. + + By default, a spacer is added to the default vertical layout. + You can add a spacer to the specified layout passing it as \a l parameter. + */ + QSpacerItem* createSpacer(QLayout * l = 0); + + /** Creates empty horizontal layout. + + Use this function to arrange action items into a row. + */ + QLayout* createHBoxLayout(); + + /** Returns default layout used for actions (typically it's QVBoxLayout). + */ + inline QLayout* itemLayout() const { return dataLayout; } + + /** Adds layout \a l to the default layout. + */ + void addLayout(QLayout * l); + /** Adds widget \a w to the layout. + + By default, widget is added to the default vertical layout. + You can add widget to the specified layout passing it as \a l parameter. + */ + void addWidget(QWidget * w, QLayout * l = 0); + + virtual QSize minimumSizeHint() const; + +protected: + void init(); + + QVBoxLayout *dataLayout; + QLabel *iconLabel; + ActionLabel *headerLabel; +}; + + +} // namespace + +#endif // ACTIONBOX_H diff --git a/src/Gui/QSint/actionpanel/actiongroup.cpp b/src/Gui/QSint/actionpanel/actiongroup.cpp new file mode 100644 index 000000000..a2ab56ddb --- /dev/null +++ b/src/Gui/QSint/actionpanel/actiongroup.cpp @@ -0,0 +1,250 @@ +#include "actiongroup.h" +#include "taskheader_p.h" +#include "taskgroup_p.h" +#include "actionlabel.h" +#include "actionpanelscheme.h" + +#include + + +namespace QSint +{ + + +ActionGroup::ActionGroup(QWidget *parent) + : QWidget(parent) +{ + myHeader = new TaskHeader(QPixmap(), "", false, this); + myHeader->setVisible(false); + init(false); +} + +ActionGroup::ActionGroup(const QString &title, bool expandable, QWidget *parent) + : QWidget(parent) +{ + myHeader = new TaskHeader(QPixmap(), title, expandable, this); + init(true); +} + +ActionGroup::ActionGroup(const QPixmap &icon, const QString &title, bool expandable, QWidget *parent) + : QWidget(parent) +{ + myHeader = new TaskHeader(icon, title, expandable, this); + init(true); +} + +void ActionGroup::init(bool header) +{ + m_foldStep = 0; + + myScheme = ActionPanelScheme::defaultScheme(); + + QVBoxLayout *vbl = new QVBoxLayout(); + vbl->setMargin(0); + vbl->setSpacing(0); + setLayout(vbl); + + vbl->addWidget(myHeader); + + myGroup = new TaskGroup(this, header); + vbl->addWidget(myGroup); + + myDummy = new QWidget(this); + vbl->addWidget(myDummy); + myDummy->hide(); + + connect(myHeader, SIGNAL(activated()), this, SLOT(showHide())); +} + +void ActionGroup::setScheme(ActionPanelScheme *pointer) +{ + myScheme = pointer; + myHeader->setScheme(pointer); + myGroup->setScheme(pointer); + update(); +} + +QBoxLayout* ActionGroup::groupLayout() +{ + return myGroup->groupLayout(); +} + +ActionLabel* ActionGroup::addAction(QAction *action, bool addToLayout, bool addStretch) +{ + if (!action) + return 0; + + ActionLabel* label = new ActionLabel(action, this); + myGroup->addActionLabel(label, addToLayout, addStretch); + + return label; +} + +ActionLabel* ActionGroup::addActionLabel(ActionLabel *label, bool addToLayout, bool addStretch) +{ + if (!label) + return 0; + + myGroup->addActionLabel(label, addToLayout, addStretch); + + return label; +} + +bool ActionGroup::addWidget(QWidget *widget, bool addToLayout, bool addStretch) +{ + return myGroup->addWidget(widget, addToLayout, addStretch); +} + +void ActionGroup::showHide() +{ + if (m_foldStep) + return; + + if (!myHeader->expandable()) + return; + + if (myGroup->isVisible()) + { + m_foldPixmap = myGroup->transparentRender(); +// m_foldPixmap = QPixmap::grabWidget(myGroup, myGroup->rect()); + + m_tempHeight = m_fullHeight = myGroup->height(); + m_foldDelta = m_fullHeight / myScheme->groupFoldSteps; + m_foldStep = myScheme->groupFoldSteps; + m_foldDirection = -1; + + myGroup->hide(); + myDummy->setFixedSize(myGroup->size()); + myDummy->show(); + + QTimer::singleShot(myScheme->groupFoldDelay, this, SLOT(processHide())); + } + else + { + m_foldStep = myScheme->groupFoldSteps; + m_foldDirection = 1; + m_tempHeight = 0; + + QTimer::singleShot(myScheme->groupFoldDelay, this, SLOT(processShow())); + } + + myDummy->show(); +} + +void ActionGroup::processHide() +{ + if (!--m_foldStep) { + myDummy->setFixedHeight(0); + myDummy->hide(); + setFixedHeight(myHeader->height()); + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + return; + } + + setUpdatesEnabled(false); + + m_tempHeight -= m_foldDelta; + myDummy->setFixedHeight(m_tempHeight); + setFixedHeight(myDummy->height()+myHeader->height()); + + QTimer::singleShot(myScheme->groupFoldDelay, this, SLOT(processHide())); + + setUpdatesEnabled(true); +} + +void ActionGroup::processShow() +{ + if (!--m_foldStep) { + myDummy->hide(); + m_foldPixmap = QPixmap(); + myGroup->show(); + setFixedHeight(m_fullHeight+myHeader->height()); + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + setMaximumHeight(9999); + setMinimumHeight(0); + return; + } + + setUpdatesEnabled(false); + + m_tempHeight += m_foldDelta; + myDummy->setFixedHeight(m_tempHeight); + setFixedHeight(myDummy->height()+myHeader->height()); + + QTimer::singleShot(myScheme->groupFoldDelay, this, SLOT(processShow())); + + setUpdatesEnabled(true); +} + +void ActionGroup::paintEvent ( QPaintEvent * event ) +{ + QPainter p(this); + + if (myDummy->isVisible()) { + if (myScheme->groupFoldThaw) { + if (m_foldDirection < 0) + p.setOpacity((double)m_foldStep / myScheme->groupFoldSteps); + else + p.setOpacity((double)(myScheme->groupFoldSteps-m_foldStep) / myScheme->groupFoldSteps); + } + + switch (myScheme->groupFoldEffect) + { + case ActionPanelScheme::ShrunkFolding: + p.drawPixmap(myDummy->pos(), m_foldPixmap.scaled(myDummy->size()) ); + break; + + case ActionPanelScheme::SlideFolding: + p.drawPixmap(myDummy->pos(), m_foldPixmap, + QRect(0, m_foldPixmap.height()-myDummy->height(), + m_foldPixmap.width(), myDummy->width() + ) ); + break; + + default: + p.drawPixmap(myDummy->pos(), m_foldPixmap); + } + + return; + } +} + + +bool ActionGroup::isExpandable() const +{ + return myHeader->expandable(); +} + +void ActionGroup::setExpandable(bool expandable) +{ + myHeader->setExpandable(expandable); +} + +bool ActionGroup::hasHeader() const +{ + return myHeader->isVisible(); +} + +void ActionGroup::setHeader(bool enable) +{ + myHeader->setVisible(enable); +} + +QString ActionGroup::headerText() const +{ + return myHeader->myTitle->text(); +} + +void ActionGroup::setHeaderText(const QString & headerText) +{ + myHeader->myTitle->setText(headerText); +} + + +QSize ActionGroup::minimumSizeHint() const +{ + return QSize(200,100); +} + + +} diff --git a/src/Gui/QSint/actionpanel/actiongroup.h b/src/Gui/QSint/actionpanel/actiongroup.h new file mode 100644 index 000000000..71178a554 --- /dev/null +++ b/src/Gui/QSint/actionpanel/actiongroup.h @@ -0,0 +1,167 @@ +#ifndef ACTIONGROUP_H +#define ACTIONGROUP_H + +#include +#include +#include + + +namespace QSint +{ + + +class ActionLabel; +class ActionPanelScheme; + + +/** + \brief Class representing a single group of actions similar to Windows XP task panels. + \since 0.2 + + \image html ActionGroup.png An example of ActionGroup + + ActionGroup consists from optional header and set of actions represented by ActionLabel. + It can contain arbitrary widgets as well. +*/ + +class ActionGroup : public QWidget +{ + Q_OBJECT + + Q_PROPERTY(bool expandable READ isExpandable WRITE setExpandable) + Q_PROPERTY(bool header READ hasHeader WRITE setHeader) + Q_PROPERTY(QString headerText READ headerText WRITE setHeaderText) + +public: + /** Constructor. Creates ActionGroup without header. + */ + explicit ActionGroup(QWidget *parent = 0); + + /** Constructor. Creates ActionGroup with header's + text set to \a title, but with no icon. + + If \a expandable set to \a true (default), the group can be expanded/collapsed by the user. + */ + explicit ActionGroup(const QString& title, + bool expandable = true, + QWidget *parent = 0); + + /** Constructor. Creates ActionGroup with header's + text set to \a title and icon set to \a icon. + + If \a expandable set to \a true (default), the group can be expanded/collapsed by the user. + */ + explicit ActionGroup(const QPixmap& icon, + const QString& title, + bool expandable = true, + QWidget *parent = 0); + + /** Creates action item from the \a action and returns it. + + If \a addToLayout is set to \a true (default), + the action is added to the default vertical layout, i.e. subsequent + calls of this function will create several ActionLabels arranged vertically, + one below another. + + Set \a addToLayout to \a false if you want to add the action to the specified layout manually. + This allows to do custom actions arrangements, i.e. horizontal etc. + + If \a addStretch is set to \a true (default), + ActionLabel will be automatically aligned to the left side of the ActionGroup. + Set \a addStretch to \a false if you want ActionLabel to occupy all the horizontal space. + */ + ActionLabel* addAction(QAction *action, bool addToLayout = true, bool addStretch = true); + + /** Adds \a label to the group. + + \sa addAction() for the description. + */ + ActionLabel* addActionLabel(ActionLabel *label, bool addToLayout = true, bool addStretch = true); + + /** Adds \a widget to the group. Returns \a true if it has been added successfully. + + \sa addAction() for the description. + */ + bool addWidget(QWidget *widget, bool addToLayout = true, bool addStretch = true); + + /** Returns group's layout (QVBoxLayout by default). + */ + QBoxLayout* groupLayout(); + + /** Sets the scheme of the panel and all the child groups to \a scheme. + + By default, ActionPanelScheme::defaultScheme() is used. + */ + void setScheme(ActionPanelScheme *pointer); + + /** Returns \a true if the group is expandable. + + \sa setExpandable(). + */ + bool isExpandable() const; + + /** Returns \a true if the group has header. + + \sa setHeader(). + */ + bool hasHeader() const; + + /** Returns text of the header. + Only valid if the group has header (see hasHeader()). + + \sa setHeaderText(). + */ + QString headerText() const; + + QSize minimumSizeHint() const; + +public Q_SLOTS: + /** Expands/collapses the group. + Only valid if the group has header (see hasHeader()). + */ + void showHide(); + + /** Makes the group expandable if \a expandable is set to \a true. + + \sa isExpandable(). + */ + void setExpandable(bool expandable = true); + + /** Enables/disables group's header according to \a enable. + + \sa hasHeader(). + */ + void setHeader(bool enable = true); + + /** Sets text of the header to \a title. + Only valid if the group has header (see hasHeader()). + + \sa headerText(). + */ + void setHeaderText(const QString & title); + +protected Q_SLOTS: + void processHide(); + void processShow(); + +protected: + void init(bool header); + + virtual void paintEvent ( QPaintEvent * event ); + + double m_foldStep, m_foldDelta, m_fullHeight, m_tempHeight; + int m_foldDirection; + + QPixmap m_foldPixmap; + + class TaskHeader *myHeader; + class TaskGroup *myGroup; + QWidget *myDummy; + + ActionPanelScheme *myScheme; +}; + + +} // namespace + +#endif // ACTIONGROUP_H diff --git a/src/Gui/QSint/actionpanel/actionlabel.cpp b/src/Gui/QSint/actionpanel/actionlabel.cpp new file mode 100644 index 000000000..263bdff8b --- /dev/null +++ b/src/Gui/QSint/actionpanel/actionlabel.cpp @@ -0,0 +1,116 @@ +#include "actionlabel.h" + +#include +#include + + +namespace QSint +{ + + +const char* ActionLabelStyle = + "QSint--ActionLabel[class='action'] {" + "background-color: transparent;" + "border: 1px solid transparent;" + "color: #0033ff;" + "text-align: left;" + "font: 11px;" + "}" + + "QSint--ActionLabel[class='action']:!enabled {" + "color: #999999;" + "}" + + "QSint--ActionLabel[class='action']:hover {" + "color: #0099ff;" + "text-decoration: underline;" + "}" + + "QSint--ActionLabel[class='action']:focus {" + "border: 1px dotted black;" + "}" + + "QSint--ActionLabel[class='action']:on {" + "background-color: #ddeeff;" + "color: #006600;" + "}" +; + + +ActionLabel::ActionLabel(QWidget *parent) : + QToolButton(parent) +{ + init(); +} + +ActionLabel::ActionLabel(QAction *action, QWidget *parent) : + QToolButton(parent) +{ + init(); + + setDefaultAction(action); +} + +void ActionLabel::init() +{ + setProperty("class", "action"); + + setCursor(Qt::PointingHandCursor); + + setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + + setStyleSheet(QString(ActionLabelStyle)); + + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + + setFocusPolicy(Qt::StrongFocus); +} + +QSize ActionLabel::sizeHint() const +{ + ensurePolished(); + + int w = 0, h = 0; + + QStyleOptionToolButton opt; + initStyleOption(&opt); + + QString s(text()); + bool empty = s.isEmpty(); + if (empty) + s = QString::fromLatin1("XXXX"); + QFontMetrics fm = fontMetrics(); + QSize sz = fm.size(Qt::TextShowMnemonic, s); + if(!empty || !w) + w += sz.width(); + if(!empty || !h) + h = qMax(h, sz.height()); + opt.rect.setSize(QSize(w, h)); // PM_MenuButtonIndicator depends on the height + + if (!icon().isNull()) { + int ih = opt.iconSize.height(); + int iw = opt.iconSize.width() + 4; + w += iw; + h = qMax(h, ih); + } + + if (menu()) + w += style()->pixelMetric(QStyle::PM_MenuButtonIndicator, &opt, this); + + h += 4; + w += 8; + + QSize sizeHint = (style()->sizeFromContents(QStyle::CT_PushButton, &opt, QSize(w, h), this). + expandedTo(QApplication::globalStrut())); + + return sizeHint; +} + +QSize ActionLabel::minimumSizeHint() const +{ + return sizeHint(); +} + + +} // namespace + diff --git a/src/Gui/QSint/actionpanel/actionlabel.h b/src/Gui/QSint/actionpanel/actionlabel.h new file mode 100644 index 000000000..6ad8421b3 --- /dev/null +++ b/src/Gui/QSint/actionpanel/actionlabel.h @@ -0,0 +1,86 @@ +#ifndef ACTIONLABEL_H +#define ACTIONLABEL_H + +#include + + +namespace QSint +{ + + +/** + \brief Class representing an action similar to Windows Vista/7 control panel item. + + \image html ActionLabel.png An example of ActionLabel + + ActionLabel normally consists of an icon and text. + It also can have tooltip and status tip, + be clickable and checkable etc. i.e. behave like a normal QToolButton. + + Customization of ActionLabel via CSS + + ActionLabel objects are easily customizable via CSS technology - you can get + different look just by writing corresponding style sheet and applying it with setStyleSheet(). + + See the following example of the complete ActionLabel customization. Note that + \a QSint--ActionLabel is used as a main class name. + + \code + // define a string representing CSS style + const char* ActionLabelNewStyle = + + "QSint--ActionLabel[class='action'] {" + "background-color: transparent;" + "border: 1px solid transparent;" + "color: #0033ff;" + "text-align: left;" + "font: 11px;" + "}" + + "QSint--ActionLabel[class='action']:hover {" + "color: #0099ff;" + "text-decoration: underline;" + "}" + + "QSint--ActionLabel[class='action']:focus {" + "border: 1px dotted black;" + "}" + + "QSint--ActionLabel[class='action']:on {" + "background-color: #ddeeff;" + "color: #006600;" + "}" + ; + + // apply the style + label1->setStyleSheet(ActionLabelNewStyle); + + \endcode +*/ +class ActionLabel : public QToolButton +{ + Q_OBJECT + +public: + /** Constructor. + */ + explicit ActionLabel(QWidget *parent = 0); + + /** Constructor. Creates ActionLabel from the \a action. + \since 0.2 + */ + explicit ActionLabel(QAction *action, QWidget *parent = 0); + + virtual ~ActionLabel() {} + + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + +protected: + void init(); +}; + + +} // namespace + +#endif // ACTIONLABEL_H diff --git a/src/Gui/QSint/actionpanel/actionpanel.cpp b/src/Gui/QSint/actionpanel/actionpanel.cpp new file mode 100644 index 000000000..3e68b5652 --- /dev/null +++ b/src/Gui/QSint/actionpanel/actionpanel.cpp @@ -0,0 +1,93 @@ +#include "actionpanel.h" +#include "actionpanelscheme.h" +#include "actiongroup.h" + +#include + + +namespace QSint +{ + + +ActionPanel::ActionPanel(QWidget *parent) : + BaseClass(parent) +{ + setProperty("class", "panel"); + + setScheme(ActionPanelScheme::defaultScheme()); + + setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); + + QVBoxLayout *vbl = new QVBoxLayout(); + vbl->setMargin(8); + vbl->setSpacing(8); + setLayout(vbl); +} + +void ActionPanel::setScheme(ActionPanelScheme *scheme) +{ + if (scheme) { + myScheme = scheme; + setStyleSheet(myScheme->actionStyle); + + // set scheme for children + QObjectList list(children()); + foreach(QObject *obj, list) { + if (dynamic_cast(obj)) { + ((ActionGroup*)obj)->setScheme(scheme); + continue; + } + } + + update(); + } +} + +//void ActionPanel::paintEvent ( QPaintEvent * event ) +//{ +// //QPainter p(this); + +// //p.setOpacity(0.5); +// //p.fillRect(rect(), myScheme->panelBackground); +//} + +void ActionPanel::addWidget(QWidget *w) +{ + if (w) + layout()->addWidget(w); +} + +void ActionPanel::addStretch(int s) +{ + ((QVBoxLayout*)layout())->addStretch(s); +} + +ActionGroup * ActionPanel::createGroup() +{ + ActionGroup * group = new ActionGroup(this); + addWidget(group); + return group; +} + +ActionGroup * ActionPanel::createGroup(const QString &title, bool expandable) +{ + ActionGroup * box = new ActionGroup(title, expandable, this); + addWidget(box); + return box; +} + +ActionGroup * ActionPanel::createGroup(const QPixmap &icon, const QString &title, bool expandable) +{ + ActionGroup * box = new ActionGroup(icon, title, expandable, this); + addWidget(box); + return box; +} + + +QSize ActionPanel::minimumSizeHint() const +{ + return QSize(200,150); +} + + +} // namespace diff --git a/src/Gui/QSint/actionpanel/actionpanel.h b/src/Gui/QSint/actionpanel/actionpanel.h new file mode 100644 index 000000000..ae8dc6b98 --- /dev/null +++ b/src/Gui/QSint/actionpanel/actionpanel.h @@ -0,0 +1,86 @@ +#ifndef ACTIONPANEL_H +#define ACTIONPANEL_H + +#include + + +namespace QSint +{ + + +class ActionPanelScheme; +class ActionGroup; + + +/** + \brief Class representing panels of actions similar to Windows XP task panels. + \since 0.2 + + \image html ActionPanel1.png An example of ActionPanel + + ActionPanel acts like a container for ActionGroup which in turn are containers for + the actions represented by ActionLabel. + + The look and fill is complete styleable via setScheme(). + Currently the following schemes available: ActionPanelScheme (the default), + WinXPPanelScheme and WinXPPanelScheme2 (blue Windows XP schemes), + WinVistaPanelScheme (Windows Vista variation), MacPanelScheme (MacOS variation), + AndroidPanelScheme (Android variation). +*/ +class ActionPanel : public QFrame +{ + typedef QFrame BaseClass; + + Q_OBJECT + +public: + /** Constructor. + */ + explicit ActionPanel(QWidget *parent = 0); + + /** Adds a widget \a w to the ActionPanel's vertical layout. + */ + void addWidget(QWidget *w); + + /** Adds a spacer with width \a s to the ActionPanel's vertical layout. + Normally you should do this after all the ActionGroups were added, in order to + maintain some space below. + */ + void addStretch(int s = 0); + + /** Creates and adds to the ActionPanel's vertical layout an empty ActionGroup without header. + */ + ActionGroup* createGroup(); + + /** Creates and adds to the ActionPanel's vertical layout an empty ActionGroup with header's + text set to \a title, but with no icon. + + If \a expandable set to \a true (default), the group can be expanded/collapsed by the user. + */ + ActionGroup* createGroup(const QString &title, bool expandable = true); + + /** Creates and adds to the ActionPanel's vertical layout an empty ActionGroup with header's + text set to \a title and icon set to \a icon. + + If \a expandable set to \a true (default), the group can be expanded/collapsed by the user. + */ + ActionGroup* createGroup(const QPixmap &icon, const QString &title, bool expandable = true); + + /** Sets the scheme of the panel and all the child groups to \a scheme. + + By default, ActionPanelScheme::defaultScheme() is used. + */ + void setScheme(ActionPanelScheme *scheme); + + virtual QSize minimumSizeHint() const; + +protected: + //virtual void paintEvent ( QPaintEvent * event ); + + ActionPanelScheme *myScheme; +}; + + +} // namespace + +#endif // ACTIONPANEL_H diff --git a/src/Gui/QSint/actionpanel/actionpanelscheme.cpp b/src/Gui/QSint/actionpanel/actionpanelscheme.cpp new file mode 100644 index 000000000..f6681e9ad --- /dev/null +++ b/src/Gui/QSint/actionpanel/actionpanelscheme.cpp @@ -0,0 +1,113 @@ +#include "actionpanelscheme.h" + + +class StaticLibInitializer +{ +public: + StaticLibInitializer() + { + Q_INIT_RESOURCE(schemes); + } +}; + +StaticLibInitializer staticLibInitializer; + + +namespace QSint +{ + + +const char* ActionPanelDefaultStyle = + + "QFrame[class='panel'] {" + "background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #99cccc, stop: 1 #EAF7FF);" + "}" + + "QSint--ActionGroup QFrame[class='header'] {" + "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F9FDFF, stop: 1 #EAF7FF);" + "border: 1px solid #00aa99;" + "border-bottom: 1px solid #99cccc;" + "border-top-left-radius: 3px;" + "border-top-right-radius: 3px;" + "}" + + "QSint--ActionGroup QFrame[class='header']:hover {" + "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EAF7FF, stop: 1 #F9FDFF);" + "}" + + "QSint--ActionGroup QToolButton[class='header'] {" + "text-align: left;" + "font: 14px;" + "color: #006600;" + "background-color: transparent;" + "border: 1px solid transparent;" + "}" + + "QSint--ActionGroup QToolButton[class='header']:hover {" + "color: #00cc00;" + "text-decoration: underline;" + "}" + + "QSint--ActionGroup QFrame[class='content'] {" + "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F9FDFF, stop: 1 #EAF7FF);" + "border: 1px solid #00aa99;" + "}" + + "QSint--ActionGroup QFrame[class='content'][header='true'] {" + "border-top: none;" + "}" + + "QSint--ActionGroup QToolButton[class='action'] {" + "background-color: transparent;" + "border: 1px solid transparent;" + "color: #0033ff;" + "text-align: left;" + "font: 11px;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:!enabled {" + "color: #999999;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:hover {" + "color: #0099ff;" + "text-decoration: underline;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:focus {" + "border: 1px dotted black;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:on {" + "background-color: #ddeeff;" + "color: #006600;" + "}" +; + + +ActionPanelScheme::ActionPanelScheme() +{ + headerSize = 28; + headerAnimation = true; + + headerButtonFold = QPixmap(":/default/Fold.png"); + headerButtonFoldOver = QPixmap(":/default/FoldOver.png"); + headerButtonUnfold = QPixmap(":/default/Unfold.png"); + headerButtonUnfoldOver = QPixmap(":/default/UnfoldOver.png"); + headerButtonSize = QSize(18,18); + + groupFoldSteps = 20; groupFoldDelay = 15; + groupFoldEffect = NoFolding; + groupFoldThaw = true; + + actionStyle = QString(ActionPanelDefaultStyle); +} + +ActionPanelScheme* ActionPanelScheme::defaultScheme() +{ + static ActionPanelScheme scheme; + return &scheme; +} + + +} diff --git a/src/Gui/QSint/actionpanel/actionpanelscheme.h b/src/Gui/QSint/actionpanel/actionpanelscheme.h new file mode 100644 index 000000000..c7a34bcfc --- /dev/null +++ b/src/Gui/QSint/actionpanel/actionpanelscheme.h @@ -0,0 +1,76 @@ +#ifndef TASKPANELSCHEME_H +#define TASKPANELSCHEME_H + +#include +#include + +#include + + +namespace QSint +{ + + +/** + \brief Class representing color scheme for ActionPanel and ActionGroup. + \since 0.2 + + \image html ActionPanel1.png Default ActionPanel scheme +*/ +class ActionPanelScheme +{ +public: + /** \enum TaskPanelFoldEffect + \brief Animation effect during expanding/collapsing of the ActionGroup's contents. + */ + enum TaskPanelFoldEffect + { + /// No folding effect + NoFolding, + /// Folding by scaling group's contents + ShrunkFolding, + /// Folding by sliding group's contents + SlideFolding + }; + + + ActionPanelScheme(); + + /** Returns a pointer to the default scheme object. + Must be reimplemented in the own schemes. + */ + static ActionPanelScheme* defaultScheme(); + + /// Height of the header in pixels. + int headerSize; + /// If set to \a true, moving mouse over the header results in changing its opacity slowly. + bool headerAnimation; + + /// Image of folding button when the group is expanded. + QPixmap headerButtonFold; + /// Image of folding button when the group is expanded and mouse cursor is over the button. + QPixmap headerButtonFoldOver; + /// Image of folding button when the group is collapsed. + QPixmap headerButtonUnfold; + /// Image of folding button when the group is collapsed and mouse cursor is over the button. + QPixmap headerButtonUnfoldOver; + + QSize headerButtonSize; + + /// Number of steps made for expanding/collapsing animation (default 20). + int groupFoldSteps; + /// Delay in ms between steps made for expanding/collapsing animation (default 15). + int groupFoldDelay; + /// Sets folding effect during expanding/collapsing. + TaskPanelFoldEffect groupFoldEffect; + /// If set to \a true, changes group's opacity slowly during expanding/collapsing. + bool groupFoldThaw; + + /// The CSS for the ActionPanel/ActionGroup elements. + QString actionStyle; +}; + + +} + +#endif // TASKPANELSCHEME_H diff --git a/src/Gui/QSint/actionpanel/android/Fold.png b/src/Gui/QSint/actionpanel/android/Fold.png new file mode 100644 index 000000000..a1139c48a Binary files /dev/null and b/src/Gui/QSint/actionpanel/android/Fold.png differ diff --git a/src/Gui/QSint/actionpanel/android/FoldOver.png b/src/Gui/QSint/actionpanel/android/FoldOver.png new file mode 100644 index 000000000..61b6fe0e4 Binary files /dev/null and b/src/Gui/QSint/actionpanel/android/FoldOver.png differ diff --git a/src/Gui/QSint/actionpanel/android/Unfold.png b/src/Gui/QSint/actionpanel/android/Unfold.png new file mode 100644 index 000000000..9e6342bf5 Binary files /dev/null and b/src/Gui/QSint/actionpanel/android/Unfold.png differ diff --git a/src/Gui/QSint/actionpanel/android/UnfoldOver.png b/src/Gui/QSint/actionpanel/android/UnfoldOver.png new file mode 100644 index 000000000..951813813 Binary files /dev/null and b/src/Gui/QSint/actionpanel/android/UnfoldOver.png differ diff --git a/src/Gui/QSint/actionpanel/androidpanelscheme.cpp b/src/Gui/QSint/actionpanel/androidpanelscheme.cpp new file mode 100644 index 000000000..a853cbf68 --- /dev/null +++ b/src/Gui/QSint/actionpanel/androidpanelscheme.cpp @@ -0,0 +1,75 @@ +#include "androidpanelscheme.h" + + +namespace QSint +{ + + +const char* ActionPanelAndroidStyle = + + "QFrame[class='panel'] {" + "background-color: #424242;" + "color: #ffffff;" + "font-size: 10px;" + "}" + + "QSint--ActionGroup QFrame[class='header'] {" + "background-color: #171717;" + "border-top: 1px solid white;" + "border-bottom: 1px solid white;" + "color: #ffffff;" + "}" + + "QSint--ActionGroup QToolButton[class='header'] {" + "text-align: left;" + "color: #ffffff;" + "background-color: transparent;" + "border: 1px solid transparent;" + "font-size: 14px;" + "}" + + "QSint--ActionGroup QFrame[class='content'] {" + "background-color: #171717;" + "}" + + "QSint--ActionGroup QToolButton[class='action'] {" + "background-color: transparent;" + "border: 1px solid transparent;" + "color: #ffffff;" + "text-align: left;" + "font-size: 14px;" + "min-height: 32px;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:!enabled {" + "color: #666666;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:focus {" + "border: 1px dotted black;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:on {" + "background-color: #ddeeff;" + "color: #006600;" + "}" + +; + + +AndroidPanelScheme::AndroidPanelScheme() : ActionPanelScheme() +{ + headerSize = 40; + + headerButtonFold = QPixmap(":/android/Fold.png"); + headerButtonFoldOver = QPixmap(":/android/FoldOver.png"); + headerButtonUnfold = QPixmap(":/android/Unfold.png"); + headerButtonUnfoldOver = QPixmap(":/android/UnfoldOver.png"); + headerButtonSize = QSize(33,33); + + actionStyle = QString(ActionPanelAndroidStyle); +} + + +} + diff --git a/src/Gui/QSint/actionpanel/androidpanelscheme.h b/src/Gui/QSint/actionpanel/androidpanelscheme.h new file mode 100644 index 000000000..43d6fcf80 --- /dev/null +++ b/src/Gui/QSint/actionpanel/androidpanelscheme.h @@ -0,0 +1,34 @@ +#ifndef ANDROIDPANELSCHEME_H +#define ANDROIDPANELSCHEME_H + + +#include "actionpanelscheme.h" + + +namespace QSint +{ + + +/** + \brief Android-like color scheme for ActionPanel and ActionGroup. + \since 0.2.1 + + \image html ActionPanel5.png Example of the scheme +*/ +class AndroidPanelScheme : public ActionPanelScheme +{ +public: + AndroidPanelScheme(); + + static ActionPanelScheme* defaultScheme() + { + static AndroidPanelScheme scheme; + return &scheme; + } +}; + + +} + + +#endif // ANDROIDPANELSCHEME_H diff --git a/src/Gui/QSint/actionpanel/default/Fold.png b/src/Gui/QSint/actionpanel/default/Fold.png new file mode 100644 index 000000000..279ddda66 Binary files /dev/null and b/src/Gui/QSint/actionpanel/default/Fold.png differ diff --git a/src/Gui/QSint/actionpanel/default/FoldOver.png b/src/Gui/QSint/actionpanel/default/FoldOver.png new file mode 100644 index 000000000..70cd655af Binary files /dev/null and b/src/Gui/QSint/actionpanel/default/FoldOver.png differ diff --git a/src/Gui/QSint/actionpanel/default/Unfold.png b/src/Gui/QSint/actionpanel/default/Unfold.png new file mode 100644 index 000000000..6a812f3d2 Binary files /dev/null and b/src/Gui/QSint/actionpanel/default/Unfold.png differ diff --git a/src/Gui/QSint/actionpanel/default/UnfoldOver.png b/src/Gui/QSint/actionpanel/default/UnfoldOver.png new file mode 100644 index 000000000..869c2b9c4 Binary files /dev/null and b/src/Gui/QSint/actionpanel/default/UnfoldOver.png differ diff --git a/src/Gui/QSint/actionpanel/mac/FoldOver.png b/src/Gui/QSint/actionpanel/mac/FoldOver.png new file mode 100644 index 000000000..a3f37135a Binary files /dev/null and b/src/Gui/QSint/actionpanel/mac/FoldOver.png differ diff --git a/src/Gui/QSint/actionpanel/mac/UnfoldOver.png b/src/Gui/QSint/actionpanel/mac/UnfoldOver.png new file mode 100644 index 000000000..3ef9d683a Binary files /dev/null and b/src/Gui/QSint/actionpanel/mac/UnfoldOver.png differ diff --git a/src/Gui/QSint/actionpanel/macpanelscheme.cpp b/src/Gui/QSint/actionpanel/macpanelscheme.cpp new file mode 100644 index 000000000..da0cd9694 --- /dev/null +++ b/src/Gui/QSint/actionpanel/macpanelscheme.cpp @@ -0,0 +1,66 @@ +#include "macpanelscheme.h" + + +namespace QSint +{ + + +const char* MacPanelStyle = + + "QFrame[class='panel'] {" + "background-color: #D9DEE5;" + "border: 1px solid #BBBBBB;" + "}" + + "QSint--ActionGroup QFrame[class='header'] {" + "border: none;" + "}" + + "QSint--ActionGroup QToolButton[class='header'] {" + "text-align: left;" + "color: #828CA8;" + "background-color: transparent;" + "font-weight: bold;" + "}" + + "QSint--ActionGroup QFrame[class='content'] {" + "background-color: #D9DEE5;" + "margin-left: 12px;" + "}" + + "QSint--ActionGroup QToolButton[class='action'] {" + "color: #000000;" + "text-align: left;" + "background-color: transparent;" + "border: 1px solid transparent;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:!enabled {" + "color: #ffffff;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:focus {" + "border: 1px solid #1E6CBB;" + "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6FA6DE, stop: 1 #1E6CBB);" + "color: #ffffff;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:on {" + "background-color: #ddeeff;" + "color: #006600;" + "}" +; + +MacPanelScheme::MacPanelScheme() : ActionPanelScheme() +{ + actionStyle = QString(MacPanelStyle); + + headerButtonFold = QPixmap(); + headerButtonFoldOver = QPixmap(":/mac/FoldOver.png"); + headerButtonUnfold = QPixmap(); + headerButtonUnfoldOver = QPixmap(":/mac/UnfoldOver.png"); + headerButtonSize = QSize(30,16); +} + + +} diff --git a/src/Gui/QSint/actionpanel/macpanelscheme.h b/src/Gui/QSint/actionpanel/macpanelscheme.h new file mode 100644 index 000000000..599a7696a --- /dev/null +++ b/src/Gui/QSint/actionpanel/macpanelscheme.h @@ -0,0 +1,32 @@ +#ifndef MACPANELSCHEME_H +#define MACPANELSCHEME_H + +#include "actionpanelscheme.h" + + +namespace QSint +{ + + +/** + \brief MacOS-like color scheme for ActionPanel and ActionGroup. + \since 0.2 + + \image html ActionPanel6.png Example of the scheme +*/ +class MacPanelScheme : public ActionPanelScheme +{ +public: + explicit MacPanelScheme(); + + static ActionPanelScheme* defaultScheme() + { + static MacPanelScheme scheme; + return &scheme; + } +}; + + +} + +#endif // MACPANELSCHEME_H diff --git a/src/Gui/QSint/actionpanel/schemes.qrc b/src/Gui/QSint/actionpanel/schemes.qrc new file mode 100644 index 000000000..b90d9bfc5 --- /dev/null +++ b/src/Gui/QSint/actionpanel/schemes.qrc @@ -0,0 +1,26 @@ + + + default/Fold.png + default/FoldOver.png + default/Unfold.png + default/UnfoldOver.png + xp/Fold_Blue1.png + xp/Fold_Blue2.png + xp/FoldOver_Blue1.png + xp/FoldOver_Blue2.png + xp/Unfold_Blue1.png + xp/Unfold_Blue2.png + xp/UnfoldOver_Blue1.png + xp/UnfoldOver_Blue2.png + vista/Fold.png + vista/FoldOver.png + vista/Unfold.png + vista/UnfoldOver.png + mac/FoldOver.png + mac/UnfoldOver.png + android/Fold.png + android/Unfold.png + android/FoldOver.png + android/UnfoldOver.png + + diff --git a/src/Gui/QSint/actionpanel/taskgroup_p.cpp b/src/Gui/QSint/actionpanel/taskgroup_p.cpp new file mode 100644 index 000000000..f3e92eb7b --- /dev/null +++ b/src/Gui/QSint/actionpanel/taskgroup_p.cpp @@ -0,0 +1,146 @@ +#include "taskgroup_p.h" + +#include +#include +#include + + +namespace QSint +{ + + +TaskGroup::TaskGroup(QWidget *parent, bool hasHeader) + : BaseClass(parent), + myHasHeader(hasHeader) +{ + setProperty("class", "content"); + setProperty("header", hasHeader ? "true" : "false"); + + setScheme(ActionPanelScheme::defaultScheme()); + + QVBoxLayout *vbl = new QVBoxLayout(); + vbl->setMargin(4); + vbl->setSpacing(0); + setLayout(vbl); + + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); +} + +void TaskGroup::setScheme(ActionPanelScheme *scheme) +{ + if (scheme) { + myScheme = scheme; + + setStyleSheet(myScheme->actionStyle); + + update(); + } +} + +bool TaskGroup::addActionLabel(ActionLabel *label, bool addToLayout, bool addStretch) +{ + if (!label) + return false; + + label->setStyleSheet(""); + + return addWidget(label, addToLayout, addStretch); +} + +bool TaskGroup::addWidget(QWidget *widget, bool addToLayout, bool addStretch) +{ + if (!widget) + return false; + + if (!addToLayout) + return true; + + if (addStretch) { + QHBoxLayout *hbl = new QHBoxLayout(); + hbl->setMargin(0); + hbl->setSpacing(0); + hbl->addWidget(widget); + hbl->addStretch(); + + groupLayout()->addLayout(hbl); + } + else { + groupLayout()->addWidget(widget); + } + + return true; +} + +QPixmap TaskGroup::transparentRender() +{ + QPixmap pm(size()); + pm.fill(Qt::transparent); + + render(&pm, QPoint(0,0), rect(), DrawChildren | IgnoreMask); + + return pm; +} + +void TaskGroup::paintEvent ( QPaintEvent * event ) +{ +// QPainter p(this); + +// p.setBrush(myScheme->groupBackground); + +// p.setPen(myScheme->groupBorder); +// p.drawRect(rect().adjusted(0,-(int)myHasHeader,-1,-1)); + + BaseClass::paintEvent(event); +} + +void TaskGroup::keyPressEvent ( QKeyEvent * event ) +{ + switch (event->key()) + { + case Qt::Key_Down: + { + QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab, 0); + QApplication::sendEvent(this, &ke); + return; + } + + case Qt::Key_Up: + { + QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier); + QApplication::sendEvent(this, &ke); + return; + } + + default:; + } + + BaseClass::keyPressEvent(event); +} + + +void TaskGroup::keyReleaseEvent ( QKeyEvent * event ) +{ + switch (event->key()) + { + case Qt::Key_Down: + { + QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, 0); + QApplication::sendEvent(this, &ke); + return; + } + + case Qt::Key_Up: + { + QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, Qt::ShiftModifier); + QApplication::sendEvent(this, &ke); + return; + } + + default:; + } + + BaseClass::keyReleaseEvent(event); +} + + +} diff --git a/src/Gui/QSint/actionpanel/taskgroup_p.h b/src/Gui/QSint/actionpanel/taskgroup_p.h new file mode 100644 index 000000000..5ab2ab939 --- /dev/null +++ b/src/Gui/QSint/actionpanel/taskgroup_p.h @@ -0,0 +1,48 @@ +#ifndef TASKGROUP_P_H +#define TASKGROUP_P_H + +#include "actionpanelscheme.h" +#include "actionlabel.h" + +#include +#include + + +namespace QSint +{ + + +class TaskGroup : public QFrame +{ + typedef QFrame BaseClass; + +public: + TaskGroup(QWidget *parent, bool hasHeader = false); + + void setScheme(ActionPanelScheme *scheme); + + inline QBoxLayout* groupLayout() + { + return (QBoxLayout*)layout(); + } + + bool addActionLabel(ActionLabel *label, bool addToLayout, bool addStretch); + + bool addWidget(QWidget *widget, bool addToLayout, bool addStretch); + + QPixmap transparentRender(); + +protected: + virtual void paintEvent ( QPaintEvent * event ); + virtual void keyPressEvent ( QKeyEvent * event ); + virtual void keyReleaseEvent ( QKeyEvent * event ); + + ActionPanelScheme *myScheme; + + bool myHasHeader; +}; + + +} + +#endif // TASKGROUP_P_H diff --git a/src/Gui/QSint/actionpanel/taskheader_p.cpp b/src/Gui/QSint/actionpanel/taskheader_p.cpp new file mode 100644 index 000000000..02032afbf --- /dev/null +++ b/src/Gui/QSint/actionpanel/taskheader_p.cpp @@ -0,0 +1,274 @@ +#include "taskheader_p.h" +#include "actionpanelscheme.h" +#include "actionlabel.h" + +#include +#include +#include + +#include +#include +#include +#include + + +namespace QSint +{ + + +TaskHeader::TaskHeader(const QIcon &icon, const QString &title, bool expandable, QWidget *parent) + : BaseClass(parent), + myExpandable(expandable), + m_over(false), + m_buttonOver(false), + m_fold(true), + m_opacity(0.1), + myButton(0) +{ + setProperty("class", "header"); + + myTitle = new ActionLabel(this); + myTitle->setProperty("class", "header"); + myTitle->setText(title); + myTitle->setIcon(icon); + myTitle->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); + + connect(myTitle, SIGNAL(clicked()), this, SLOT(fold())); + + QHBoxLayout *hbl = new QHBoxLayout(); + hbl->setMargin(2); + setLayout(hbl); + + hbl->addWidget(myTitle); + + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); + + setScheme(ActionPanelScheme::defaultScheme()); + //myTitle->setSchemePointer(&myLabelScheme); + + setExpandable(myExpandable); +} + +void TaskHeader::setExpandable(bool expandable) +{ + if (expandable) { + myExpandable = true; + + if (myButton) + return; + + myButton = new QLabel(this); + myButton->installEventFilter(this); + myButton->setFixedSize(myScheme->headerButtonSize); + layout()->addWidget(myButton); + changeIcons(); + + } else { + myExpandable = false; + + if (!myButton) + return; + + myButton->removeEventFilter(this); + myButton->setParent(0); + delete myButton; + myButton = 0; + changeIcons(); + } +} + +bool TaskHeader::eventFilter(QObject *obj, QEvent *event) +{ + switch (event->type()) { + case QEvent::MouseButtonPress: + if (myExpandable) + fold(); + return true; + + case QEvent::Enter: + m_buttonOver = true; + changeIcons(); + return true; + + case QEvent::Leave: + m_buttonOver = false; + changeIcons(); + return true; + + default:; + } + + return BaseClass::eventFilter(obj, event); +} + +void TaskHeader::setScheme(ActionPanelScheme *scheme) +{ + if (scheme) { + myScheme = scheme; + //myLabelScheme = &(scheme->headerLabelScheme); + setStyleSheet(myScheme->actionStyle); + + if (myExpandable) { + //setCursor(myLabelScheme->cursorOver ? Qt::PointingHandCursor : cursor()); + changeIcons(); + } + + setFixedHeight(scheme->headerSize); + + update(); + } +} + +void TaskHeader::paintEvent ( QPaintEvent * event ) +{ + QPainter p(this); + + if (myScheme->headerAnimation) + p.setOpacity(m_opacity+0.7); + +// p.setPen(m_over ? myScheme->headerBorderOver : myScheme->headerBorder); +// p.setBrush(m_over ? myScheme->headerBackgroundOver : myScheme->headerBackground); + +// myScheme->headerCorners.draw(&p, rect()); + + BaseClass::paintEvent(event); +} + +void TaskHeader::animate() +{ + if (!myScheme->headerAnimation) + return; + + if (!isEnabled()) { + m_opacity = 0.1; + update(); + return; + } + + if (m_over) { + if (m_opacity >= 0.3) { + m_opacity = 0.3; + return; + } + m_opacity += 0.05; + } else { + if (m_opacity <= 0.1) { + m_opacity = 0.1; + return; + } + m_opacity = qMax(0.1, m_opacity-0.05); + } + + QTimer::singleShot(100, this, SLOT(animate())); + update(); +} + +void TaskHeader::enterEvent ( QEvent * /*event*/ ) +{ + m_over = true; + + if (isEnabled()) + QTimer::singleShot(100, this, SLOT(animate())); + + update(); +} + +void TaskHeader::leaveEvent ( QEvent * /*event*/ ) +{ + m_over = false; + + if (isEnabled()) + QTimer::singleShot(100, this, SLOT(animate())); + + update(); +} + +void TaskHeader::fold() +{ + if (myExpandable) { + emit activated(); + + m_fold = !m_fold; + changeIcons(); + } +} + +void TaskHeader::changeIcons() +{ + if (!myButton) + return; + + if (m_buttonOver) + { + if (m_fold) + myButton->setPixmap(myScheme->headerButtonFoldOver); + else + myButton->setPixmap(myScheme->headerButtonUnfoldOver); + } else + { + if (m_fold) + myButton->setPixmap(myScheme->headerButtonFold); + else + myButton->setPixmap(myScheme->headerButtonUnfold); + } + + myButton->setFixedSize(myScheme->headerButtonSize); +} + +void TaskHeader::mouseReleaseEvent ( QMouseEvent * event ) +{ + if (event->button() == Qt::LeftButton) { + emit activated(); + } +} + +void TaskHeader::keyPressEvent ( QKeyEvent * event ) +{ + switch (event->key()) + { + case Qt::Key_Down: + { + QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab, 0); + QApplication::sendEvent(this, &ke); + return; + } + + case Qt::Key_Up: + { + QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier); + QApplication::sendEvent(this, &ke); + return; + } + + default:; + } + + BaseClass::keyPressEvent(event); +} + +void TaskHeader::keyReleaseEvent ( QKeyEvent * event ) +{ + switch (event->key()) + { + case Qt::Key_Down: + { + QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, 0); + QApplication::sendEvent(this, &ke); + return; + } + + case Qt::Key_Up: + { + QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, Qt::ShiftModifier); + QApplication::sendEvent(this, &ke); + return; + } + + default:; + } + + BaseClass::keyReleaseEvent(event); +} + + +} diff --git a/src/Gui/QSint/actionpanel/taskheader_p.h b/src/Gui/QSint/actionpanel/taskheader_p.h new file mode 100644 index 000000000..0cee4b50c --- /dev/null +++ b/src/Gui/QSint/actionpanel/taskheader_p.h @@ -0,0 +1,64 @@ +#ifndef TASKHEADER_P_H +#define TASKHEADER_P_H + +#include "actionpanelscheme.h" +#include "actionlabel.h" + +#include + + +namespace QSint +{ + + +class TaskHeader : public QFrame +{ + Q_OBJECT + + typedef QFrame BaseClass; + + friend class ActionGroup; + +public: + TaskHeader(const QIcon &icon, const QString &title, bool expandable, QWidget *parent = 0); + + inline bool expandable() const { return myExpandable; } + void setExpandable(bool expandable); + + void setScheme(ActionPanelScheme *scheme); + +Q_SIGNALS: + void activated(); + +public slots: + void fold(); + +protected Q_SLOTS: + void animate(); + +protected: + virtual void paintEvent ( QPaintEvent * event ); + virtual void enterEvent ( QEvent * event ); + virtual void leaveEvent ( QEvent * event ); + virtual void mouseReleaseEvent ( QMouseEvent * event ); + virtual void keyPressEvent ( QKeyEvent * event ); + virtual void keyReleaseEvent ( QKeyEvent * event ); + + bool eventFilter(QObject *obj, QEvent *event); + + void changeIcons(); + + ActionPanelScheme *myScheme; + + bool myExpandable; + bool m_over, m_buttonOver, m_fold; + double m_opacity; + + ActionLabel *myTitle; + QLabel *myButton; +}; + + +} + +#endif // TASKHEADER_P_H diff --git a/src/Gui/QSint/actionpanel/vista/Fold.png b/src/Gui/QSint/actionpanel/vista/Fold.png new file mode 100644 index 000000000..279ddda66 Binary files /dev/null and b/src/Gui/QSint/actionpanel/vista/Fold.png differ diff --git a/src/Gui/QSint/actionpanel/vista/FoldOver.png b/src/Gui/QSint/actionpanel/vista/FoldOver.png new file mode 100644 index 000000000..70cd655af Binary files /dev/null and b/src/Gui/QSint/actionpanel/vista/FoldOver.png differ diff --git a/src/Gui/QSint/actionpanel/vista/Unfold.png b/src/Gui/QSint/actionpanel/vista/Unfold.png new file mode 100644 index 000000000..6a812f3d2 Binary files /dev/null and b/src/Gui/QSint/actionpanel/vista/Unfold.png differ diff --git a/src/Gui/QSint/actionpanel/vista/UnfoldOver.png b/src/Gui/QSint/actionpanel/vista/UnfoldOver.png new file mode 100644 index 000000000..869c2b9c4 Binary files /dev/null and b/src/Gui/QSint/actionpanel/vista/UnfoldOver.png differ diff --git a/src/Gui/QSint/actionpanel/winvistapanelscheme.cpp b/src/Gui/QSint/actionpanel/winvistapanelscheme.cpp new file mode 100644 index 000000000..a3599b9ea --- /dev/null +++ b/src/Gui/QSint/actionpanel/winvistapanelscheme.cpp @@ -0,0 +1,86 @@ +#include "winvistapanelscheme.h" + + +namespace QSint +{ + + +const char* ActionPanelWinVistaStyle = + + "QFrame[class='panel'] {" + "background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #416FA6, stop: 1 #6BB86E);" + "}" + + "QSint--ActionGroup QFrame[class='header'] {" + "background: transparent;" + "border: 1px solid transparent;" + "}" + + "QSint--ActionGroup QFrame[class='header']:hover {" + "background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgba(249,253,255,100), stop: 0.5 rgba(234,247,255,20), stop: 1 rgba(249,253,255,100));" + "border: 1px solid transparent;" + "}" + + "QSint--ActionGroup QToolButton[class='header'] {" + "text-align: left;" + "color: #ffffff;" + "background-color: transparent;" + "border: 1px solid transparent;" + "font-size: 12px;" + "}" + + "QSint--ActionGroup QFrame[class='content'] {" + "background-color: transparent;" + "color: #ffffff;" + "}" + + "QSint--ActionGroup QToolButton[class='action'] {" + "background-color: transparent;" + "border: 1px solid transparent;" + "color: #ffffff;" + "text-align: left;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:!enabled {" + "color: #666666;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:hover {" + "color: #DAF2FC;" + "text-decoration: underline;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:focus {" + "border: 1px dotted black;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:on {" + "background-color: #ddeeff;" + "color: #006600;" + "}" +; + + +WinVistaPanelScheme::WinVistaPanelScheme() : ActionPanelScheme() +{ + headerSize = 25; + headerAnimation = false; + + //headerLabelScheme.iconSize = 22; + + headerButtonFold = QPixmap(":/vista/Fold.png"); + headerButtonFoldOver = QPixmap(":/vista/FoldOver.png"); + headerButtonUnfold = QPixmap(":/vista/Unfold.png"); + headerButtonUnfoldOver = QPixmap(":/vista/UnfoldOver.png"); + headerButtonSize = QSize(17,17); + + groupFoldSteps = 20; groupFoldDelay = 15; + groupFoldThaw = true; + groupFoldEffect = SlideFolding; + + actionStyle = QString(ActionPanelWinVistaStyle); +} + + +} + diff --git a/src/Gui/QSint/actionpanel/winvistapanelscheme.h b/src/Gui/QSint/actionpanel/winvistapanelscheme.h new file mode 100644 index 000000000..94f469b40 --- /dev/null +++ b/src/Gui/QSint/actionpanel/winvistapanelscheme.h @@ -0,0 +1,34 @@ +#ifndef WINVISTAPANELSCHEME_H +#define WINVISTAPANELSCHEME_H + + +#include "actionpanelscheme.h" + + +namespace QSint +{ + + +/** + \brief Windows Vista-like color scheme for ActionPanel and ActionGroup. + \since 0.2 + + \image html ActionPanel4.png Example of the scheme +*/ +class WinVistaPanelScheme : public ActionPanelScheme +{ +public: + WinVistaPanelScheme(); + + static ActionPanelScheme* defaultScheme() + { + static WinVistaPanelScheme scheme; + return &scheme; + } +}; + + +} + + +#endif // WINVISTAPANELSCHEME_H diff --git a/src/Gui/QSint/actionpanel/winxppanelscheme.cpp b/src/Gui/QSint/actionpanel/winxppanelscheme.cpp new file mode 100644 index 000000000..6449ce759 --- /dev/null +++ b/src/Gui/QSint/actionpanel/winxppanelscheme.cpp @@ -0,0 +1,170 @@ +#include "winxppanelscheme.h" + + +namespace QSint +{ + + +const char* ActionPanelWinXPBlueStyle1 = + + "QFrame[class='panel'] {" + "background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #7ba2e7, stop: 1 #6375d6);" + "}" + + "QSint--ActionGroup QFrame[class='header'] {" + "background-color: #225aca;" + "border: 1px solid #225aca;" + "border-top-left-radius: 4px;" + "border-top-right-radius: 4px;" + "}" + + "QSint--ActionGroup QToolButton[class='header'] {" + "text-align: left;" + "color: #ffffff;" + "background-color: transparent;" + "border: 1px solid transparent;" + "font-weight: bold;" + "}" + + "QSint--ActionGroup QToolButton[class='header']:hover {" + "color: #428eff;" + "}" + + "QSint--ActionGroup QFrame[class='content'] {" + "background-color: #eff3ff;" + "border: 1px solid #ffffff;" + "}" + + "QSint--ActionGroup QFrame[class='content'][header='true'] {" + "border-top: none;" + "}" + + "QSint--ActionGroup QToolButton[class='action'] {" + "background-color: transparent;" + "border: 1px solid transparent;" + "color: #215dc6;" + "text-align: left;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:!enabled {" + "color: #999999;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:hover {" + "color: #428eff;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:focus {" + "border: 1px dotted black;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:on {" + "background-color: #ddeeff;" + "color: #006600;" + "}" +; + +const char* ActionPanelWinXPBlueStyle2 = + + "QFrame[class='panel'] {" + "background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #7ba2e7, stop: 1 #6375d6);" + "}" + + "QSint--ActionGroup QFrame[class='header'] {" + "border: 1px solid #ffffff;" + "border-top-left-radius: 4px;" + "border-top-right-radius: 4px;" + "background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffffff, stop: 1 #c6d3f7);" + "}" + + "QSint--ActionGroup QToolButton[class='header'] {" + "text-align: left;" + "color: #215dc6;" + "background-color: transparent;" + "border: 1px solid transparent;" + "font-weight: bold;" + "}" + + "QSint--ActionGroup QToolButton[class='header']:hover {" + "color: #428eff;" + "}" + + "QSint--ActionGroup QFrame[class='content'] {" + "background-color: #d6dff7;" + "border: 1px solid #ffffff;" + "}" + + "QSint--ActionGroup QFrame[class='content'][header='true'] {" + "border-top: none;" + "}" + + "QSint--ActionGroup QToolButton[class='action'] {" + "background-color: transparent;" + "border: 1px solid transparent;" + "color: #215dc6;" + "text-align: left;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:!enabled {" + "color: #999999;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:hover {" + "color: #428eff;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:focus {" + "border: 1px dotted black;" + "}" + + "QSint--ActionGroup QToolButton[class='action']:on {" + "background-color: #ddeeff;" + "color: #006600;" + "}" + ; + + + +WinXPPanelScheme::WinXPPanelScheme() : ActionPanelScheme() +{ + headerSize = 25; + headerAnimation = false; + + //headerLabelScheme.iconSize = 22; + + headerButtonFold = QPixmap(":/xp/Fold_Blue1.png"); + headerButtonFoldOver = QPixmap(":/xp/FoldOver_Blue1.png"); + headerButtonUnfold = QPixmap(":/xp/Unfold_Blue1.png"); + headerButtonUnfoldOver = QPixmap(":/xp/UnfoldOver_Blue1.png"); + headerButtonSize = QSize(17,17); + + groupFoldSteps = 20; groupFoldDelay = 15; + groupFoldThaw = true; + groupFoldEffect = SlideFolding; + + actionStyle = QString(ActionPanelWinXPBlueStyle1); +} + + +WinXPPanelScheme2::WinXPPanelScheme2() : ActionPanelScheme() +{ + headerSize = 25; + headerAnimation = false; + +// headerLabelScheme.iconSize = 22; + + headerButtonFold = QPixmap(":/xp/Fold_Blue2.png"); + headerButtonFoldOver = QPixmap(":/xp/FoldOver_Blue2.png"); + headerButtonUnfold = QPixmap(":/xp/Unfold_Blue2.png"); + headerButtonUnfoldOver = QPixmap(":/xp/UnfoldOver_Blue2.png"); + headerButtonSize = QSize(17,17); + + groupFoldSteps = 20; groupFoldDelay = 15; + groupFoldThaw = true; + groupFoldEffect = SlideFolding; + + actionStyle = QString(ActionPanelWinXPBlueStyle2); +} + + +} diff --git a/src/Gui/QSint/actionpanel/winxppanelscheme.h b/src/Gui/QSint/actionpanel/winxppanelscheme.h new file mode 100644 index 000000000..c6171ae74 --- /dev/null +++ b/src/Gui/QSint/actionpanel/winxppanelscheme.h @@ -0,0 +1,51 @@ +#ifndef WinXPPanelScheme_H +#define WinXPPanelScheme_H + +#include "actionpanelscheme.h" + + +namespace QSint +{ + + +/** + \brief WindowsXP-like blue color scheme for ActionPanel and ActionGroup. + \since 0.2 + + \image html ActionPanel2.png Example of the scheme +*/ +class WinXPPanelScheme : public ActionPanelScheme +{ +public: + WinXPPanelScheme(); + + static ActionPanelScheme* defaultScheme() + { + static WinXPPanelScheme scheme; + return &scheme; + } +}; + + +/** + \brief WindowsXP-like blue color scheme for ActionPanel and ActionGroup (variation 2). + \since 0.2 + + \image html ActionPanel3.png Example of the scheme +*/ +class WinXPPanelScheme2 : public ActionPanelScheme +{ +public: + WinXPPanelScheme2(); + + static ActionPanelScheme* defaultScheme() + { + static WinXPPanelScheme2 scheme; + return &scheme; + } +}; + + +} + +#endif // WinXPPanelScheme_H diff --git a/src/Gui/QSint/actionpanel/xp/FoldOver_Blue1.png b/src/Gui/QSint/actionpanel/xp/FoldOver_Blue1.png new file mode 100644 index 000000000..176b728b3 Binary files /dev/null and b/src/Gui/QSint/actionpanel/xp/FoldOver_Blue1.png differ diff --git a/src/Gui/QSint/actionpanel/xp/FoldOver_Blue2.png b/src/Gui/QSint/actionpanel/xp/FoldOver_Blue2.png new file mode 100644 index 000000000..0be4eb493 Binary files /dev/null and b/src/Gui/QSint/actionpanel/xp/FoldOver_Blue2.png differ diff --git a/src/Gui/QSint/actionpanel/xp/Fold_Blue1.png b/src/Gui/QSint/actionpanel/xp/Fold_Blue1.png new file mode 100644 index 000000000..539a40eb7 Binary files /dev/null and b/src/Gui/QSint/actionpanel/xp/Fold_Blue1.png differ diff --git a/src/Gui/QSint/actionpanel/xp/Fold_Blue2.png b/src/Gui/QSint/actionpanel/xp/Fold_Blue2.png new file mode 100644 index 000000000..8614ec99e Binary files /dev/null and b/src/Gui/QSint/actionpanel/xp/Fold_Blue2.png differ diff --git a/src/Gui/QSint/actionpanel/xp/UnfoldOver_Blue1.png b/src/Gui/QSint/actionpanel/xp/UnfoldOver_Blue1.png new file mode 100644 index 000000000..902f73acf Binary files /dev/null and b/src/Gui/QSint/actionpanel/xp/UnfoldOver_Blue1.png differ diff --git a/src/Gui/QSint/actionpanel/xp/UnfoldOver_Blue2.png b/src/Gui/QSint/actionpanel/xp/UnfoldOver_Blue2.png new file mode 100644 index 000000000..a3b534d7f Binary files /dev/null and b/src/Gui/QSint/actionpanel/xp/UnfoldOver_Blue2.png differ diff --git a/src/Gui/QSint/actionpanel/xp/Unfold_Blue1.png b/src/Gui/QSint/actionpanel/xp/Unfold_Blue1.png new file mode 100644 index 000000000..0d9819b4e Binary files /dev/null and b/src/Gui/QSint/actionpanel/xp/Unfold_Blue1.png differ diff --git a/src/Gui/QSint/actionpanel/xp/Unfold_Blue2.png b/src/Gui/QSint/actionpanel/xp/Unfold_Blue2.png new file mode 100644 index 000000000..696c96851 Binary files /dev/null and b/src/Gui/QSint/actionpanel/xp/Unfold_Blue2.png differ diff --git a/src/Gui/QSint/include/QSint b/src/Gui/QSint/include/QSint new file mode 100644 index 000000000..e648c7fc3 --- /dev/null +++ b/src/Gui/QSint/include/QSint @@ -0,0 +1,9 @@ +#include "../actionpanel/actionlabel.h" +#include "../actionpanel/actionbox.h" +#include "../actionpanel/actiongroup.h" +#include "../actionpanel/actionpanel.h" +#include "../actionpanel/actionpanelscheme.h" +#include "../actionpanel/winxppanelscheme.h" +#include "../actionpanel/winvistapanelscheme.h" +#include "../actionpanel/macpanelscheme.h" +#include "../actionpanel/androidpanelscheme.h"