]> git.lyx.org Git - lyx.git/blob - src/LyXView.h
Menubar and toolbar fixes. New OptItem menu option. Add gtk.m4.
[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 1
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         /// update the toolbar
86         void updateToolbar();
87
88         /// return a pointer to the lyxfunc
89         LyXFunc * getLyXFunc() const;
90
91         /// return a pointer to the minibuffer
92         MiniBuffer * getMiniBuffer() const;
93
94 #ifdef NEW_MENUBAR
95         ///
96         Menubar * getMenubar() const;
97
98         ///
99         void updateMenubar();
100 #else
101         ///
102         Menus * getMenus() const;
103 #endif
104         ///
105         Intl * getIntl() const;
106
107         ///
108         Dialogs * getDialogs() { return dialogs_; }
109
110         ///
111         void updateLayoutChoice();
112
113         /// Updates the title of the window
114         void updateWindowTitle();
115
116
117         /// Show state (toolbar and font in minibuffer)
118         void showState();
119
120         /// Reset autosave timer
121         void resetAutosaveTimer();
122 private:
123         /// 
124         LyXFunc * lyxfunc;
125         /// 
126         Toolbar * toolbar;
127         /// 
128         MiniBuffer * minibuffer;
129 #ifdef NEW_MENUBAR
130         ///
131         Menubar * menubar;
132 #else
133         ///
134         Menus * menus;
135 #endif
136         ///
137         Intl * intl;
138         ///
139         Dialogs * dialogs_;
140
141         /** This is supposed to be a pointer or a list of pointers to the
142            BufferViews currently being shown in the LyXView. So far
143            this is not used, but that should change pretty soon. (Lgb) */
144         BufferView * bufferview;
145         ///
146         void invalidateLayoutChoice();
147         ///
148         void UpdateDocumentClassChoice();
149 public:
150         ///
151         static int KeyPressMask_raw_callback(FL_FORM *, void * xev);
152         /** This callback is run when a close event is sent from the
153           window manager. */
154         static int atCloseMainFormCB(FL_FORM *, void *);
155         /// A callback
156         void AutoSave();
157 private:
158         ///
159         Timeout autosave_timeout;
160         /// makes the main form.
161         void create_form_form_main(int width, int height);
162         /// A pointer to the form.      
163         FL_FORM * form_;
164         /** The last textclass layout list in the layout choice selector
165           This should probably be moved to the toolbar, but for now it's
166         here. (Asger) */
167         int last_textclass;
168 };
169 #endif