• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Applets

menuview.h

Go to the documentation of this file.
00001 /*
00002     Copyright 2007 Robert Knight <robertknight@gmail.com>
00003     Copyright 2008 Sebastian Sauer <mail@dipe.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef MENUVIEW_H
00022 #define MENUVIEW_H
00023 
00024 // Qt
00025 #include <QModelIndex>
00026 
00027 // KDE
00028 #include <KMenu>
00029 
00030 class QAbstractItemModel;
00031 
00032 namespace Kickoff
00033 {
00034 
00035 class UrlItemLauncher;
00036 
00051 class MenuView : public KMenu 
00052 {
00053 Q_OBJECT
00054 public:
00055 
00057     MenuView(QWidget *parent = 0);
00059     virtual ~MenuView();
00060 
00062     void setModel(QAbstractItemModel *model);
00064     QAbstractItemModel *model() const;
00065 
00067     UrlItemLauncher *launcher() const;
00068 
00070     QModelIndex indexForAction(QAction *action) const;
00078     QAction *actionForIndex(const QModelIndex& index) const;
00079 
00081     void setColumn(int column);
00083     int column() const;
00084 
00086     enum FormatType {
00087         Name = 0, 
00088         Description, 
00089         NameDescription, 
00090         DescriptionName 
00091     };
00093     FormatType formatType() const;
00095     void setFormatType(FormatType formattype);
00096 
00097 protected:
00098 
00108     virtual QAction *createLeafAction(const QModelIndex& index,QObject *parent);
00109 
00118     virtual void updateAction(QAction *action, const QModelIndex& index);
00119 
00120     // reimplemented
00121     virtual bool eventFilter(QObject * watched, QEvent *event);
00122 
00123 public Q_SLOTS:
00124     // an item in the menu got triggered
00125     void actionTriggered(QAction* action);
00126 
00127 private Q_SLOTS:
00128     // new items are about to be inserted into the model
00129     void rowsAboutToBeInserted(const QModelIndex& parent,int start,int end);
00130     // existing items are about to be removed from the model
00131     void rowsAboutToBeRemoved(const QModelIndex& parent,int start,int end);
00132     // data within an item of the model change
00133     void dataChanged(const QModelIndex& topLeft,const QModelIndex& bottomRight);
00134     // the model did reset itself and all items are invalid
00135     void modelReset();
00136     // called shortly before the menu will be shown to the user
00137     void aboutToShow();
00138     // performs on-demand filling of sub-menus in the tree
00139     void fillSubMenu();
00140 
00141 private:
00142     class Private;
00143     Private * const d;
00144 };
00145 
00146 }
00147 
00148 #endif // MENUVIEW_H
00149 

Applets

Skip menu "Applets"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal