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/utility.hpp>
17 #include <boost/signals/signal0.hpp>
25 } // namespace frontend
28 /** Container of all dialogs.
30 class Dialogs : boost::noncopyable
36 /** Redraw all visible dialogs because, for example, the GUI colours
37 * have been re-mapped.
39 * Note that static boost signals break some compilers, so we return a
40 * reference to some hidden magic ;-)
42 static boost::signal0<void> & redrawGUI();
44 /// Toggle tooltips on/off in all dialogs.
45 static void toggleTooltips();
47 /// Are the tooltips on or off?
48 static bool tooltipsEnabled();
50 /// Hide all visible dialogs
52 /// Hide any dialogs that require a buffer for them to operate
53 void hideBufferDependent() const;
54 /** Update visible, buffer-dependent dialogs
55 If the bool is true then a buffer change has occurred
56 else its still the same buffer.
58 void updateBufferDependent(bool) const ;
60 /** \param name == "about" etc; an identifier used to
61 launch a particular dialog.
62 \param data is a string encoding of the data used to populate
63 the dialog. Several of these dialogs do not need any data,
64 so it defaults to string().
66 void show(std::string const & name, std::string const & data = std::string());
68 /** \param name == "bibtex", "citation" etc; an identifier used to
69 launch a particular dialog.
70 \param data is a string representation of the Inset contents.
71 It is often little more than the output from Inset::write.
72 It is passed to, and parsed by, the frontend dialog.
73 \param inset is _not_ passed to the frontend dialog.
74 It is stored internally and used by the kernel to ascertain
75 what to do with the FuncRequest dispatched from the frontend
76 dialog on 'Apply'; should it be used to create a new inset at
77 the current cursor position or modify an existing, 'open' inset?
79 void show(std::string const & name, std::string const & data, InsetBase * inset);
81 /** \param name == "citation", "bibtex" etc; an identifier used
82 to update the contents of a particular dialog with \param data.
83 See the comments to 'show', above.
85 void update(std::string const & name, std::string const & data);
87 /// Is the dialog currently visible?
88 bool visible(std::string const & name) const;
90 /** All Dialogs of the given \param name will be closed if they are
91 connected to the given \param inset.
93 static void hide(std::string const & name, InsetBase * inset);
95 void disconnect(std::string const & name);
97 InsetBase * getOpenInset(std::string const & name) const;
100 void hideSlot(std::string const & name, InsetBase * inset);
104 bool isValidName(std::string const & name) const;
106 lyx::frontend::Dialog * find_or_build(std::string const & name);
108 typedef boost::shared_ptr<lyx::frontend::Dialog> DialogPtr;
110 DialogPtr build(std::string const & name);
115 std::map<std::string, InsetBase *> open_insets_;
118 std::map<std::string, DialogPtr> dialogs_;