2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 2001 The LyX Team.
9 * ======================================================
11 * Author: Angus Leeming <leeming@lyx.org>
17 #include "support/LAssert.h"
19 #include <boost/utility.hpp>
24 class ViewBase : boost::noncopyable {
27 ViewBase() : controller_ptr_(0) {}
29 virtual ~ViewBase() {}
31 /// Apply changes to LyX data from dialog.
32 virtual void apply() = 0;
34 virtual void build() = 0;
36 virtual void hide() = 0;
37 /// Redraw the dialog (e.g. if the colors have been remapped).
38 virtual void redraw() {}
39 /// Create the dialog if necessary, update it and display it.
40 virtual void show() = 0;
41 /// Update dialog before/whilst showing it.
42 virtual void update() = 0;
44 /** Defaults to nothing. Can be used by the controller, however, to
45 * indicate to the view that something has changed and that the
46 * dialog therefore needs updating.
48 virtual void partialUpdate(int) {}
50 /** This should be set by the GUI class that owns both the controller
53 void setController(ControlButtons & c) { controller_ptr_ = &c; }
56 ControlButtons & getController()
58 lyx::Assert(controller_ptr_);
59 return *controller_ptr_;
62 ControlButtons const & getController() const
64 lyx::Assert(controller_ptr_);
65 return *controller_ptr_;
69 /// We don't own this.
70 ControlButtons * controller_ptr_;