2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 2001 The LyX Team.
9 * ======================================================
11 * \file ControlButtons.h
12 * \author Angus Leeming <leeming@lyx.org>
14 * ControlButtons serves only to control the activation of the Ok, Apply, Cancel
15 * and Restore buttons on the View dialog.
17 * More generally, the class is part of a hierarchy of controller classes
18 * that together connect the GUI-dependent dialog to any appropriate
19 * signals and dispatches any changes to the kernel.
21 * These controllers have no knowledge of the actual instantiation of the
22 * GUI-dependent View and ButtonController, which should therefore
23 * be created elsewhere.
25 * Once created, the Controller will take care of their initialisation,
26 * management and, ultimately, destruction.
29 #ifndef CONTROLBUTTONS_H
30 #define CONTROLBUTTONS_H
36 #include <boost/utility.hpp>
39 class ButtonControllerBase;
41 /** Abstract base class for Controllers with a ButtonController.
43 class ControlButtons : boost::noncopyable
49 virtual ~ControlButtons() {}
51 /** These functions are called by the view when the appropriate buttons
63 /// Returns the user-specified iconification policy.
64 bool IconifyWithMain() const;
67 ButtonControllerBase & bc();
70 void setView(ViewBase &);
72 void setButtonController(ButtonControllerBase &);
78 /** When Applying it's useful to know whether the dialog is about
79 to close or not (no point refreshing the display for example). */
80 bool isClosing() const { return is_closing_; }
82 /// Get changed parameters and Dispatch them to the kernel.
83 virtual void apply() = 0;
84 /// Disconnect signals and hide View.
85 virtual void hide() = 0;
86 /// Update dialog before showing it.
87 virtual void update() = 0;
89 /** This flag can be set by one of the miriad the controller methods
90 to ensure that the dialog is shut down. */
96 /// We own neither of these pointers.
97 ButtonControllerBase * bc_ptr_;
102 #endif // CONTROLBUTTONS_H