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.
13 #include "QWorkArea.h"
19 #include <qapplication.h>
26 /// copy some horizontal regions about inside a pixmap
27 void copyInPixmap(QPixmap * p, int dest_y, int src_y, int src_w, int src_h)
29 // bitBlt(dest, dest_x, dest_y, source, src_x, src_y, src_w, src_h)
30 bitBlt(p, 0, dest_y, p, 0, src_y, src_w, src_h);
36 QScreen::QScreen(QWorkArea & o)
37 : LyXScreen(), owner_(o)
47 WorkArea & QScreen::workarea() const
53 void QScreen::repaint()
55 QWidget * content = owner_.getContent();
56 content->repaint(0, 0, content->width(), content->height());
60 void QScreen::expose(int x, int y, int w, int h)
62 lyxerr[Debug::GUI] << "expose " << w << 'x' << h
63 << '+' << x << '+' << y << endl;
65 owner_.getContent()->update(x, y, w, h);
69 void QScreen::showCursor(int x, int y, int h, Cursor_Shape shape)
80 cursor_w_ = cursor_h_ / 3;
82 case REVERSED_L_SHAPE:
83 cursor_w_ = cursor_h_ / 3;
84 cursor_x_ = x - cursor_w_ + 1;
88 if (!nocursor_pixmap_.get()
89 || cursor_w_ != nocursor_pixmap_->width()
90 || cursor_h_ != nocursor_pixmap_->height()) {
91 nocursor_pixmap_.reset(new QPixmap(cursor_w_, cursor_h_));
94 if (!qApp->focusWidget())
98 bitBlt(nocursor_pixmap_.get(), 0, 0, owner_.getPixmap(),
99 cursor_x_, cursor_y_, cursor_w_, cursor_h_);
101 Painter & pain(owner_.getPainter());
103 pain.line(x, y, x, y + h - 1, LColor::cursor);
108 case REVERSED_L_SHAPE:
110 pain.line(cursor_x_, y + h - 1, cursor_x_ + cursor_w_ - 1,
111 y + h - 1, LColor::cursor);
117 owner_.getContent()->repaint(
118 cursor_x_, cursor_y_,
119 cursor_w_, cursor_h_);
123 void QScreen::removeCursor()
125 // before first showCursor
126 if (!nocursor_pixmap_.get())
129 bitBlt(owner_.getPixmap(), cursor_x_, cursor_y_,
130 nocursor_pixmap_.get(), 0, 0, cursor_w_, cursor_h_);
132 owner_.getContent()->repaint(
133 cursor_x_, cursor_y_,
134 cursor_w_, cursor_h_);