]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/CategorizedCombo.h
Few string fixes from Dan.
[lyx.git] / src / frontends / qt / CategorizedCombo.h
1 // -*- C++ -*-
2 /**
3  * \file CategorizedCombo.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author John Levon
9  * \author Jean-Marc Lasgouttes
10  * \author Angus Leeming
11  * \author Jürgen Spitzmüller
12  * \author Abdelrazak Younes
13  *
14  * Full author contact details are available in file CREDITS.
15  */
16
17 #ifndef LYX_CATEGORIZEDCOMBO_H
18 #define LYX_CATEGORIZEDCOMBO_H
19
20 #include "support/strfwd.h"
21
22 #include <QComboBox>
23
24
25 namespace lyx {
26 namespace frontend {
27
28 class CCItemDelegate;
29
30 /**
31  * A combo box with categorization
32  */
33 class CategorizedCombo : public QComboBox
34 {
35         Q_OBJECT
36 public:
37         CategorizedCombo(QWidget * parent);
38         ~CategorizedCombo();
39
40         /// select an item in the combobox. Returns false if item does not exist
41         bool set(QString const & cc, bool const report_missing = true);
42         /// Reset the combobox.
43         void reset();
44         /// Reset the combobox filter.
45         void resetFilter();
46         /// Update combobox.
47         void updateCombo();
48         /// Add Item to combo according to sorting settings from preferences
49         void addItemSort(QString const & item, QString const & guiname,
50                          QString const & category, QString const & tooltip,
51                          bool sorted, bool sortedByCat, bool sortCats,
52                          bool available, bool nocategories = false);
53         ///
54         QString getData(int row) const;
55         ///
56         void setTooltipTemplate(QString const & tooltip,
57                                                     QString const & unavail = QString());
58
59         ///
60         void showPopup() override;
61
62         ///
63         bool eventFilter(QObject * o, QEvent * e) override;
64         ///
65         QString const & filter() const;
66
67 private Q_SLOTS:
68         ///
69         void setIconSize(QSize size);
70
71 private:
72         friend class CCItemDelegate;
73         ///
74         struct Private;
75         ///
76         Private * const d;
77         ///
78         int lastCurrentIndex_;
79 };
80
81
82 } // namespace frontend
83 } // namespace lyx
84
85 #endif // LYX_CATEGORIZEDCOMBO_H