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 "version.h" // lyx_version
19 #include "support/filetools.h" // LibFileSearch
20 #include "support/lstrings.h"
21 #include "support/LAssert.h"
26 #include "QWorkArea.h"
28 #include <qapplication.h>
31 #include <qmainwindow.h>
33 #include <qclipboard.h>
40 QWorkArea::QWorkArea(int, int, int, int)
41 : WorkArea(), QWidget(qApp->mainWidget()), painter_(*this)
43 scrollbar_ = new QScrollBar(QScrollBar::Vertical, this);
44 content_ = new QContentPane(this);
46 (static_cast<QMainWindow*>(qApp->mainWidget()))->setCentralWidget(this);
48 setFocusProxy(content_);
52 content_->setBackgroundColor(lcolor.getX11Name(LColor::background).c_str());
54 QHBoxLayout * vl = new QHBoxLayout(this);
55 vl->addWidget(content_, 5);
56 vl->addWidget(scrollbar_, 0);
62 QWorkArea::~QWorkArea()
67 void QWorkArea::setScrollbarParams(int h, int pos, int line_h)
69 // do what cursor movement does (some grey)
72 int max = h - height();
75 scrollbar_->setRange(0, max);
76 scrollbar_->setValue(pos);
77 scrollbar_->setLineStep(line_h);
78 scrollbar_->setPageStep(height());
82 void QWorkArea::haveSelection(bool) const
84 // not possible in Qt !
88 string const QWorkArea::getClipboard() const
90 QString str = QApplication::clipboard()->text();
97 void QWorkArea::putClipboard(string const & str) const
99 QApplication::clipboard()->setText(str.c_str());