3 * \file ControlButtons.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
11 * ControlButtons serves only to control the activation of the Ok, Apply, Cancel
12 * and Restore buttons on the View dialog.
14 * More generally, the class is part of a hierarchy of controller classes
15 * that together connect the GUI-dependent dialog to any appropriate
16 * signals and dispatches any changes to the kernel.
18 * These controllers have no knowledge of the actual instantiation of the
19 * GUI-dependent View and ButtonController, which should therefore
20 * be created elsewhere.
22 * Once created, the Controller will take care of their initialisation,
23 * management and, ultimately, destruction.
26 #ifndef CONTROLBUTTONS_H
27 #define CONTROLBUTTONS_H
30 #include <boost/utility.hpp>
31 #include <boost/scoped_ptr.hpp>
34 class ButtonController;
36 /** Abstract base class for Controllers with a ButtonController.
38 class ControlButtons : boost::noncopyable {
43 virtual ~ControlButtons();
45 /** These functions are called by the view when the appropriate buttons
57 /// Returns the user-specified iconification policy.
58 bool IconifyWithMain() const;
61 ButtonController & bc();
64 void setView(ViewBase &);
65 /** When Applying it's useful to know whether the dialog is about
66 to close or not (no point refreshing the display for example). */
67 bool isClosing() const { return is_closing_; }
73 /// Get changed parameters and Dispatch them to the kernel.
74 virtual void apply() = 0;
75 /// Disconnect signals and hide View.
76 virtual void hide() = 0;
77 /// Update dialog before showing it.
78 virtual void update() = 0;
80 /** This flag can be set by one of the miriad the controller methods
81 to ensure that the dialog is shut down. */
87 boost::scoped_ptr<ButtonController> bc_ptr_;
88 /// We do not own this pointer.
92 #endif // CONTROLBUTTONS_H