+++ /dev/null
-#include "thaction.h"
-
-/* ============================================================================
- * PRIVATE Class
- */
-class THAction::Private {
- public:
- bool isHovered;
- bool isChecked;
- QString text;
- QIcon icon;
-};
-
-/* ============================================================================
- * PUBLIC Constructor/Destructors
- */
-THAction::THAction (QObject *parent)
- : QObject(parent), d(new THAction::Private)
-{
- d->isHovered = false;
- d->isChecked = false;
-}
-
-THAction::THAction (const QString& text, QObject *parent)
- : QObject(parent), d(new THAction::Private)
-{
- d->isHovered = false;
- d->isChecked = false;
- d->text = text;
-}
-
-THAction::THAction (const QIcon& icon, const QString& text, QObject *parent)
- : QObject(parent), d(new THAction::Private)
-{
- d->isHovered = false;
- d->isChecked = false;
- d->icon = icon;
- d->text = text;
-}
-
-THAction::~THAction() {
- delete d;
-}
-
-/* ============================================================================
- * PUBLIC Properties
- */
-bool THAction::isChecked (void) const {
- return(d->isChecked);
-}
-
-bool THAction::isHovered (void) const {
- return(d->isHovered);
-}
-
-QIcon THAction::icon (void) const {
- return(d->icon);
-}
-
-void THAction::setIcon (const QIcon& icon) {
- d->icon = icon;
-}
-
-
-QString THAction::text (void) const {
- return(d->text);
-}
-
-void THAction::setText (const QString& text) {
- d->text = text;
-}
-
-/* ============================================================================
- * PUBLIC SLOTS
- */
-void THAction::hover (bool isHovered) {
- d->isHovered = isHovered;
- if (d->isHovered) emit hovered();
-}
-
-void THAction::toggle (void) {
- emit toggled(d->isChecked);
-}
-
-void THAction::trigger (void) {
- emit triggered(d->isChecked);
-}
-
-void THAction::setChecked (bool checked) {
- d->isChecked = checked;
-}
+++ /dev/null
-#ifndef _THACTION_H_
-#define _THACTION_H_
-
-#include <QObject>
-#include <QIcon>
-
-class THAction : public QObject {
- Q_OBJECT
-
- Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
- Q_PROPERTY(QString text READ text WRITE setText)
-
- public:
- THAction (QObject *parent = 0);
- THAction (const QString& text, QObject *parent = 0);
- THAction (const QIcon& icon, const QString& text, QObject *parent = 0);
- ~THAction();
-
- signals:
- void triggered (bool checked = false);
- void toggled (bool checked);
- void hovered (void);
-
- public:
- bool isChecked (void) const;
- bool isHovered (void) const;
-
- QIcon icon (void) const;
- void setIcon (const QIcon& icon);
-
- QString text (void) const;
- void setText (const QString& text);
-
- public slots:
- void toggle (void);
- void trigger (void);
- void hover (bool isHovered = false);
- void setChecked (bool checked);
-
- private:
- class Private;
- Private *d;
-};
-
-#endif /* !_THACTION_H_ */
-
+++ /dev/null
-#include <QList>
-
-#include "thactiongroup.h"
-#include "thaction.h"
-
-/* ============================================================================
- * PRIVATE Class
- */
-class THActionGroup::Private {
- public:
- QList<THAction *> actionList;
- QString name;
-};
-
-/* ============================================================================
- * PUBLIC Constructor/Destructors
- */
-THActionGroup::THActionGroup (QObject *parent)
- : QObject(parent), d(new THActionGroup::Private)
-{
-}
-
-THActionGroup::THActionGroup (const QString& name, QObject *parent)
- : QObject(parent), d(new THActionGroup::Private)
-{
- d->name = name;
-}
-
-THActionGroup::~THActionGroup() {
- delete d;
-}
-
-/* ============================================================================
- * PUBLIC Methods
- */
-THAction *THActionGroup::addAction (THAction *action) {
- d->actionList.append(action);
- return(action);
-}
-
-THAction *THActionGroup::addAction (const QString& text) {
- THAction *action = new THAction(text, this);
- d->actionList.append(action);
- return(action);
-}
-
-THAction *THActionGroup::addAction (const QIcon& icon, const QString& text) {
- THAction *action = new THAction(icon, text, this);
- d->actionList.append(action);
- return(action);
-}
-
-/* ============================================================================
- * PUBLIC Properties
- */
-QString THActionGroup::name (void) const {
- return(d->name);
-}
-
-void THActionGroup::setName (const QString& name) {
- d->name = name;
-}
-
+++ /dev/null
-#ifndef _THACTIONGROUP_H_
-#define _THACTIONGROUP_H_
-
-#include <QObject>
-#include <QIcon>
-class THAction;
-
-class THActionGroup : public QObject {
- Q_OBJECT
-
- public:
- THActionGroup (QObject *parent = 0);
- THActionGroup (const QString& name, QObject *parent = 0);
- ~THActionGroup();
-
- public:
- THAction *addAction (THAction *action);
- THAction *addAction (const QString& text);
- THAction *addAction (const QIcon& icon, const QString& text);
-
- QString name (void) const;
- void setName (const QString& name);
-
- private:
- class Private;
- Private *d;
-};
-
-#endif /* !_THACTIONGROUP_H_ */
-