]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiSymbols.h
Use a custom model + QListView instead of QListWidget in the Symbols
[lyx.git] / src / frontends / qt4 / GuiSymbols.h
1 // -*- C++ -*-
2 /**
3  * \file GuiSymbols.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Jürgen Spitzmüller
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef GUISYMBOLSDIALOG_H
13 #define GUISYMBOLSDIALOG_H
14
15 #include "DialogView.h"
16 #include "ui_SymbolsUi.h"
17
18 #include <map>
19 #include <set>
20
21 namespace lyx {
22 namespace frontend {
23
24 class GuiSymbols : public DialogView, public Ui::SymbolsUi
25 {
26         Q_OBJECT
27
28 public:
29         GuiSymbols(GuiView & lv);
30
31         /// Dialog inherited methods
32         //@{
33         void updateView();
34         void dispatchParams();
35         void enableView(bool enable);
36         bool isBufferDependent() const { return true; }
37         virtual FuncCode getLfun() const { return LFUN_SELF_INSERT; }
38         //@}
39
40 public Q_SLOTS:
41         void on_applyPB_clicked();
42         void on_okPB_clicked();
43         void on_closePB_clicked();
44         void on_symbolsLW_activated(QModelIndex const & index);
45         void on_symbolsLW_clicked(QModelIndex const & index);
46         void on_categoryCO_activated(QString const & text);
47         void on_categoryFilterCB_toggled(bool);
48         void on_chosenLE_returnPressed();
49         void on_chosenLE_textChanged(QString const &);
50
51 private:
52         void scrollToItem(QString const & category);
53         /** update the widgets (symbol browser, category combo)
54          *  \p combo indicates if the combo box has to be refreshed
55          *  as well (which is rather expensive)
56         **/
57         void updateSymbolList(bool update_combo = true);
58         /// the encoding at cursor position
59         std::string encoding_;
60         /// which blocks do we actually include?
61         typedef std::map<QString, int> UsedBlocks;
62         ///
63         UsedBlocks used_blocks;
64         /// list of all symbols
65         typedef std::set<char_type> SymbolsList;
66         ///
67         SymbolsList symbols_;
68         /// custom model for symbol list view
69         class Model;
70         friend class Model;
71         Model * model_;
72 };
73
74 } // namespace frontend
75 } // namespace lyx
76
77 #endif // GUISYMBOLSDIALOG_H