File indexing completed on 2024-04-21 05:53:09
0001 /* 0002 This file is part of the Okteta Gui library, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2003 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #ifndef OKTETA_CURSOR_HPP 0010 #define OKTETA_CURSOR_HPP 0011 0012 // lib 0013 #include "pixelmetrics.hpp" 0014 // Qt 0015 #include <QPixmap> 0016 0017 namespace Okteta { 0018 0019 /** 0020 * @author Friedrich W. H. Kossebau 0021 */ 0022 class Cursor 0023 { 0024 public: 0025 Cursor(); 0026 Cursor(const Cursor&) = delete; 0027 0028 virtual ~Cursor(); 0029 0030 Cursor& operator=(const Cursor&) = delete; 0031 0032 public: 0033 /** sets size of the full cursor */ 0034 void setSize(PixelX Width, PixelY Height, qreal devicePixelRatio); 0035 /** sets the shape of the cursor to be drawn */ 0036 void setShape(PixelX X, PixelX W, qreal devicePixelRatio); 0037 0038 public: // access 0039 QPixmap& onPixmap(); 0040 QPixmap& offPixmap(); 0041 PixelX cursorX() const; 0042 PixelX shapeX() const; 0043 PixelX shapeW() const; 0044 0045 private: 0046 QPixmap OnPixmap; 0047 QPixmap OffPixmap; 0048 0049 PixelX CursorX = 0; 0050 PixelX ShapeX = -1; 0051 PixelX ShapeW = -1; 0052 }; 0053 0054 inline QPixmap& Cursor::onPixmap() { return OnPixmap; } 0055 inline QPixmap& Cursor::offPixmap() { return OffPixmap; } 0056 0057 inline PixelX Cursor::cursorX() const { return CursorX; } 0058 inline PixelX Cursor::shapeX() const { return ShapeX; } 0059 inline PixelX Cursor::shapeW() const { return ShapeW; } 0060 0061 } 0062 0063 #endif