Pencil2D  ff90c0872e88be3bf81c548cd60f01983012ec49
Pencil2D is an animation software for both bitmap and vector graphics. It is free, multi-platform, and open source.
 All Classes Functions
colorpalettewidget.h
1 /*
2 
3 Pencil - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2013-2017 Matt Chiawen Chang
6 
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; version 2 of the License.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 */
17 
18 #ifndef COLOR_PALETTE_WIDGET_H
19 #define COLOR_PALETTE_WIDGET_H
20 
21 #include "basedockwidget.h"
22 
23 class QToolButton;
24 class QListWidget;
25 class QListWidgetItem;
26 class Object;
27 class Editor;
28 class ColorBox;
29 class QActionGroup;
30 class QMenu;
31 
32 namespace Ui
33 {
34 class ColorPalette;
35 }
36 
37 
39 {
40  Q_OBJECT
41 
42 public:
43  explicit ColorPaletteWidget( QWidget* parent );
44 
45  void initUI() override;
46  void updateUI() override;
47 
48  int currentColourNumber();
49 
50 public slots:
51  void selectColorNumber(int);
52  void setColor(QColor);
53  void refreshColorList();
54 
55 protected:
56  void resizeEvent(QResizeEvent *event) override;
57 
58 signals:
59  void colorChanged(QColor);
60  void colorNumberChanged(int);
61 
62 private slots:
63  void updateItemColor(int, QColor);
64  void colorListCurrentItemChanged(QListWidgetItem*, QListWidgetItem*);
65  void clickColorListItem(QListWidgetItem*);
66  void changeColourName(QListWidgetItem*);
67  void clickAddColorButton();
68  void clickRemoveColorButton();
69  void palettePreferences();
70  void setListMode();
71  void setGridMode();
72  void setSwatchSizeSmall();
73  void setSwatchSizeMedium();
74  void setSwatchSizeLarge();
75  void updateGridUI();
76 
77 private:
78  QString getDefaultColorName(QColor c);
79 
80  Ui::ColorPalette* ui = nullptr;
81  QActionGroup *layoutModes;
82  QAction *listMode;
83  QAction *gridMode;
84  QActionGroup *iconSizes;
85  QAction *smallSwatch;
86  QAction *mediumSwatch;
87  QAction *largeSwatch;
88  QAction *separator;
89  QSize iconSize;
90  QMenu *toolMenu;
91  int stepper;
92 
93 };
94 
95 #endif
96 
Definition: object.h:71
Definition: editor.h:45