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
15 #include "support/LAssert.h"
17 #include <boost/utility.hpp>
22 class ViewBase : boost::noncopyable {
25 ViewBase() : controller_ptr_(0) {}
27 virtual ~ViewBase() {}
29 /// Apply changes to LyX data from dialog.
30 virtual void apply() = 0;
32 virtual void build() = 0;
34 virtual void hide() = 0;
35 /// Redraw the dialog (e.g. if the colors have been remapped).
36 virtual void redraw() {}
37 /// Create the dialog if necessary, update it and display it.
38 virtual void show() = 0;
39 /// Update dialog before/whilst showing it.
40 virtual void update() = 0;
42 /** Defaults to nothing. Can be used by the controller, however, to
43 * indicate to the view that something has changed and that the
44 * dialog therefore needs updating.
46 virtual void partialUpdate(int) {}
48 /** This should be set by the GUI class that owns both the controller
51 void setController(ControlButtons & c) { controller_ptr_ = &c; }
54 ControlButtons & getController() {
55 lyx::Assert(controller_ptr_);
56 return *controller_ptr_;
59 ControlButtons const & getController() const {
60 lyx::Assert(controller_ptr_);
61 return *controller_ptr_;
64 /// We don't own this.
65 ControlButtons * controller_ptr_;