File indexing completed on 2024-12-01 11:20:17

0001 /***************************************************************************
0002  *   Copyright (C) 2003-2006 by David Saxton                               *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #ifndef DPTEXT_H
0012 #define DPTEXT_H
0013 
0014 #include "drawpart.h"
0015 
0016 /**
0017 @short Represents editable text on the canvas
0018 @author David Saxton
0019 */
0020 class DPText : public DrawPart
0021 {
0022 public:
0023     DPText(ItemDocument *itemDocument, bool newItem, const char *id = nullptr);
0024     ~DPText() override;
0025 
0026     static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id);
0027     static LibraryItem *libraryItem();
0028     static LibraryItem *libraryItemOld();
0029 
0030     void setSelected(bool yes) override;
0031 
0032     QSize minimumSize() const override;
0033 
0034 protected:
0035     void postResize() override;
0036 
0037 private:
0038     void drawShape(QPainter &p) override;
0039     void dataChanged() override;
0040     QString m_text;
0041     bool b_displayBackground;
0042     QColor m_backgroundColor;
0043     QColor m_frameColor;
0044     RectangularOverlay *m_rectangularOverlay;
0045 };
0046 
0047 #endif