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