4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
14 #include <boost/utility.hpp>
15 #include <boost/signals/signal0.hpp>
16 #include <boost/signals/signal1.hpp>
18 #include "support/std_string.h"
25 /** Container of all dialogs and signals a LyXView needs or uses to access them
26 The list of dialog signals isn't comprehensive but should be a good guide
27 for any future additions. Remember don't go overboard -- think minimal.
29 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::signal0<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 /// Signals slated to go
53 boost::signal0<void> hideAllSignal;
54 boost::signal0<void> hideBufferDependentSignal;
55 boost::signal1<void, bool> updateBufferDependentSignal;
58 /// Hide all visible dialogs
60 /// Hide any dialogs that require a buffer for them to operate
61 void hideBufferDependent() const;
62 /** Update visible, buffer-dependent dialogs
63 If the bool is true then a buffer change has occurred
64 else its still the same buffer.
66 void updateBufferDependent(bool) const ;
68 /**@name Dialog Access Signals.
69 Put into some sort of alphabetical order */
73 /// show all forked child processes
78 void showPreferences();
85 /// bring up the spellchecker
86 void showSpellchecker();
89 /** \param name == "about" etc; an identifier used to
90 launch a particular dialog.
91 \param data is a string encoding of the data used to populate
92 the dialog. Several of these dialogs do not need any data,
93 so it defaults to string().
95 void show(string const & name, string const & data = string());
97 /** \param name == "bibtex", "citation" etc; an identifier used to
98 launch a particular dialog.
99 \param data is a string representation of the Inset contents.
100 It is often little more than the output from Inset::write.
101 It is passed to, and parsed by, the frontend dialog.
102 \param inset is _not_ passed to the frontend dialog.
103 It is stored internally and used by the kernel to ascertain
104 what to do with the FuncRequest dispatched from the frontend
105 dialog on 'Apply'; should it be used to create a new inset at
106 the current cursor position or modify an existing, 'open' inset?
108 void show(string const & name, string const & data, InsetBase * inset);
110 /** \param name == "citation", "bibtex" etc; an identifier used
111 to update the contents of a particular dialog with \param data .
112 See the comments to 'show', above.
114 void update(string const & name, string const & data);
116 /// is the dialog currently visible?
117 bool visible(string const & name) const;
119 /** All Dialogs of the given \param name will be closed if they are
120 connected to the given \param inset.
122 static void hide(string const & name, InsetBase * inset);
124 void disconnect(string const & name);
126 InsetBase * getOpenInset(string const & name) const;
129 void hideSlot(string const & name, InsetBase * inset);
133 bool isValidName(string const & name) const;
135 Dialog * find(string const & name);
137 Dialog * build(string const & name);
142 std::map<string, InsetBase *> open_insets_;
145 typedef boost::shared_ptr<Dialog> DialogPtr;
147 std::map<string, DialogPtr> dialogs_;
149 /// the stuff below is slated to go...