File indexing completed on 2024-05-19 05:42:28
0001 // ct_lvtqtw_toolbox.h -*-C++-*- 0002 0003 /* 0004 SPDX-FileCopyrightText: 2007 Vladimir Kuznetsov <ks.vladimir@gmail.com> 0005 // Copyright 2023 Codethink Ltd <codethink@codethink.co.uk> 0006 // SPDX-License-Identifier: Apache-2.0 0007 // 0008 // Licensed under the Apache License, Version 2.0 (the "License"); 0009 // you may not use this file except in compliance with the License. 0010 // You may obtain a copy of the License at 0011 // 0012 // http://www.apache.org/licenses/LICENSE-2.0 0013 // 0014 // Unless required by applicable law or agreed to in writing, software 0015 // distributed under the License is distributed on an "AS IS" BASIS, 0016 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0017 // See the License for the specific language governing permissions and 0018 // limitations under the License. 0019 */ 0020 0021 #ifndef CT_LVTQTW_TOOLBOX_H 0022 #define CT_LVTQTW_TOOLBOX_H 0023 0024 #include <QList> 0025 #include <QWidget> 0026 0027 #include <lvtqtw_export.h> 0028 #include <memory> 0029 0030 class CodeVisApplicationTestFixture; 0031 class QAction; 0032 class QToolButton; 0033 class QPaintEvent; 0034 0035 namespace Codethink::lvtqtc { 0036 class ITool; 0037 } 0038 0039 namespace Codethink::lvtqtw { 0040 0041 class LVTQTW_EXPORT ToolBox : public QWidget 0042 // Toolbox, a Command Pallete box that has two 0043 // visualization options. A single column with 0044 // text, or a grid like view. 0045 // Each element should belong to a category, and 0046 // you can separate categories by creating a separator. 0047 { 0048 Q_OBJECT 0049 0050 public: 0051 friend class ::CodeVisApplicationTestFixture; 0052 0053 // CREATORS 0054 explicit ToolBox(QWidget *parent = nullptr); 0055 ~ToolBox() override; 0056 0057 // MUTATORS 0058 QToolButton *createToolButton(const QString& category, QAction *action); 0059 QToolButton *createToolButton(const QString& category, lvtqtc::ITool *tool); 0060 void createGroup(const QString& category); 0061 void hideElements(const QString& category); 0062 void showElements(const QString& category); 0063 0064 protected slots: 0065 void setInformativeView(bool isActive); 0066 0067 private: 0068 QToolButton *getButtonNamed(const std::string& title) const; 0069 0070 // DATA 0071 struct Private; 0072 std::unique_ptr<Private> d; 0073 }; 0074 0075 } // namespace Codethink::lvtqtw 0076 #endif