2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 2001 The LyX Team.
9 * ======================================================
11 * Author: Angus Leeming <a.leeming@ic.ac.uk>
17 #include <boost/utility.hpp>
18 #include "ControlButtons.h"
19 #include "ControlSplash.h"
24 ViewBase(ControlButtons & c) : controller_(c) {}
26 virtual ~ViewBase() {}
28 /// Apply changes to LyX data from dialog.
29 virtual void apply() = 0;
31 virtual void hide() = 0;
32 /// Redraw the dialog (e.g. if the colors have been remapped).
33 virtual void redraw() {}
34 /// Create the dialog if necessary, update it and display it.
35 virtual void show() = 0;
36 /// Update dialog before/whilst showing it.
37 virtual void update() = 0;
39 virtual void build() = 0;
41 /** These shortcuts allow (e.g. xform's) global callback functions
42 access to the buttons without making the whole controller_ public.
45 void ApplyButton() { controller_.ApplyButton(); }
47 void OKButton() { controller_.OKButton(); }
49 void CancelButton() { controller_.CancelButton(); }
51 void RestoreButton() { controller_.RestoreButton(); }
53 /** Defaults to nothing. Can be used by the Controller, however, to
54 indicate to the View that something has changed and that the
55 dialog therefore needs updating. */
56 virtual void partialUpdate(int) {}
59 /// The view is, after all, controlled!
60 ControlButtons & controller_;
67 ViewSplash(ControlSplash & c) : controller_(c) {}
69 virtual ~ViewSplash() {}
72 virtual void hide() = 0;
73 /// Create the dialog and show it.
74 virtual void show() = 0;
76 /** The shortcut allows (e.g. xform's) global callback functions
77 access without making the whole controller_ public.
80 void Hide() { controller_.hide(); }
83 /// The view is, after all, controlled!
84 ControlSplash & controller_;
88 /** A generic class to cast the ButtonController controller_.bc_ to it's
90 template <class GUIbc>
91 class ViewBC : public ViewBase {
94 ViewBC(ControlButtons & c) : ViewBase(c) {}
100 return static_cast<GUIbc &>(controller_.bc());
101 // return dynamic_cast<GUIbc &>(controller_.bc());