kdeui Library API Documentation

kedittoolbar.h

00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2000 Kurt Granroth <granroth@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00016 Boston, MA 02111-1307, USA. 00017 */ 00018 #ifndef _KEDITTOOLBAR_H 00019 #define _KEDITTOOLBAR_H 00020 00021 #include <qwidget.h> 00022 #include <kxmlguiclient.h> 00023 #include <kdialogbase.h> 00024 00025 class KActionCollection; 00026 class QComboBox; 00027 class QToolButton; 00028 class KListView; 00029 class QListViewItem; 00030 00031 class KEditToolbarWidget; 00032 class KEditToolbarPrivate; 00033 class KEditToolbarWidgetPrivate; 00034 00035 00036 namespace 00037 { 00038 class ToolbarItem; 00039 class ToolbarListView; 00040 } 00041 00112 class KEditToolbar : public KDialogBase 00113 { 00114 Q_OBJECT 00115 public: 00146 KEditToolbar(KActionCollection *collection, 00147 const QString& xmlfile = QString::null, bool global = true, 00148 QWidget* parent = 0, const char* name = 0); 00149 00150 //KDE 4.0: merge the two constructors 00151 /* Constructor for apps that do not use components, which has an extra argument 00152 * specifying the toolbar to be shown. 00153 * @param defaultToolbar The toolbar with this name will appear for editing. 00154 * @param collection The collection of actions to work on. 00155 * @param xmlfile The application's local resource file. 00156 * @param global If @p true, then the global resource file will also 00157 * be parsed. 00158 * @param parent The parent of the dialog. 00159 * @param name An internal name. 00160 * @since 3.2 00161 */ 00162 KEditToolbar(const QString& defaultToolbar, KActionCollection *collection, 00163 const QString& xmlfile = QString::null, bool global = true, 00164 QWidget* parent = 0, const char* name = 0); 00188 KEditToolbar(KXMLGUIFactory* factory, QWidget* parent = 0, const char* name = 0); 00189 00190 //KDE 4.0: merge the two constructors 00191 /* Constructor for KParts based apps, which has an extra argument 00192 * specifying the toolbar to be shown. 00193 * 00194 * @param defaultToolbar The toolbar with this name will appear for editing. 00195 * @param factory Your application's factory object 00196 * @param parent The usual parent for the dialog. 00197 * @param name An internal name. 00198 * @since 3.2 00199 */ 00200 KEditToolbar(const QString& defaultToolbar, KXMLGUIFactory* factory, 00201 QWidget* parent = 0, const char* name = 0); 00202 00204 ~KEditToolbar(); 00205 00206 protected slots: 00210 virtual void slotOk(); 00214 virtual void slotApply(); 00215 00219 void acceptOK(bool b); 00220 00221 signals: 00227 void newToolbarConfig(); 00228 00229 private: 00230 void init(); 00231 KEditToolbarWidget *m_widget; 00232 protected: 00233 virtual void virtual_hook( int id, void* data ); 00234 private: 00235 KEditToolbarPrivate *d; 00236 }; 00237 00258 class KEditToolbarWidget : public QWidget, virtual public KXMLGUIClient 00259 { 00260 Q_OBJECT 00261 public: 00291 KEditToolbarWidget(KActionCollection *collection, 00292 const QString& xmlfile = QString::null, 00293 bool global = true, QWidget *parent = 0L); 00294 00295 //KDE 4.0: merge the two constructors 00296 /* Same as above, with an extra agrument specifying the toolbar to be shown. 00297 * 00298 * @param defaultToolbar The toolbar with this name will appear for editing. 00299 * @param collection The collection of actions to work on 00300 * @param xmlfile The application's local resource file 00301 * @param global If true, then the global resource file will also 00302 * be parsed 00303 * @param parent This widget's parent 00304 * @since 3.2 00305 */ 00306 KEditToolbarWidget(const QString& defaultToolbar, 00307 KActionCollection *collection, 00308 const QString& file = QString::null, 00309 bool global = true, 00310 QWidget *parent = 0L); 00311 00332 KEditToolbarWidget(KXMLGUIFactory* factory, QWidget *parent = 0L); 00333 00334 //KDE 4.0: merge the two constructors 00335 /* Same as above, with an extra agrument specifying the toolbar to be shown. 00336 * 00337 * 00338 * @param defaultToolbar The toolbar with this name will appear for editing. 00339 * @param factory Your application's factory object 00340 * @param parent This widget's parent 00341 * @since 3.2 00342 */ 00343 KEditToolbarWidget(const QString& defaultToolbar, 00344 KXMLGUIFactory* factory, 00345 QWidget *parent = 0L); 00346 00352 virtual ~KEditToolbarWidget(); 00353 00357 virtual KActionCollection *actionCollection() const; 00358 00367 bool save(); 00368 00369 signals: 00373 void enableOk(bool); 00374 00375 protected slots: 00376 void slotToolbarSelected(const QString& text); 00377 00378 void slotInactiveSelected(QListViewItem *item); 00379 void slotActiveSelected(QListViewItem *item); 00380 00381 void slotDropped(KListView *list, QDropEvent *e, QListViewItem *after); 00382 void insertActive(ToolbarItem *item, QListViewItem *before, bool prepend = false); 00383 void removeActive(ToolbarItem *item); 00384 void slotInsertButton(); 00385 void slotRemoveButton(); 00386 void slotUpButton(); 00387 void slotDownButton(); 00388 00389 protected: 00390 void setupLayout(); 00391 00392 void initNonKPart(KActionCollection *collection, const QString& file, bool global); 00393 void initKPart(KXMLGUIFactory* factory); 00394 void loadToolbarCombo(const QString& defaultToolbar = QString::null); 00395 void loadActionList(QDomElement& elem); 00396 void updateLocal(QDomElement& elem); 00397 00398 private: 00399 ToolbarListView *m_inactiveList; 00400 ToolbarListView *m_activeList; 00401 QComboBox *m_toolbarCombo; 00402 00403 QToolButton *m_upAction; 00404 QToolButton *m_removeAction; 00405 QToolButton *m_insertAction; 00406 QToolButton *m_downAction; 00407 00408 protected: 00409 virtual void virtual_hook( int id, void* data ); 00410 private: 00411 KEditToolbarWidgetPrivate *d; 00412 }; 00413 00414 #endif // _KEDITTOOLBAR_H
KDE Logo
This file is part of the documentation for kdeui Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 10 18:55:08 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003