/usr/include/wx-3.0/wx/clrpicker.h is in wx3.0-headers 3.0.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | /////////////////////////////////////////////////////////////////////////////
// Name: wx/clrpicker.h
// Purpose: wxColourPickerCtrl base header
// Author: Francesco Montorsi (based on Vadim Zeitlin's code)
// Modified by:
// Created: 14/4/2006
// Copyright: (c) Vadim Zeitlin, Francesco Montorsi
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CLRPICKER_H_BASE_
#define _WX_CLRPICKER_H_BASE_
#include "wx/defs.h"
#if wxUSE_COLOURPICKERCTRL
#include "wx/pickerbase.h"
class WXDLLIMPEXP_FWD_CORE wxColourPickerEvent;
extern WXDLLIMPEXP_DATA_CORE(const char) wxColourPickerWidgetNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxColourPickerCtrlNameStr[];
// show the colour in HTML form (#AABBCC) as colour button label
#define wxCLRBTN_SHOW_LABEL 100
// the default style
#define wxCLRBTN_DEFAULT_STYLE (wxCLRBTN_SHOW_LABEL)
// ----------------------------------------------------------------------------
// wxColourPickerWidgetBase: a generic abstract interface which must be
// implemented by controls used by wxColourPickerCtrl
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxColourPickerWidgetBase
{
public:
wxColourPickerWidgetBase() { m_colour = *wxBLACK; }
virtual ~wxColourPickerWidgetBase() {}
wxColour GetColour() const
{ return m_colour; }
virtual void SetColour(const wxColour &col)
{ m_colour = col; UpdateColour(); }
virtual void SetColour(const wxString &col)
{ m_colour.Set(col); UpdateColour(); }
protected:
virtual void UpdateColour() = 0;
// the current colour (may be invalid if none)
wxColour m_colour;
};
// Styles which must be supported by all controls implementing wxColourPickerWidgetBase
// NB: these styles must be defined to carefully-chosen values to
// avoid conflicts with wxButton's styles
// show the colour in HTML form (#AABBCC) as colour button label
// (instead of no label at all)
// NOTE: this style is supported just by wxColourButtonGeneric and
// thus is not exposed in wxColourPickerCtrl
#define wxCLRP_SHOW_LABEL 0x0008
// map platform-dependent controls which implement the wxColourPickerWidgetBase
// under the name "wxColourPickerWidget".
// NOTE: wxColourPickerCtrl allocates a wxColourPickerWidget and relies on the
// fact that all classes being mapped as wxColourPickerWidget have the
// same prototype for their contructor (and also explains why we use
// define instead of a typedef)
// since GTK > 2.4, there is GtkColorButton
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/clrpicker.h"
#define wxColourPickerWidget wxColourButton
#else
#include "wx/generic/clrpickerg.h"
#define wxColourPickerWidget wxGenericColourButton
#endif
// ----------------------------------------------------------------------------
// wxColourPickerCtrl: platform-independent class which embeds a
// platform-dependent wxColourPickerWidget and, if wxCLRP_USE_TEXTCTRL style is
// used, a textctrl next to it.
// ----------------------------------------------------------------------------
#define wxCLRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL)
#define wxCLRP_DEFAULT_STYLE 0
class WXDLLIMPEXP_CORE wxColourPickerCtrl : public wxPickerBase
{
public:
wxColourPickerCtrl() {}
virtual ~wxColourPickerCtrl() {}
wxColourPickerCtrl(wxWindow *parent, wxWindowID id,
const wxColour& col = *wxBLACK, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxCLRP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxColourPickerCtrlNameStr)
{ Create(parent, id, col, pos, size, style, validator, name); }
bool Create(wxWindow *parent, wxWindowID id,
const wxColour& col = *wxBLACK,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCLRP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxColourPickerCtrlNameStr);
public: // public API
// get the colour chosen
wxColour GetColour() const
{ return ((wxColourPickerWidget *)m_picker)->GetColour(); }
// set currently displayed color
void SetColour(const wxColour& col);
// set colour using RGB(r,g,b) syntax or considering given text as a colour name;
// returns true if the given text was successfully recognized.
bool SetColour(const wxString& text);
public: // internal functions
// update the button colour to match the text control contents
void UpdatePickerFromTextCtrl();
// update the text control to match the button's colour
void UpdateTextCtrlFromPicker();
// event handler for our picker
void OnColourChange(wxColourPickerEvent &);
protected:
virtual long GetPickerStyle(long style) const
{ return (style & wxCLRP_SHOW_LABEL); }
private:
DECLARE_DYNAMIC_CLASS(wxColourPickerCtrl)
};
// ----------------------------------------------------------------------------
// wxColourPickerEvent: used by wxColourPickerCtrl only
// ----------------------------------------------------------------------------
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COLOURPICKER_CHANGED, wxColourPickerEvent );
class WXDLLIMPEXP_CORE wxColourPickerEvent : public wxCommandEvent
{
public:
wxColourPickerEvent() {}
wxColourPickerEvent(wxObject *generator, int id, const wxColour &col)
: wxCommandEvent(wxEVT_COLOURPICKER_CHANGED, id),
m_colour(col)
{
SetEventObject(generator);
}
wxColour GetColour() const { return m_colour; }
void SetColour(const wxColour &c) { m_colour = c; }
// default copy ctor, assignment operator and dtor are ok
virtual wxEvent *Clone() const { return new wxColourPickerEvent(*this); }
private:
wxColour m_colour;
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxColourPickerEvent)
};
// ----------------------------------------------------------------------------
// event types and macros
// ----------------------------------------------------------------------------
typedef void (wxEvtHandler::*wxColourPickerEventFunction)(wxColourPickerEvent&);
#define wxColourPickerEventHandler(func) \
wxEVENT_HANDLER_CAST(wxColourPickerEventFunction, func)
#define EVT_COLOURPICKER_CHANGED(id, fn) \
wx__DECLARE_EVT1(wxEVT_COLOURPICKER_CHANGED, id, wxColourPickerEventHandler(fn))
// old wxEVT_COMMAND_* constant
#define wxEVT_COMMAND_COLOURPICKER_CHANGED wxEVT_COLOURPICKER_CHANGED
#endif // wxUSE_COLOURPICKERCTRL
#endif // _WX_CLRPICKER_H_BASE_
|