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 // Too hard to make concept checks work with this file
14 #ifdef _GLIBCXX_CONCEPT_CHECKS
15 #undef _GLIBCXX_CONCEPT_CHECKS
17 #ifdef _GLIBCPP_CONCEPT_CHECKS
18 #undef _GLIBCPP_CONCEPT_CHECKS
23 #include "GWorkArea.h"
26 #include "BufferView.h"
33 #include "frontends/font_metrics.h"
34 #include "frontends/Painter.h"
36 #include "insets/insettext.h"
40 // FIXME: defined in X.h, spuriously pulled in by some gui headers
46 //using lyx::frontend::CursorShape;
48 GScreen::GScreen(GWorkArea & o)
51 // the cursor isnt yet visible
64 void GScreen::setCursorColor(Glib::RefPtr<Gdk::GC> gc)
66 Gdk::Color * clr = owner_.getColorHandler().
67 getGdkColor(LColor::cursor);
68 gc->set_foreground(*clr);
72 void GScreen::showCursor(int x, int y, int h, CursorShape shape)
74 // Update the cursor color.
75 setCursorColor(owner_.getGC());
86 cursorW_ = cursorH_ / 3;
88 case REVERSED_L_SHAPE:
89 cursorW_ = cursorH_ / 3;
90 cursorX_ = x - cursorW_ + 1;
94 int fx, fy, fwidth, fheight, fdepth;
95 owner_.getWindow()->get_geometry(fx, fy, fwidth, fheight, fdepth);
96 cursorPixmap_ = Gdk::Pixmap::create(owner_.getWindow(),
100 cursorPixmap_->draw_drawable(owner_.getGC(),
102 owner_.xpos() + cursorX_,
103 owner_.ypos() + cursorY_,
107 owner_.getWindow()->draw_line(owner_.getGC(),
111 y + h - 1 + owner_.ypos());
116 case REVERSED_L_SHAPE:
117 owner_.getWindow()->draw_line(owner_.getGC(),
118 owner_.xpos() + cursorX_,
119 owner_.ypos() + y + h - 1,
120 owner_.xpos() + cursorX_ + cursorW_ - 1,
121 owner_.xpos() + y + h - 1);
127 void GScreen::removeCursor()
130 owner_.getWindow()->draw_drawable(owner_.getGC(),
133 cursorX_ + owner_.xpos(),
134 cursorY_ + owner_.ypos(),
140 void GScreen::expose(int x, int y, int w, int h)
142 lyxerr[Debug::GUI] << "expose " << w << 'x' << h
143 << '+' << x << '+' << y << std::endl;
144 owner_.getWindow()->draw_drawable(owner_.getGC(),
152 } // namespace frontend