Warning, file /office/calligra/libs/widgets/KoToolBox_p.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org> 0003 * Copyright (c) 2005-2008 Thomas Zander <zander@kde.org> 0004 * Copyright (c) 2009 Peter Simonsson <peter.simonsson@gmail.com> 0005 * Copyright (c) 2010 Cyrille Berger <cberger@cberger.net> 0006 * 0007 * This library is free software; you can redistribute it and/or 0008 * modify it under the terms of the GNU Library General Public 0009 * License as published by the Free Software Foundation; either 0010 * version 2 of the License, or (at your option) any later version. 0011 * 0012 * This library is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 * Library General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU Library General Public License 0018 * along with this library; see the file COPYING.LIB. If not, write to 0019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0020 * Boston, MA 02110-1301, USA. 0021 */ 0022 #ifndef _KO_TOOLBOX_H_ 0023 #define _KO_TOOLBOX_H_ 0024 0025 #include <KoCanvasObserverBase.h> 0026 0027 #include <QWidget> 0028 #include <QList> 0029 0030 #include <KoToolManager.h> 0031 0032 class KoCanvasController; 0033 class KoShapeLayer; 0034 class KoToolBoxLayout; 0035 0036 /** 0037 * KoToolBox is a dock widget that can order tools according to type and 0038 * priority. 0039 * 0040 * The ToolBox is a container for tool buttons which are themselves 0041 * divided into sections. 0042 * 0043 * Adding buttons using addButton() will allow you to show those buttons. You should connect 0044 * the button to your handling method yourself. 0045 * 0046 * The unique property of this toolbox is that it can be shown horizontal as well as vertical, 0047 * rotating in a smart way to show the buttons optimally. 0048 * @see KoToolManager 0049 */ 0050 class KoToolBox : public QWidget { 0051 Q_OBJECT 0052 public: 0053 /// constructor 0054 explicit KoToolBox(); 0055 ~KoToolBox() override; 0056 0057 public Q_SLOTS: 0058 /** 0059 * Using the buttongroup id passed in addButton() you can set the new active button. 0060 * If the id does not resolve to a visible button, this call is ignored. 0061 * @param canvas the currently active canvas. 0062 * @param id an id to identify the button to activate. 0063 */ 0064 void setActiveTool(KoCanvasController *canvas, int id); 0065 0066 /** 0067 * Show only the dynamic buttons that have a code from parameter codes. 0068 * The toolbox allows buttons to be optionally registered with a visibilityCode. This code 0069 * can be passed here and all buttons that have that code are shown. All buttons that 0070 * have another visibility code registered are hidden. 0071 * @param codes a list of all the codes to show. 0072 */ 0073 void setButtonsVisible(const QList<QString> &codes); 0074 0075 0076 /// Set the orientation of the layout to @p orientation 0077 void setOrientation(Qt::Orientation orientation); 0078 0079 void setFloating(bool v); 0080 0081 KoToolBoxLayout *toolBoxLayout() const; 0082 0083 private: 0084 /** 0085 * Add a button to the toolbox. 0086 * The buttons should all be added before the first showing since adding will not really add 0087 * them to the UI until setup() is called. 0088 * 0089 * @param toolAction the action of the tool 0090 * @see setup() 0091 */ 0092 void addButton(KoToolAction *toolAction); 0093 0094 private Q_SLOTS: 0095 void setCurrentLayer(const KoCanvasController *canvas, const KoShapeLayer* newLayer); 0096 0097 /// add a tool post-initialization. The tool will also be activated. 0098 void toolAdded(KoToolAction *toolAction, KoCanvasController *canvas); 0099 0100 /// set the icon size for all the buttons 0101 void slotContextIconSize(); 0102 0103 protected: 0104 void paintEvent(QPaintEvent *event) override; 0105 void contextMenuEvent(QContextMenuEvent *event) override; 0106 0107 private: 0108 class Private; 0109 Private * const d; 0110 }; 0111 0112 #endif // _KO_TOOLBOX_H_