1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2000-07-15 19:51:35 +00:00
|
|
|
// Name: wx/generic/colrdlgg.h
|
1998-05-20 14:01:55 +00:00
|
|
|
// Purpose: wxGenericColourDialog
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
2005-05-04 18:57:50 +00:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2011-01-07 05:26:57 +00:00
|
|
|
#ifndef _WX_COLORDLGG_H_
|
|
|
|
#define _WX_COLORDLGG_H_
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
#include "wx/gdicmn.h"
|
|
|
|
#include "wx/dialog.h"
|
|
|
|
|
2004-11-24 16:08:12 +00:00
|
|
|
#if wxUSE_SLIDER
|
2007-07-09 10:09:52 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxSlider;
|
2004-11-24 16:08:12 +00:00
|
|
|
#endif // wxUSE_SLIDER
|
|
|
|
|
2016-02-24 18:30:56 +00:00
|
|
|
// Preview with opacity is possible only if wxGCDC and wxStaticBitmap are
|
|
|
|
// available and currently it only works in wxOSX and wxMSW as it uses wxBitmap
|
|
|
|
// UseAlpha() and HasAlpha() methods which only these ports provide.
|
|
|
|
#define wxCLRDLGG_USE_PREVIEW_WITH_ALPHA \
|
|
|
|
((wxUSE_GRAPHICS_CONTEXT && wxUSE_STATBMP) && \
|
|
|
|
(defined(__WXMSW__) || defined(__WXOSX__)))
|
2015-10-29 08:28:04 +00:00
|
|
|
|
|
|
|
#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA
|
|
|
|
class wxStaticBitmap;
|
|
|
|
#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA
|
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxGenericColourDialog : public wxDialog
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
2000-07-15 19:51:35 +00:00
|
|
|
public:
|
|
|
|
wxGenericColourDialog();
|
|
|
|
wxGenericColourDialog(wxWindow *parent,
|
2009-01-19 13:55:27 +00:00
|
|
|
wxColourData *data = NULL);
|
2000-07-15 19:51:35 +00:00
|
|
|
virtual ~wxGenericColourDialog();
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2009-01-19 13:55:27 +00:00
|
|
|
bool Create(wxWindow *parent, wxColourData *data = NULL);
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2007-04-22 20:20:51 +00:00
|
|
|
wxColourData &GetColourData() { return m_colourData; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2015-11-22 09:13:27 +00:00
|
|
|
virtual int ShowModal() wxOVERRIDE;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
// Internal functions
|
|
|
|
void OnMouseEvent(wxMouseEvent& event);
|
|
|
|
void OnPaint(wxPaintEvent& event);
|
2015-10-29 08:28:04 +00:00
|
|
|
#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA
|
|
|
|
void OnCustomColourMouseClick(wxMouseEvent& event);
|
|
|
|
#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
virtual void CalculateMeasurements();
|
|
|
|
virtual void CreateWidgets();
|
|
|
|
virtual void InitializeColours();
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
virtual void PaintBasicColours(wxDC& dc);
|
2015-10-29 08:28:04 +00:00
|
|
|
#if !wxCLRDLGG_USE_PREVIEW_WITH_ALPHA
|
|
|
|
virtual void PaintCustomColours(wxDC& dc, int clrIndex = -1);
|
|
|
|
#endif // !wxCLRDLGG_USE_PREVIEW_WITH_ALPHA
|
2000-07-15 19:51:35 +00:00
|
|
|
virtual void PaintCustomColour(wxDC& dc);
|
|
|
|
virtual void PaintHighlight(wxDC& dc, bool draw);
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
virtual void OnBasicColourClick(int which);
|
|
|
|
virtual void OnCustomColourClick(int which);
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
void OnAddCustom(wxCommandEvent& event);
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2004-11-24 16:08:12 +00:00
|
|
|
#if wxUSE_SLIDER
|
2000-07-15 19:51:35 +00:00
|
|
|
void OnRedSlider(wxCommandEvent& event);
|
|
|
|
void OnGreenSlider(wxCommandEvent& event);
|
|
|
|
void OnBlueSlider(wxCommandEvent& event);
|
2015-10-29 08:28:04 +00:00
|
|
|
void OnAlphaSlider(wxCommandEvent& event);
|
2004-11-24 16:08:12 +00:00
|
|
|
#endif // wxUSE_SLIDER
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
void OnCloseWindow(wxCloseEvent& event);
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2015-10-29 08:28:04 +00:00
|
|
|
#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA
|
|
|
|
void DoPreviewBitmap(wxBitmap& bmp, const wxColour& colour);
|
|
|
|
#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA
|
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
protected:
|
2007-04-22 20:20:51 +00:00
|
|
|
wxColourData m_colourData;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
// Area reserved for grids of colours
|
2007-04-22 20:20:51 +00:00
|
|
|
wxRect m_standardColoursRect;
|
|
|
|
wxRect m_customColoursRect;
|
|
|
|
wxRect m_singleCustomColourRect;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
// Size of each colour rectangle
|
2015-10-24 09:57:30 +00:00
|
|
|
wxSize m_smallRectangleSize;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
// Grid spacing (between rectangles)
|
2007-04-22 20:20:51 +00:00
|
|
|
int m_gridSpacing;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
// Section spacing (between left and right halves of dialog box)
|
2007-04-22 20:20:51 +00:00
|
|
|
int m_sectionSpacing;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
// 48 'standard' colours
|
2007-04-22 20:20:51 +00:00
|
|
|
wxColour m_standardColours[48];
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
// 16 'custom' colours
|
2007-04-22 20:20:51 +00:00
|
|
|
wxColour m_customColours[16];
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2000-07-15 19:51:35 +00:00
|
|
|
// Which colour is selected? An index into one of the two areas.
|
2007-04-22 20:20:51 +00:00
|
|
|
int m_colourSelection;
|
|
|
|
int m_whichKind; // 1 for standard colours, 2 for custom colours,
|
1998-05-20 14:01:55 +00:00
|
|
|
|
2004-11-24 16:08:12 +00:00
|
|
|
#if wxUSE_SLIDER
|
2007-04-22 20:20:51 +00:00
|
|
|
wxSlider *m_redSlider;
|
|
|
|
wxSlider *m_greenSlider;
|
|
|
|
wxSlider *m_blueSlider;
|
2015-10-29 08:28:04 +00:00
|
|
|
wxSlider *m_alphaSlider;
|
2004-11-24 16:08:12 +00:00
|
|
|
#endif // wxUSE_SLIDER
|
2015-10-29 08:28:04 +00:00
|
|
|
#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA
|
|
|
|
// Bitmap to preview selected colour (with alpha channel)
|
|
|
|
wxStaticBitmap *m_customColourBmp;
|
|
|
|
// Bitmaps to preview custom colours (with alpha channel)
|
|
|
|
wxStaticBitmap *m_customColoursBmp[16];
|
|
|
|
#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA
|
1999-02-05 23:55:04 +00:00
|
|
|
|
2007-04-22 20:20:51 +00:00
|
|
|
int m_buttonY;
|
2000-07-15 19:51:35 +00:00
|
|
|
|
2007-04-22 20:20:51 +00:00
|
|
|
int m_okButtonX;
|
|
|
|
int m_customButtonX;
|
2000-07-15 19:51:35 +00:00
|
|
|
|
|
|
|
// static bool colourDialogCancelled;
|
|
|
|
|
2015-04-23 11:49:01 +00:00
|
|
|
wxDECLARE_EVENT_TABLE();
|
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxGenericColourDialog);
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
2011-01-07 05:26:57 +00:00
|
|
|
#endif // _WX_COLORDLGG_H_
|