3 * Copyright 1995-2002 the LyX Team
4 * Read the file COPYING
6 * \author Lars Gullik Bjornes <larsbj@lyx.org>
7 * \author John Levon <moz@compsoc.man.ac.uk>
13 #pragma implementation
19 #include "support/filetools.h"
20 #include "MenuBackend.h"
21 #include "QMiniBuffer.h"
22 #include "ToolbarDefaults.h"
24 #include "BufferView.h"
26 #include "frontends/Toolbar.h"
27 #include "frontends/Menubar.h"
28 #include "frontends/Dialogs.h"
29 #include "frontends/Timeout.h"
32 #include "qfont_loader.h"
34 #include <qapplication.h>
40 // FIXME: this has to go away
41 BufferView * current_view;
43 qfont_loader fontloader;
45 QtView::QtView(unsigned int width, unsigned int height)
46 : QMainWindow(), LyXView()
48 resize(width, height);
50 qApp->setMainWidget(this);
52 menubar_.reset(new Menubar(this, menubackend));
54 connect(menuBar(), SIGNAL(activated(int)),
55 this, SLOT(activated(int)));
57 toolbar_.reset(new Toolbar(this, *getDialogs(), 0, 0, toolbardefaults));
60 minibuffer_.reset(new QMiniBuffer(this));
62 bufferview_.reset(new BufferView(this, 0, 0, width, height));
63 ::current_view = bufferview_.get();
66 // FIXME autosave_timeout_->timeout.connect(SigC::slot(this, &QtView::autoSave));
68 // assign an icon to main form
69 string const iconname = LibFileSearch("images", "lyx", "xpm");
71 if (!iconname.empty())
72 setIcon(QPixmap(iconname.c_str()));
74 // make sure the buttons are disabled if needed
84 void QtView::activated(int id)
86 getLyXFunc()->verboseDispatch(id, true);
90 void QtView::closeEvent(QCloseEvent *)
98 // FIXME: does this make any sense for us ?
103 void QtView::setPosition(unsigned int x, unsigned int y)
109 void QtView::show(int, int, string const & title)
111 setCaption(title.c_str());
116 void QtView::prohibitInput() const
119 //setFocusPolicy(QWidget::NoFocus);
123 void QtView::allowInput() const
126 //setFocusPolicy(QWidget::strongFocus);