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 /** These shortcuts allow (e.g. xform's) global callback functions
40 access to the buttons without making the whole controller_ public.
43 void ApplyButton() { controller_.ApplyButton(); }
45 void OKButton() { controller_.OKButton(); }
47 void CancelButton() { controller_.CancelButton(); }
49 void RestoreButton() { controller_.RestoreButton(); }
52 /// The view is, after all, controlled!
53 ControlButtons & controller_;
60 ViewSplash(ControlSplash & c) : controller_(c) {}
62 virtual ~ViewSplash() {}
65 virtual void hide() = 0;
66 /// Create the dialog and show it.
67 virtual void show() = 0;
69 /** The shortcut allows (e.g. xform's) global callback functions
70 access without making the whole controller_ public.
73 void Hide() { controller_.hide(); }
76 /// The view is, after all, controlled!
77 ControlSplash & controller_;
81 /** A generic class to cast the ButtonController controller_.bc_ to it's
83 template <class GUIbc>
84 class ViewBC : public ViewBase {
87 ViewBC(ControlButtons & c) : ViewBase(c) {}
93 return static_cast<GUIbc &>(controller_.bc());
94 // return dynamic_cast<GUIbc &>(controller_.bc());