4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Angus Leeming
10 * Full author contact details are available in file CREDITS.
16 #include <boost/signal.hpp>
17 #include <boost/utility.hpp>
26 namespace frontend { class Dialog; }
28 /** Container of all dialogs.
30 class Dialogs : boost::noncopyable {
35 /** Check the status of all visible dialogs and disable or reenable
36 * them as appropriate.
38 * Disabling is needed for example when a dialog is open and the
39 * cursor moves to a position where the corresponding inset is not
44 /// Are the tooltips on or off?
45 static bool tooltipsEnabled();
47 /// Hide all visible dialogs
49 /// Hide any dialogs that require a buffer for them to operate
50 void hideBufferDependent() const;
51 /** Update visible, buffer-dependent dialogs
52 If the bool is true then a buffer change has occurred
53 else its still the same buffer.
55 void updateBufferDependent(bool) const ;
57 /** \param name == "about" etc; an identifier used to
58 launch a particular dialog.
59 \param data is a string encoding of the data used to populate
60 the dialog. Several of these dialogs do not need any data,
61 so it defaults to string().
63 void show(std::string const & name, std::string const & data = std::string());
65 /** \param name == "bibtex", "citation" etc; an identifier used to
66 launch a particular dialog.
67 \param data is a string representation of the Inset contents.
68 It is often little more than the output from Inset::write.
69 It is passed to, and parsed by, the frontend dialog.
70 \param inset is _not_ passed to the frontend dialog.
71 It is stored internally and used by the kernel to ascertain
72 what to do with the FuncRequest dispatched from the frontend
73 dialog on 'Apply'; should it be used to create a new inset at
74 the current cursor position or modify an existing, 'open' inset?
76 void show(std::string const & name, std::string const & data, InsetBase * inset);
78 /** \param name == "citation", "bibtex" etc; an identifier used
79 to update the contents of a particular dialog with \param data.
80 See the comments to 'show', above.
82 void update(std::string const & name, std::string const & data);
84 /// Is the dialog currently visible?
85 bool visible(std::string const & name) const;
87 /** All Dialogs of the given \param name will be closed if they are
88 connected to the given \param inset.
90 static void hide(std::string const & name, InsetBase * inset);
92 void disconnect(std::string const & name);
94 InsetBase * getOpenInset(std::string const & name) const;
97 void hideSlot(std::string const & name, InsetBase * inset);
101 bool isValidName(std::string const & name) const;
103 frontend::Dialog * find_or_build(std::string const & name);
105 typedef boost::shared_ptr<frontend::Dialog> DialogPtr;
107 DialogPtr build(std::string const & name);
112 std::map<std::string, InsetBase *> open_insets_;
115 std::map<std::string, DialogPtr> dialogs_;
117 /// flag against a race condition due to multiclicks in Qt frontend, see bug #1119