File indexing completed on 2024-04-28 04:02:52
0001 /*************************************************************************** 0002 dlgmaptextproperties.h - description 0003 ------------------- 0004 begin : Thu Mar 8 2001 0005 copyright : (C) 2001 by KMud Development Team 0006 email : kmud-devel@kmud.de 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * * 0011 * This program is free software; you can redistribute it and/or modify * 0012 * it under the terms of the GNU General Public License as published by * 0013 * the Free Software Foundation; either version 2 of the License, or * 0014 * (at your option) any later version. * 0015 * * 0016 ***************************************************************************/ 0017 0018 #ifndef DLGMAPTEXTPROPERTIES_H 0019 #define DLGMAPTEXTPROPERTIES_H 0020 0021 #include <QDialog> 0022 #include <qfont.h> 0023 #include <qcolor.h> 0024 #include <qpixmap.h> 0025 #include "ui_dlgmaptextpropertiesbase.h" 0026 0027 class CMapText; 0028 class CMapManager; 0029 0030 class CMapTextPreview : public QWidget 0031 { 0032 public: 0033 CMapTextPreview(CMapManager *manager,QWidget *parent=nullptr); 0034 ~CMapTextPreview() override; 0035 0036 void setColor(QColor textColor) { color = textColor; } 0037 void setFont(QFont textFont) { font = textFont; } 0038 void setSize(QSize textSize) { size = textSize; } 0039 void setText(QString strText) { text = strText; } 0040 0041 protected: 0042 void drawContents(QPainter *paint,int , int , int, int ); 0043 //void paintEvent(QPaintEvent *e); 0044 0045 private: 0046 QColor color; 0047 QFont font; 0048 QSize size; 0049 QString text; 0050 QPixmap *buffer; 0051 CMapManager *mapManager; 0052 }; 0053 0054 0055 /**The map text properties dialog 0056 *@author KMud Development Team 0057 */ 0058 0059 class DlgMapTextProperties : public QDialog, private Ui::DlgMapTextPropertiesBase 0060 { 0061 Q_OBJECT 0062 public: 0063 DlgMapTextProperties(CMapManager *manager,CMapText *textElement,QWidget *parent=nullptr); 0064 ~DlgMapTextProperties() override; 0065 0066 private: 0067 void fillFamilyList(void); 0068 void setFont(QFont font); 0069 0070 private slots: 0071 void slotSetSize(void); 0072 void slotFamilySelected(); 0073 void slotItalicClicked(void); 0074 void slotBoldClicked(void); 0075 void slotColorChanged(const QColor &color); 0076 void slotAccept(); 0077 void slotUpdatePreview(); 0078 0079 private: 0080 QColor textColor; 0081 QFont textFont; 0082 CMapText *text; 0083 CMapManager *mapManager; 0084 CMapTextPreview *textScrollView; 0085 }; 0086 0087 #endif