diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | e2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch) | |
tree | 9047cf9e6b5c43878d5bf82660adae77ceee097a /arts/builder/menumaker.h | |
download | tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.tar.gz tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'arts/builder/menumaker.h')
-rw-r--r-- | arts/builder/menumaker.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/arts/builder/menumaker.h b/arts/builder/menumaker.h new file mode 100644 index 00000000..5b999dc5 --- /dev/null +++ b/arts/builder/menumaker.h @@ -0,0 +1,70 @@ +#ifndef __MENUMAKER_H__ +#define __MENUMAKER_H__ + +#include <kaction.h> +#include <qobject.h> +#include <string> +#include <list> + +class MenuMaker; + +class MenuEntry : public QObject +{ + Q_OBJECT + +protected: + MenuMaker *menumaker; + KAction *action; + QCString text; + +public: + MenuEntry(MenuMaker *menumaker, KActionMenu *parent, const char *text); + +public slots: + void activated(); +}; + +class MenuCategory +{ +protected: + KActionMenu *_menu; + QString _name; + std::list<std::string> prefixList; + bool _catchall; + +public: + MenuCategory(const QString& name, const char *prefix, KActionMenu *menu); + + void addPrefix(const char *prefix); + QString name(); + KActionMenu *menu(); + + bool catchall(); + bool matches(const char *item); +}; + +class MenuMaker :public QObject +{ + Q_OBJECT + + std::list<MenuCategory *> categories; +public: + enum { CAT_MAGIC_ID = 10000 }; + + MenuMaker(KActionMenu *root); + + void addCategory(const QString& name, const char *prefix); + MenuCategory *lookupCategoryByName(const QString& name); + void addItem(const char *name, int i); + QString basename(const QString& name); + QString catname(const QString& name); + + void clear(); + + const char *findID(int id); + + void menuActivated(const char *text); +signals: + void activated(const char *text); +}; +#endif |