leocad/common/lc_colorpicker.h

65 lines
1.3 KiB
C
Raw Normal View History

#pragma once
2013-08-09 04:57:18 +00:00
2023-04-29 19:48:30 -07:00
class lcColorList;
2013-08-09 04:57:18 +00:00
2023-05-15 21:02:17 -07:00
class lcColorPickerPopup : public QFrame
2013-08-09 04:57:18 +00:00
{
Q_OBJECT
public:
2023-05-15 21:02:17 -07:00
lcColorPickerPopup(QWidget* Parent = nullptr, int ColorIndex = 0, bool AllowNoColor = false);
virtual ~lcColorPickerPopup();
2013-08-09 04:57:18 +00:00
void exec();
signals:
2023-05-15 21:02:17 -07:00
void Changed(int ColorIndex);
void Selected(int ColorIndex);
void Hid();
2013-08-09 04:57:18 +00:00
public slots:
2023-05-15 21:02:17 -07:00
void ColorChanged(int ColorIndex);
void ColorSelected(int ColorIndex);
2013-08-09 04:57:18 +00:00
protected:
void showEvent(QShowEvent* ShowEvent) override;
void hideEvent(QHideEvent* HideEvent) override;
void mouseReleaseEvent(QMouseEvent* MouseEvent) override;
2013-08-09 04:57:18 +00:00
private:
2023-05-15 21:02:17 -07:00
QEventLoop* mEventLoop = nullptr;
lcColorList* mColorList = nullptr;
2013-08-09 04:57:18 +00:00
};
2023-05-15 21:02:17 -07:00
class lcColorPicker : public QPushButton
2013-08-09 04:57:18 +00:00
{
Q_OBJECT
public:
2023-05-15 21:02:17 -07:00
lcColorPicker(QWidget* Parent = nullptr, bool AllowNoColor = false);
virtual ~lcColorPicker();
2013-08-09 04:57:18 +00:00
2023-05-15 21:02:17 -07:00
int GetCurrentColor() const;
int GetCurrentColorCode() const;
void SetCurrentColor(int ColorIndex);
void SetCurrentColorCode(int ColorCode);
2013-08-09 04:57:18 +00:00
public slots:
2023-05-15 21:02:17 -07:00
void Changed(int ColorIndex);
void Selected(int ColorIndex);
2013-08-09 04:57:18 +00:00
signals:
2023-05-15 21:02:17 -07:00
void ColorChanged(int ColorIndex);
2013-08-09 04:57:18 +00:00
private slots:
2023-05-15 21:02:17 -07:00
void ButtonPressed(bool Toggled);
void PopupClosed();
2013-08-09 04:57:18 +00:00
2021-01-31 17:32:38 -08:00
protected:
void UpdateIcon();
2013-08-09 04:57:18 +00:00
2021-01-31 17:32:38 -08:00
int mCurrentColorIndex = 0;
int mInitialColorIndex = 0;
bool mAllowNoColor = false;
};