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>
27 } // namespace frontend
30 /** Container of all dialogs.
32 class Dialogs : boost::noncopyable {
37 /** Redraw all visible dialogs because, for example, the GUI colours
38 * have been re-mapped.
40 * Note that static boost signals break some compilers, so we return a
41 * reference to some hidden magic ;-)
43 static boost::signal<void()> & redrawGUI();
45 /// Toggle tooltips on/off in all dialogs.
46 static void toggleTooltips();
48 /// Are the tooltips on or off?
49 static bool tooltipsEnabled();
51 /// Hide all visible dialogs
53 /// Hide any dialogs that require a buffer for them to operate
54 void hideBufferDependent() const;
55 /** Update visible, buffer-dependent dialogs
56 If the bool is true then a buffer change has occurred
57 else its still the same buffer.
59 void updateBufferDependent(bool) const ;
61 /** \param name == "about" etc; an identifier used to
62 launch a particular dialog.
63 \param data is a string encoding of the data used to populate
64 the dialog. Several of these dialogs do not need any data,
65 so it defaults to string().
67 void show(std::string const & name, std::string const & data = std::string());
69 /** \param name == "bibtex", "citation" etc; an identifier used to
70 launch a particular dialog.
71 \param data is a string representation of the Inset contents.
72 It is often little more than the output from Inset::write.
73 It is passed to, and parsed by, the frontend dialog.
74 \param inset is _not_ passed to the frontend dialog.
75 It is stored internally and used by the kernel to ascertain
76 what to do with the FuncRequest dispatched from the frontend
77 dialog on 'Apply'; should it be used to create a new inset at
78 the current cursor position or modify an existing, 'open' inset?
80 void show(std::string const & name, std::string const & data, InsetBase * inset);
82 /** \param name == "citation", "bibtex" etc; an identifier used
83 to update the contents of a particular dialog with \param data.
84 See the comments to 'show', above.
86 void update(std::string const & name, std::string const & data);
88 /// Is the dialog currently visible?
89 bool visible(std::string const & name) const;
91 /** All Dialogs of the given \param name will be closed if they are
92 connected to the given \param inset.
94 static void hide(std::string const & name, InsetBase * inset);
96 void disconnect(std::string const & name);
98 InsetBase * getOpenInset(std::string const & name) const;
101 void hideSlot(std::string const & name, InsetBase * inset);
105 bool isValidName(std::string const & name) const;
107 lyx::frontend::Dialog * find_or_build(std::string const & name);
109 typedef boost::shared_ptr<lyx::frontend::Dialog> DialogPtr;
111 DialogPtr build(std::string const & name);
116 std::map<std::string, InsetBase *> open_insets_;
119 std::map<std::string, DialogPtr> dialogs_;