kedittoolbar.h
// -*- mode: c++; c-basic-offset: 2 -*-
/* This file is part of the KDE libraries
Copyright (C) 2000 Kurt Granroth <granroth@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KEDITTOOLBAR_H
#define _KEDITTOOLBAR_H
#include <qwidget.h>
#include <kxmlguiclient.h>
#include <kdialogbase.h>
class KProcess;
class KActionCollection;
class QComboBox;
class QToolButton;
class KListView;
class QListViewItem;
class KEditToolbarWidget;
class KEditToolbarPrivate;
class KEditToolbarWidgetPrivate;
namespace
{
class ToolbarItem;
class ToolbarListView;
}
class KDEUI_EXPORT KEditToolbar : public KDialogBase
{
Q_OBJECT
public:
KEditToolbar(KActionCollection *collection,
const QString& xmlfile = QString::null, bool global = true,
QWidget* parent = 0, const char* name = 0);
//KDE 4.0: merge the two constructors
/* Constructor for apps that do not use components, which has an extra argument
* specifying the toolbar to be shown.
* @param defaultToolbar The toolbar with this name will appear for editing.
* @param collection The collection of actions to work on.
* @param xmlfile The application's local resource file.
* @param global If @p true, then the global resource file will also
* be parsed.
* @param parent The parent of the dialog.
* @param name An internal name.
* @since 3.2
*/
KEditToolbar(const QString& defaultToolbar, KActionCollection *collection,
const QString& xmlfile = QString::null, bool global = true,
QWidget* parent = 0, const char* name = 0);
KEditToolbar(KXMLGUIFactory* factory, QWidget* parent = 0, const char* name = 0);
//KDE 4.0: merge the two constructors
KEditToolbar(const QString& defaultToolbar, KXMLGUIFactory* factory,
QWidget* parent = 0, const char* name = 0);
~KEditToolbar();
static void setDefaultToolbar(const char *toolbarName);
protected slots:
virtual void slotOk();
virtual void slotApply();
void acceptOK(bool b);
void slotDefault();
signals:
void newToolbarConfig();
private:
void init();
KEditToolbarWidget *m_widget;
protected:
virtual void virtual_hook( int id, void* data );
private:
KEditToolbarPrivate *d;
static const char *s_defaultToolbar;
};
class KDEUI_EXPORT KEditToolbarWidget : public QWidget, virtual public KXMLGUIClient
{
Q_OBJECT
public:
KEditToolbarWidget(KActionCollection *collection,
const QString& xmlfile = QString::null,
bool global = true, QWidget *parent = 0L);
//KDE 4.0: merge the two constructors
/* Same as above, with an extra agrument specifying the toolbar to be shown.
*
* @param defaultToolbar The toolbar with this name will appear for editing.
* @param collection The collection of actions to work on
* @param xmlfile The application's local resource file
* @param global If true, then the global resource file will also
* be parsed
* @param parent This widget's parent
* @since 3.2
*/
KEditToolbarWidget(const QString& defaultToolbar,
KActionCollection *collection,
const QString& file = QString::null,
bool global = true,
QWidget *parent = 0L);
KEditToolbarWidget(KXMLGUIFactory* factory, QWidget *parent = 0L);
//KDE 4.0: merge the two constructors
/* Same as above, with an extra agrument specifying the toolbar to be shown.
*
*
* @param defaultToolbar The toolbar with this name will appear for editing.
* @param factory Your application's factory object
* @param parent This widget's parent
* @since 3.2
*/
KEditToolbarWidget(const QString& defaultToolbar,
KXMLGUIFactory* factory,
QWidget *parent = 0L);
virtual ~KEditToolbarWidget();
virtual KActionCollection *actionCollection() const;
bool save();
void rebuildKXMLGUIClients();
signals:
void enableOk(bool);
protected slots:
void slotToolbarSelected(const QString& text);
void slotInactiveSelected(QListViewItem *item);
void slotActiveSelected(QListViewItem *item);
void slotDropped(KListView *list, QDropEvent *e, QListViewItem *after);
void slotInsertButton();
void slotRemoveButton();
void slotUpButton();
void slotDownButton();
void slotChangeIcon();
private slots:
void slotProcessExited( KProcess* );
protected: // KDE4: make private
void setupLayout();
void insertActive(ToolbarItem *item, QListViewItem *before, bool prepend = false);
void removeActive(ToolbarItem *item);
void moveActive(ToolbarItem *item, QListViewItem *before);
void initNonKPart(KActionCollection *collection, const QString& file, bool global);
void initKPart(KXMLGUIFactory* factory);
void loadToolbarCombo(const QString& defaultToolbar = QString::null);
void loadActionList(QDomElement& elem);
void updateLocal(QDomElement& elem);
private:
ToolbarListView *m_inactiveList;
ToolbarListView *m_activeList;
QComboBox *m_toolbarCombo;
QToolButton *m_upAction;
QToolButton *m_removeAction;
QToolButton *m_insertAction;
QToolButton *m_downAction;
protected:
virtual void virtual_hook( int id, void* data );
private:
KEditToolbarWidgetPrivate *d;
};
#endif // _KEDITTOOLBAR_H
KActionCollection
A managed set of KAction objects.
Definition: kactioncollection.h:78
KDialogBase::slotOk
virtual void slotOk()
Activated when the Ok button has been clicked.
Definition: kdialogbase.cpp:1164
KProcess
KXMLGUIClient::actionCollection
virtual KActionCollection * actionCollection() const
Retrieves the entire action collection for the GUI client.
Definition: kxmlguiclient.cpp:107
KXMLGUIClient
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document...
Definition: kxmlguiclient.h:43
KDialogBase
A dialog base class with standard buttons and predefined layouts.
Definition: kdialogbase.h:191
KListView
This Widget extends the functionality of QListView to honor the system wide settings for Single Click...
Definition: klistview.h:53
KDialogBase::slotApply
virtual void slotApply()
Activated when the Apply button has been clicked.
Definition: kdialogbase.cpp:1171
KEditToolbar
A dialog used to customize or configure toolbars.
Definition: kedittoolbar.h:110
KDialogBase::slotDefault
virtual void slotDefault()
Activated when the Default button has been clicked.
Definition: kdialogbase.cpp:1102
KXMLGUIFactory
KXMLGUIFactory, together with KXMLGUIClient objects, can be used to create a GUI of container widgets...
Definition: kxmlguifactory.h:62
KEditToolbarWidget
A widget used to customize or configure toolbars.
Definition: kedittoolbar.h:270

KDE Home | KDE Accessibility Home | Description of Access Keys