]> git.lyx.org Git - lyx.git/blob - src/frontends/Dialogs.h
remove redrawGUI()
[lyx.git] / src / frontends / Dialogs.h
1 // -*- C++ -*-
2 /**
3  * \file Dialogs.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Allan Rae
8  * \author Angus Leeming
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef DIALOGS_H
14 #define DIALOGS_H
15
16 #include <boost/signal.hpp>
17 #include <boost/utility.hpp>
18
19 #include <map>
20
21 class InsetBase;
22 class LyXView;
23
24 namespace lyx {
25 namespace frontend {
26 class Dialog;
27 } // namespace frontend
28 } // namespace lyx
29
30 /** Container of all dialogs.
31  */
32 class Dialogs : boost::noncopyable {
33 public:
34         ///
35         Dialogs(LyXView &);
36
37         /** Check the status of all visible dialogs and disable or reenable
38          *  them as appropriate.
39          *
40          *  Disabling is needed for example when a dialog is open and the
41          *  cursor moves to a position where the corresponding inset is not
42          *  allowed.
43          */
44         void checkStatus();
45
46         /// Toggle tooltips on/off in all dialogs.
47         static void toggleTooltips();
48
49         /// Are the tooltips on or off?
50         static bool tooltipsEnabled();
51
52         /// Hide all visible dialogs
53         void hideAll() const;
54         /// Hide any dialogs that require a buffer for them to operate
55         void hideBufferDependent() const;
56         /** Update visible, buffer-dependent dialogs
57             If the bool is true then a buffer change has occurred
58             else its still the same buffer.
59          */
60         void updateBufferDependent(bool) const ;
61
62         /** \param name == "about" etc; an identifier used to
63             launch a particular dialog.
64             \param data is a string encoding of the data used to populate
65             the dialog. Several of these dialogs do not need any data,
66             so it defaults to string().
67         */
68         void show(std::string const & name, std::string const & data = std::string());
69
70         /** \param name == "bibtex", "citation" etc; an identifier used to
71             launch a particular dialog.
72             \param data is a string representation of the Inset contents.
73             It is often little more than the output from Inset::write.
74             It is passed to, and parsed by, the frontend dialog.
75             \param inset is _not_ passed to the frontend dialog.
76             It is stored internally and used by the kernel to ascertain
77             what to do with the FuncRequest dispatched from the frontend
78             dialog on 'Apply'; should it be used to create a new inset at
79             the current cursor position or modify an existing, 'open' inset?
80         */
81         void show(std::string const & name, std::string const & data, InsetBase * inset);
82
83         /** \param name == "citation", "bibtex" etc; an identifier used
84             to update the contents of a particular dialog with \param data.
85             See the comments to 'show', above.
86         */
87         void update(std::string const & name, std::string const & data);
88
89         /// Is the dialog currently visible?
90         bool visible(std::string const & name) const;
91
92         /** All Dialogs of the given \param name will be closed if they are
93             connected to the given \param inset.
94         */
95         static void hide(std::string const & name, InsetBase * inset);
96         ///
97         void disconnect(std::string const & name);
98         ///
99         InsetBase * getOpenInset(std::string const & name) const;
100 private:
101         ///
102         void hideSlot(std::string const & name, InsetBase * inset);
103         ///
104         void redraw() const;
105         ///
106         bool isValidName(std::string const & name) const;
107         ///
108         lyx::frontend::Dialog * find_or_build(std::string const & name);
109         ///
110         typedef boost::shared_ptr<lyx::frontend::Dialog> DialogPtr;
111         ///
112         DialogPtr build(std::string const & name);
113
114         ///
115         LyXView & lyxview_;
116         ///
117         std::map<std::string, InsetBase *> open_insets_;
118
119         ///
120         std::map<std::string, DialogPtr> dialogs_;
121
122         /// flag against a race condition due to multiclicks in Qt frontend, see bug #1119
123         bool in_show_;
124 };
125
126 #endif