]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlButtons.h
Rob Lahaye's "iconify dialogs with main window if so desired" patch.
[lyx.git] / src / frontends / controllers / ControlButtons.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 2001 The LyX Team.
8  *
9  * ======================================================
10  *
11  * \file ControlButtonss.h
12  * \author Angus Leeming <a.leeming@ic.ac.uk>
13  *
14  * ControlButtons serves only to control the activation of the Ok, Apply, Cancel
15  * and Restore buttons on the View dialog.
16  *
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.
20  *
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.
24  *
25  * Once created, the Controller will take care of their initialisation,
26  * management and, ultimately, destruction.
27  */
28
29 #ifndef CONTROLBUTTONS_H
30 #define CONTROLBUTTONS_H
31
32 #ifdef __GNUG__
33 #pragma interface
34 #endif
35
36 #include "DialogBase.h" // This can go eventually
37
38 class ViewBase;
39 class ButtonControllerBase;
40
41 /** Abstract base class for Controllers with a ButtonController.
42  */
43 class ControlButtons : public DialogBase
44 {
45 public:
46         ///
47         ControlButtons();
48         ///
49         virtual ~ControlButtons() {}
50
51         /// These functions are called when the controlling buttons are pressed.
52         ///
53         void ApplyButton();
54         ///
55         void OKButton();
56         ///
57         void CancelButton();
58         ///
59         void RestoreButton();
60         ///
61         bool IconifyWithMain() const;
62
63         /** Allow the view to access the ButtonController. This method must be
64             instantiated in a daughter class that creates the actual instance
65             of the ButtonController. */
66         virtual ButtonControllerBase & bc() = 0;
67
68 protected:
69         /** When Applying it's useful to know whether the dialog is about
70             to close or not (no point refreshing the display for example). */
71         bool isClosing() const { return is_closing_; }
72
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;
79
80         /** Allow the Controller to access the View. This method must be
81             instantiated in a daughter class that creates the actual instance
82             of the View. */
83         virtual ViewBase & view() = 0;
84
85 private:
86         ///
87         bool is_closing_;
88         
89 };
90
91 #endif // CONTROLBUTTONS_H