API Documentation
Loading...
Searching...
No Matches
ColorChooserButton.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Widgets
28File: ColorChooserButton
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/Button.h>
35#include <NDEVR/Resource.h>
36#include <NDEVR/RGBColor.h>
37class QColorDialog;
38namespace NDEVR
39{
40 class QCustomColorDialog;
41 /**--------------------------------------------------------------------------------------------------
42 \brief A button that pops up a ColorChooserDialog and changes background color based on the color
43 chosen.
44 *-----------------------------------------------------------------------------------------------**/
46 {
47 Q_OBJECT
48 public:
49 ColorChooserButton(QWidget* parent = nullptr);
50 ColorChooserButton(const std::function<void(RGBColor)>& on_click);
51 ColorChooserButton(const TranslatedString& name, const std::function<void(RGBColor)>& on_click);
52 ColorChooserButton(const TranslatedString& name, const String& icon, const std::function<void(RGBColor)>& on_click);
55 void setShowAlpha(bool show_alpha);
56 void setCallback(const std::function<void(RGBColor)>& on_click);
57 void openDialog();
58 protected:
59 void init();
60 protected slots:
61 void updateFromColorDialog(QColor q_color);
62 signals:
65 protected:
68 public:
70 };
71}
#define NDEVR_WIDGETS_API
Definition DLLInfo.h:81
A core widget that allows the user to click one of many button types.
Definition Button.h:66
A button that pops up a ColorChooserDialog and changes background color based on the color.
Definition ColorChooserButton.h:46
Resource< RGBColor > color
Definition ColorChooserButton.h:69
bool m_show_alpha
Definition ColorChooserButton.h:66
ColorChooserButton(const TranslatedString &name, const std::function< void(RGBColor)> &on_click)
QCustomColorDialog * m_dialog
Definition ColorChooserButton.h:67
void setCallback(const std::function< void(RGBColor)> &on_click)
ColorChooserButton(const TranslatedString &name, const String &icon, const std::function< void(RGBColor)> &on_click)
void setShowAlpha(bool show_alpha)
ColorChooserButton(const std::function< void(RGBColor)> &on_click)
ColorChooserButton(QWidget *parent=nullptr)
ColorChooserButton(const TranslatedString &title, const RGBColor &start_color=Constant< RGBColor >::Invalid)
void updateFromColorDialog(QColor q_color)
A dialog devoted to allowing the user to select a custom color.
Definition QCustomColorDialog.h:21
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:53
A core part of the engine, stores variables that can be listened to with ResourceListener.
Definition Toggle.h:41
The core String class for the software.
Definition String.h:47
Any text displayed to the user should be defined as a TranslatedString which allows the.
Definition TranslatedString.h:13
Definition ACIColor.h:37
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved.
Definition BaseValues.hpp:230