F:/KPlato/koffice/libs/kofficeui/KoToolBox.h

Aller à la documentation de ce fichier.
00001 /*
00002  * Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
00003  * Copyright (c) 2005-2006 Thomas Zander <zander@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 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 #ifndef _KO_TOOLBOX_H_
00021 #define _KO_TOOLBOX_H_
00022 
00023 #include <QList>
00024 #include <QMap>
00025 #include <QDockWidget>
00026 #include <koffice_export.h>
00027 
00028 class QButtonGroup;
00029 class QBoxLayout;
00030 class QAbstractButton;
00031 class ToolArea;
00032 
00033 
00048 class KOFFICEUI_EXPORT KoToolBox : public QDockWidget {
00049     Q_OBJECT
00050 public:
00052     KoToolBox();
00053     ~KoToolBox();
00054 
00068     void addButton(QAbstractButton *button, const QString &section, int priority, int buttonGroupId=-1);
00069 
00074     void setup();
00075 
00083     void setVisibilityCode(QAbstractButton *button, const QString &code);
00084 
00085 public slots:
00091     void setActiveTool(int id);
00092 
00100     void setButtonsVisible(const QList<QString> &codes);
00101 
00106     void enableTools(bool enable);
00107 
00108 
00109 private:
00110     class ToolArea : public QWidget {
00111     public:
00112         ToolArea(QWidget *parent);
00113         ~ToolArea();
00114 
00115         void setOrientation (Qt::Orientation orientation);
00116         void add(QWidget *button);
00117 
00118         QWidget* getNextParent();
00119 
00120     private:
00121         QList<QWidget *> m_children;
00122         QBoxLayout *m_layout;
00123 
00124         QWidget *m_leftRow;
00125         QWidget *m_rightRow;
00126         QBoxLayout *m_leftLayout;
00127         QBoxLayout *m_rightLayout;
00128 
00129         bool m_left;
00130     };
00131     QButtonGroup *m_buttonGroup;
00132     QBoxLayout* m_layout;
00133     QList<ToolArea *> m_toolBoxes;
00134     QMap<QAbstractButton*, QString> m_visibilityCodes;
00135 
00136     // Section,  [prio, button]
00137     QMap<QString, QMultiMap<int, QAbstractButton*> > m_buttons;
00138     QMap<QString, ToolArea*> m_toolAreas;
00139 
00140     void showEvent(QShowEvent *event);
00141 };
00142 
00144 
00145 
00146 #endif // _KO_TOOLBOX_H_

Généré le Wed Nov 22 23:41:05 2006 pour KPlato par  doxygen 1.5.1-p1