]> git.lyx.org Git - lyx.git/blob - ControlLog.h
63d66e6540ad1be6fbb2aa8ef554e2e3d3d40ba4
[lyx.git] / ControlLog.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 ControlLog.h
12  * \author John Levon, moz@compsoc.man.ac.uk
13  * \author Angus Leeming <a.leeming@ic.ac.uk>
14  */
15
16 #ifndef CONTROLLOG_H
17 #define CONTROLLOG_H
18
19 #include <utility>
20
21 #ifdef __GNUG__
22 #pragma interface
23 #endif
24
25 #include "ControlConnections.h"
26 #include "buffer.h" // Buffer::LogType
27
28 /**
29  * A controller for a read-only text browser.
30  */
31 class ControlLog : public ControlConnectBD {
32 public:
33         ///
34         ControlLog(LyXView &, Dialogs &);
35         ///
36         std::pair<Buffer::LogType, string> const & logfile()
37                 { return logfile_; }
38
39 protected:
40         ///
41         virtual void apply() {}
42         /// Show the dialog.
43         virtual void show();
44         /// Update the dialog.
45         virtual void update();
46         /// Hide the dialog.
47         virtual void hide();
48
49 private:
50         std::pair<Buffer::LogType, string> logfile_;
51 };
52
53
54 /** A class to instantiate and make available the GUI-specific
55     ButtonController and View.
56  */
57 template <class GUIview, class GUIbc>
58 class GUILog : public ControlLog {
59 public:
60         ///
61         GUILog(LyXView &, Dialogs &);
62         ///
63         virtual ButtonControllerBase & bc() { return bc_; }
64         ///
65         virtual ViewBase & view() { return view_; }
66
67 private:
68         ///
69         ButtonController<OkCancelPolicy, GUIbc> bc_;
70         ///
71         GUIview view_;
72 };
73
74 template <class GUIview, class GUIbc>
75 GUILog<GUIview, GUIbc>::GUILog(LyXView & lv, Dialogs & d)
76         : ControlLog(lv, d),
77           view_(*this)
78 {}
79
80 #endif // CONTROLLOG_H