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"
25 #include "QWorkArea.h"
27 #include <qapplication.h>
30 #include <qmainwindow.h>
32 #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 = std::max(0, h - height());
76 scrollbar_->setRange(0, max);
77 scrollbar_->setValue(pos);
78 scrollbar_->setLineStep(line_h);
79 scrollbar_->setPageStep(height());
83 void QWorkArea::haveSelection(bool) const
85 // not possible in Qt !
89 string const QWorkArea::getClipboard() const
91 QString str = QApplication::clipboard()->text();
98 void QWorkArea::putClipboard(string const & str) const
100 QApplication::clipboard()->setText(str.c_str());