3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS
14 #pragma implementation
19 #include "version.h" // lyx_version
21 #include "support/filetools.h" // LibFileSearch
22 #include "support/lstrings.h"
23 #include "support/LAssert.h"
28 #include "QWorkArea.h"
30 #include <qapplication.h>
33 #include <qmainwindow.h>
35 #include <qclipboard.h>
42 QWorkArea::QWorkArea(int, int, int, int)
43 : WorkArea(), QWidget(qApp->mainWidget()), painter_(*this)
45 scrollbar_ = new QScrollBar(QScrollBar::Vertical, this);
46 content_ = new QContentPane(this);
48 (static_cast<QMainWindow*>(qApp->mainWidget()))->setCentralWidget(this);
50 setFocusProxy(content_);
54 content_->setBackgroundColor(lcolor.getX11Name(LColor::background).c_str());
56 QHBoxLayout * vl = new QHBoxLayout(this);
57 vl->addWidget(content_, 5);
58 vl->addWidget(scrollbar_, 0);
64 QWorkArea::~QWorkArea()
69 void QWorkArea::setScrollbarParams(int h, int pos, int line_h)
71 // do what cursor movement does (some grey)
74 int max = h - height();
77 scrollbar_->setRange(0, max);
78 scrollbar_->setValue(pos);
79 scrollbar_->setLineStep(line_h);
80 scrollbar_->setPageStep(height());
84 void QWorkArea::haveSelection(bool) const
86 // not possible in Qt !
90 string const QWorkArea::getClipboard() const
92 QString str = QApplication::clipboard()->text();
99 void QWorkArea::putClipboard(string const & str) const
101 QApplication::clipboard()->setText(str.c_str());