]> git.lyx.org Git - lyx.git/commitdiff
* draw cursor in the right shape (L_SHAPE, REVERSED_L_SHAPE or the normal one)
authorStefan Schimanski <sts@lyx.org>
Mon, 4 Jun 2007 06:21:33 +0000 (06:21 +0000)
committerStefan Schimanski <sts@lyx.org>
Mon, 4 Jun 2007 06:21:33 +0000 (06:21 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18645 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiWorkArea.cpp

index 79bd04849176568f4359288fd07df27ac0d56093..5a8bb268e317310a7968ff5a6a265318439f80c3 100644 (file)
@@ -127,16 +127,44 @@ public:
 
        void draw(QPainter & painter)
        {
-               // FIXME: do something depending on the cursor shape.
-               if (show_ && rect_.isValid())
-                       painter.fillRect(rect_, color_);
+               if (show_ && rect_.isValid()) {
+                       switch (shape_) {
+                       case L_SHAPE:
+                               painter.fillRect(rect_.x(), rect_.y(), CursorWidth, rect_.height(), color_);
+                               painter.setPen(color_);
+                               painter.drawLine(rect_.bottomLeft().x() + CursorWidth, rect_.bottomLeft().y(),
+                                                                                                rect_.bottomRight().x(), rect_.bottomLeft().y());
+                               break;
+                       
+                       case REVERSED_L_SHAPE:
+                               painter.fillRect(rect_.x() + rect_.height() / 3, rect_.y(), CursorWidth, rect_.height(), color_);
+                               painter.setPen(color_);
+                               painter.drawLine(rect_.bottomRight().x() - CursorWidth, rect_.bottomLeft().y(),
+                                                                                                        rect_.bottomLeft().x(), rect_.bottomLeft().y());
+                               break;
+                                       
+                       default:
+                               painter.fillRect(rect_, color_);
+                               break;
+                       }
+               }
        }
 
        void update(int x, int y, int h, CursorShape shape)
        {
                color_ = guiApp->colorCache().get(Color::cursor);
-               rect_ = QRect(x, y, CursorWidth, h);
                shape_ = shape;
+               switch (shape) {
+               case L_SHAPE:
+                       rect_ = QRect(x, y, CursorWidth + h / 3, h);
+                       break;
+               case REVERSED_L_SHAPE:
+                       rect_ = QRect(x - h / 3, y, CursorWidth + h / 3, h);
+                       break;
+               default: 
+                       rect_ = QRect(x, y, CursorWidth, h);
+                       break;
+               }
        }
 
        void show(bool set_show = true) { show_ = set_show; }