]> git.lyx.org Git - lyx.git/blob - src/LyXView.h
GUI-indep toolbar and menus mostly work !
[lyx.git] / src / LyXView.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  * 
5  *           LyX, The Document Processor
6  *        
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef LyXView_H
13 #define LyXView_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include FORMS_H_LOCATION
20
21 #include "Timeout.h"
22
23 // uncomment this line to try out the new menus
24 //#define NEW_MENUBAR
25
26 class LyXFunc;
27 class Toolbar;
28 class MiniBuffer;
29 class Intl;
30 class Buffer;
31 #ifdef NEW_MENUBAR
32 class Menubar;
33 #else
34 class Menus;
35 #endif
36
37 class BufferView;
38 class Dialogs;
39
40 #ifdef SIGC_CXX_NAMESPACES
41 using SigC::Object;
42 #endif
43
44
45 /**
46   This class is the form containing the view of the buffer. The actual buffer
47   view is supposed (at least IMHO) to be another class, that shows its output
48   in one or more LyXView's.
49  */
50 class LyXView : public Object {
51 public:
52         /// constructor
53         LyXView(int w, int h);
54
55         /// destructor
56         ~LyXView();
57
58         /// Where to place the form.
59         void setPosition(int, int);
60
61         /// Show the main form.
62         void show(int, int, char const * t = "LyX");
63
64         /// init (should probably be removed later) (Lgb)
65         void init();
66
67         /// Redraw the main form.
68         void redraw();
69
70         /// returns the buffer currently shown in the main form.
71         Buffer * buffer() const;
72
73         ///
74         BufferView * view() const;
75
76         /// returns a pointer to the form.
77         FL_FORM * getForm() const;
78
79         /// return a pointer to the toolbar
80         Toolbar * getToolbar() const;
81
82         /// sets the layout in the toolbar layout combox
83         void setLayout(int layout);
84
85         /// return a pointer to the lyxfunc
86         LyXFunc * getLyXFunc() const;
87
88         /// return a pointer to the minibuffer
89         MiniBuffer * getMiniBuffer() const;
90
91 #ifdef NEW_MENUBAR
92         ///
93         Menubar * getMenubar() const;
94
95         ///
96         void updateMenubar();
97 #else
98         ///
99         Menus * getMenus() const;
100 #endif
101         ///
102         Intl * getIntl() const;
103
104         ///
105         Dialogs * getDialogs() { return dialogs_; }
106
107         ///
108         void updateLayoutChoice();
109
110         /// Updates the title of the window
111         void updateWindowTitle();
112
113
114         /// Show state (toolbar and font in minibuffer)
115         void showState();
116
117         /// Reset autosave timer
118         void resetAutosaveTimer();
119 private:
120         /// 
121         LyXFunc * lyxfunc;
122         /// 
123         Toolbar * toolbar;
124         /// 
125         MiniBuffer * minibuffer;
126 #ifdef NEW_MENUBAR
127         ///
128         Menubar * menubar;
129 #else
130         ///
131         Menus * menus;
132 #endif
133         ///
134         Intl * intl;
135         ///
136         Dialogs * dialogs_;
137
138         /** This is supposed to be a pointer or a list of pointers to the
139            BufferViews currently being shown in the LyXView. So far
140            this is not used, but that should change pretty soon. (Lgb) */
141         BufferView * bufferview;
142         ///
143         void invalidateLayoutChoice();
144         ///
145         void UpdateDocumentClassChoice();
146 public:
147         ///
148         static int KeyPressMask_raw_callback(FL_FORM *, void * xev);
149         /** This callback is run when a close event is sent from the
150           window manager. */
151         static int atCloseMainFormCB(FL_FORM *, void *);
152         /// A callback
153         void AutoSave();
154 private:
155         ///
156         Timeout autosave_timeout;
157         /// makes the main form.
158         void create_form_form_main(int width, int height);
159         /// A pointer to the form.      
160         FL_FORM * form_;
161         /** The last textclass layout list in the layout choice selector
162           This should probably be moved to the toolbar, but for now it's
163         here. (Asger) */
164         int last_textclass;
165 };
166 #endif