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

kdeui

kedittoolbar.h

Go to the documentation of this file.
00001 // -*- mode: c++; c-basic-offset: 2 -*-
00002 /* This file is part of the KDE libraries
00003    Copyright (C) 2000 Kurt Granroth <granroth@kde.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 version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 #ifndef _KEDITTOOLBAR_H
00020 #define _KEDITTOOLBAR_H
00021 
00022 #include <qwidget.h>
00023 #include <kxmlguiclient.h>
00024 #include <kdialogbase.h>
00025 
00026 class KProcess;
00027 class KActionCollection;
00028 class QComboBox;
00029 class QToolButton;
00030 class KListView;
00031 class QListViewItem;
00032 
00033 class KEditToolbarWidget;
00034 class KEditToolbarPrivate;
00035 class KEditToolbarWidgetPrivate;
00036 namespace
00037 {
00038   class ToolbarItem;
00039   class ToolbarListView;
00040 }
00110 class KDEUI_EXPORT KEditToolbar : public KDialogBase
00111 {
00112     Q_OBJECT
00113 public:
00144   KEditToolbar(KActionCollection *collection,
00145                const QString& xmlfile = QString::null, bool global = true,
00146                QWidget* parent = 0, const char* name = 0);
00147 
00148   //KDE 4.0: merge the two constructors
00149   /* Constructor for apps that do not use components, which has an extra argument
00150    * specifying the toolbar to be shown.
00151    * @param defaultToolbar The toolbar with this name will appear for editing.
00152    * @param collection The collection of actions to work on.
00153    * @param xmlfile The application's local resource file.
00154    * @param global If @p true, then the global resource file will also
00155    *               be parsed.
00156    * @param parent The parent of the dialog.
00157    * @param name An internal name.
00158    * @since 3.2
00159    */
00160   KEditToolbar(const QString& defaultToolbar, KActionCollection *collection,
00161                const QString& xmlfile = QString::null, bool global = true,
00162                QWidget* parent = 0, const char* name = 0);
00186   KEditToolbar(KXMLGUIFactory* factory, QWidget* parent = 0, const char* name = 0);
00187 
00188   //KDE 4.0: merge the two constructors
00198   KEditToolbar(const QString& defaultToolbar, KXMLGUIFactory* factory,
00199                QWidget* parent = 0, const char* name = 0);
00200 
00202   ~KEditToolbar();
00203 
00209   static void setDefaultToolbar(const char *toolbarName);
00210 
00211 protected slots:
00215   virtual void slotOk();
00219   virtual void slotApply();
00220 
00224   void acceptOK(bool b);
00225 
00229   void slotDefault();
00230 
00231 signals:
00237   void newToolbarConfig();
00238 
00239 private:
00240   void init();
00241   KEditToolbarWidget *m_widget;
00242 protected:
00243   virtual void virtual_hook( int id, void* data );
00244 private:
00245   KEditToolbarPrivate *d;
00246 
00247   static const char *s_defaultToolbar;
00248 };
00249 
00250 
00270 class KDEUI_EXPORT KEditToolbarWidget : public QWidget, virtual public KXMLGUIClient
00271 {
00272   Q_OBJECT
00273 public:
00303   KEditToolbarWidget(KActionCollection *collection,
00304                      const QString& xmlfile = QString::null,
00305                      bool global = true, QWidget *parent = 0L);
00306 
00307    //KDE 4.0: merge the two constructors
00308    /* Same as above, with an extra agrument specifying the toolbar to be shown.
00309    *
00310    * @param defaultToolbar The toolbar with this name will appear for editing.
00311    * @param collection The collection of actions to work on
00312    * @param xmlfile The application's local resource file
00313    * @param global If true, then the global resource file will also
00314    *               be parsed
00315    * @param parent This widget's parent
00316    * @since 3.2
00317    */
00318   KEditToolbarWidget(const QString& defaultToolbar,
00319                      KActionCollection *collection,
00320                      const QString& file = QString::null,
00321                      bool global = true,
00322                      QWidget *parent = 0L);
00323 
00344   KEditToolbarWidget(KXMLGUIFactory* factory, QWidget *parent = 0L);
00345 
00346    //KDE 4.0: merge the two constructors
00347    /* Same as above, with an extra agrument specifying the toolbar to be shown.
00348    *
00349    *
00350    * @param defaultToolbar The toolbar with this name will appear for editing.
00351    * @param factory Your application's factory object
00352    * @param parent This widget's parent
00353    * @since 3.2
00354    */
00355   KEditToolbarWidget(const QString& defaultToolbar,
00356                      KXMLGUIFactory* factory,
00357                      QWidget *parent = 0L);
00358 
00364   virtual ~KEditToolbarWidget();
00365 
00369   virtual KActionCollection *actionCollection() const;
00370 
00379   bool save();
00380 
00385   void rebuildKXMLGUIClients();
00386 
00387 signals:
00391   void enableOk(bool);
00392 
00393 protected slots:
00394   void slotToolbarSelected(const QString& text);
00395 
00396   void slotInactiveSelected(QListViewItem *item);
00397   void slotActiveSelected(QListViewItem *item);
00398 
00399   void slotDropped(KListView *list, QDropEvent *e, QListViewItem *after);
00400 
00401   void slotInsertButton();
00402   void slotRemoveButton();
00403   void slotUpButton();
00404   void slotDownButton();
00405 
00406   void slotChangeIcon();
00407 
00408 private slots:
00409   void slotProcessExited( KProcess* );
00410 
00411 protected: // KDE4: make private
00412   void setupLayout();
00413 
00414   void insertActive(ToolbarItem *item, QListViewItem *before, bool prepend = false);
00415   void removeActive(ToolbarItem *item);
00416   void moveActive(ToolbarItem *item, QListViewItem *before);
00417   void initNonKPart(KActionCollection *collection, const QString& file, bool global);
00418   void initKPart(KXMLGUIFactory* factory);
00419   void loadToolbarCombo(const QString& defaultToolbar = QString::null);
00420   void loadActionList(QDomElement& elem);
00421   void updateLocal(QDomElement& elem);
00422 
00423 private:
00424   ToolbarListView *m_inactiveList;
00425   ToolbarListView *m_activeList;
00426   QComboBox *m_toolbarCombo;
00427 
00428   QToolButton *m_upAction;
00429   QToolButton *m_removeAction;
00430   QToolButton *m_insertAction;
00431   QToolButton *m_downAction;
00432 
00433 protected:
00434   virtual void virtual_hook( int id, void* data );
00435 private:
00436   KEditToolbarWidgetPrivate *d;
00437 };
00438 
00439 #endif // _KEDITTOOLBAR_H

kdeui

Skip menu "kdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
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