Warning, file /graphics/kxstitch/src/Palette.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * Copyright (C) 2010-2015 by Stephen Allewell
0003  * steve.allewell@gmail.com
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 Palette_H
0012 #define Palette_H
0013 
0014 #include <QFrame>
0015 
0016 class Document;
0017 
0018 class Palette : public QFrame
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     enum Mode { Select, Replace, Swap };
0024 
0025     explicit Palette(QWidget *);
0026     virtual ~Palette() = default;
0027 
0028     virtual QSize sizeHint() const Q_DECL_OVERRIDE;
0029     Document *document() const;
0030 
0031     void setDocument(Document *);
0032 
0033 public slots:
0034     void showSymbols(bool);
0035     void swapColors();
0036     void replaceColor();
0037 
0038     void loadSettings();
0039 
0040 signals:
0041     void colorSelected(int);
0042     void swapColors(int, int);
0043     void replaceColor(int, int);
0044     void signalStateChanged(QString, bool);
0045 
0046 protected:
0047     virtual bool event(QEvent *) Q_DECL_OVERRIDE;
0048     virtual void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
0049     virtual void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
0050 
0051 private:
0052     Document *m_document;
0053     bool m_showSymbols;
0054     int m_cols;
0055     int m_rows;
0056     int m_width;
0057     int m_height;
0058     int m_flosses;
0059     QVector<int> m_paletteIndex;
0060 
0061     Mode m_mode;
0062 };
0063 
0064 #endif // Palette_H