File indexing completed on 2024-11-24 04:34:22

0001 /***************************************************************************
0002  *   SPDX-License-Identifier: GPL-2.0-or-later
0003  *                                                                         *
0004  *   SPDX-FileCopyrightText: 2004-2020 Thomas Fischer <fischer@unix-ag.uni-kl.de>
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  *   This program is distributed in the hope that it will be useful,       *
0012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0014  *   GNU General Public License for more details.                          *
0015  *                                                                         *
0016  *   You should have received a copy of the GNU General Public License     *
0017  *   along with this program; if not, see <https://www.gnu.org/licenses/>. *
0018  ***************************************************************************/
0019 
0020 #ifndef KBIBTEX_GUI_MENULINEEDIT_H
0021 #define KBIBTEX_GUI_MENULINEEDIT_H
0022 
0023 #include <QFrame>
0024 
0025 #include "kbibtexgui_export.h"
0026 
0027 class QMenu;
0028 class QIcon;
0029 
0030 /**
0031 @author Thomas Fischer
0032  */
0033 class MenuLineEdit : public QFrame
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038     /**
0039      * @brief MenuLineConfigurationChangedEvent
0040      * Event id for use with @c NotificationHub.
0041      * All MenuLineWidgets register to this event.
0042      */
0043     static const int MenuLineConfigurationChangedEvent;
0044     /**
0045      * @brief keyLimitKeyboardTabStops
0046      * Configuration key in group "UserInterface" to access
0047      * the setting for limited keyboard tab stops.
0048      */
0049     static const QString keyLimitKeyboardTabStops;
0050 
0051     MenuLineEdit(bool isMultiLine, QWidget *parent);
0052     ~MenuLineEdit() override;
0053 
0054     void setMenu(QMenu *menu);
0055     virtual void setReadOnly(bool);
0056     QString text() const;
0057     void setText(const QString &);
0058     void setIcon(const QIcon &icon);
0059     void setFont(const QFont &font);
0060     void setButtonToolTip(const QString &);
0061     void setChildAcceptDrops(bool acceptDrops);
0062 
0063     QWidget *buddy();
0064     void prependWidget(QWidget *widget);
0065     void appendWidget(QWidget *widget);
0066     void setInnerWidgetsTransparency(bool makeInnerWidgetsTransparent);
0067 
0068     virtual void clear();
0069     bool isModified() const;
0070     void setCompletionItems(const QStringList &items);
0071 
0072 protected:
0073     void focusInEvent(QFocusEvent *event) override;
0074 
0075 Q_SIGNALS:
0076     void textChanged(const QString &);
0077     void modified();
0078 
0079 private Q_SLOTS:
0080     void slotTextChanged();
0081 
0082 private:
0083     class MenuLineEditPrivate;
0084     MenuLineEditPrivate *const d;
0085 };
0086 
0087 
0088 #endif // KBIBTEX_GUI_MENULINEEDIT_H