3 * Copyright 1995-2002 the LyX Team
4 * Read the file COPYING
6 * \author John Levon <moz@compsoc.man.ac.uk>
12 #pragma implementation
17 #include "lyxrc.h" // lyxrc.show_banner
18 #include "version.h" // lyx_version
20 #include "support/filetools.h" // LibFileSearch
21 #include "support/lstrings.h"
22 #include "support/LAssert.h"
27 #include "QWorkArea.h"
29 #include <qapplication.h>
32 #include <qmainwindow.h>
34 #include <qclipboard.h>
41 QWorkArea::QWorkArea(int, int, int, int)
42 : WorkArea(), QWidget(qApp->mainWidget()), painter_(*this)
44 scrollbar_ = new QScrollBar(QScrollBar::Vertical, this);
45 content_ = new QContentPane(this);
47 (static_cast<QMainWindow*>(qApp->mainWidget()))->setCentralWidget(this);
51 content_->setBackgroundColor(lcolor.getX11Name(LColor::background).c_str());
53 QHBoxLayout * vl = new QHBoxLayout(this);
54 vl->addWidget(content_, 5);
55 vl->addWidget(scrollbar_, 0);
61 QWorkArea::~QWorkArea()
66 void QWorkArea::setScrollbarParams(int h, int pos, int line_h)
68 // do what cursor movement does (some grey)
71 int max = h - height();
74 scrollbar_->setRange(0, max);
75 scrollbar_->setValue(pos);
76 scrollbar_->setLineStep(line_h);
77 scrollbar_->setPageStep(height());
81 void QWorkArea::haveSelection(bool) const
83 // not possible in Qt !
87 string const QWorkArea::getClipboard() const
89 QString str = QApplication::clipboard()->text();
96 void QWorkArea::putClipboard(string const & str) const
98 QApplication::clipboard()->setText(str.c_str());