Move the implementation of the color picker dialog into an anonymous namespace

This commit is contained in:
Thomas Goyne 2013-01-13 10:46:30 -08:00
parent 247a92607b
commit 2072241e54

View file

@ -72,6 +72,8 @@
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
#endif #endif
namespace {
class ColorPickerSpectrum : public wxControl { class ColorPickerSpectrum : public wxControl {
public: public:
enum PickerDirection { enum PickerDirection {
@ -563,16 +565,6 @@ void ColorPickerScreenDropper::DropFromScreenXY(int x, int y) {
Refresh(false); Refresh(false);
} }
bool GetColorFromUser(wxWindow* parent, agi::Color original, std::function<void (agi::Color)> callback) {
DialogColorPicker dialog(parent, original, callback);
bool ok = dialog.ShowModal() == wxID_OK;
if (!ok)
callback(original);
else
dialog.AddColorToRecent();
return ok;
}
static const int slider_width = 10; ///< width in pixels of the color slider control static const int slider_width = 10; ///< width in pixels of the color slider control
static const int alpha_box_size = 5; static const int alpha_box_size = 5;
@ -1155,3 +1147,15 @@ void DialogColorPicker::OnCaptureLost(wxMouseCaptureLostEvent&) {
screen_dropper_icon->SetCursor(wxNullCursor); screen_dropper_icon->SetCursor(wxNullCursor);
screen_dropper_icon->SetBitmap(eyedropper_bitmap); screen_dropper_icon->SetBitmap(eyedropper_bitmap);
} }
}
bool GetColorFromUser(wxWindow* parent, agi::Color original, std::function<void (agi::Color)> callback) {
DialogColorPicker dialog(parent, original, callback);
bool ok = dialog.ShowModal() == wxID_OK;
if (!ok)
callback(original);
else
dialog.AddColorToRecent();
return ok;
}