KiCad PCB EDA Suite
color_swatch.cpp File Reference
#include <widgets/color_swatch.h>
#include "color4Dpickerdlg.h"
#include <memory>

Go to the source code of this file.

Functions

 wxDEFINE_EVENT (COLOR_SWATCH_CHANGED, wxCommandEvent)
 
static const wxSize SWATCH_SIZE_DU (8, 6)
 
COLOR4D DisplayColorFrame (wxWindow *aParent, COLOR4D aOldColor)
 
static std::unique_ptr< wxStaticBitmap > makeColorSwatch (wxWindow *aParent, COLOR4D aColor, COLOR4D aBackground, int aID)
 Function makeColorButton creates a wxStaticBitmap and assigns it a solid color and a control ID. More...
 
static void sendSwatchChangeEvent (COLOR_SWATCH &aSender)
 

Function Documentation

COLOR4D DisplayColorFrame ( wxWindow *  aParent,
COLOR4D  aOldColor 
)
static std::unique_ptr<wxStaticBitmap> makeColorSwatch ( wxWindow *  aParent,
COLOR4D  aColor,
COLOR4D  aBackground,
int  aID 
)
static

Function makeColorButton creates a wxStaticBitmap and assigns it a solid color and a control ID.

Definition at line 70 of file color_swatch.cpp.

References COLOR_SWATCH::MakeBitmap(), and SWATCH_SIZE_DU().

Referenced by COLOR_SWATCH::COLOR_SWATCH().

72 {
73  static wxSize size = aParent->ConvertDialogToPixels( SWATCH_SIZE_DU );
74 
75  wxBitmap bitmap = COLOR_SWATCH::MakeBitmap( aColor, aBackground, size );
76  auto ret = std::make_unique<wxStaticBitmap>( aParent, aID, bitmap );
77 
78  return ret;
79 }
static const wxSize SWATCH_SIZE_DU(8, 6)
static wxBitmap MakeBitmap(KIGFX::COLOR4D aColor, KIGFX::COLOR4D aBackground, wxSize aSize)
Make a simple color swatch bitmap.
static void sendSwatchChangeEvent ( COLOR_SWATCH aSender)
static

Definition at line 118 of file color_swatch.cpp.

Referenced by COLOR_SWATCH::GetNewSwatchColor(), and COLOR_SWATCH::SetSwatchColor().

119 {
120  wxCommandEvent changeEvt( COLOR_SWATCH_CHANGED );
121 
122  // use this class as the object (alternative might be to
123  // set a custom event class but that's more work)
124  changeEvt.SetEventObject( &aSender );
125 
126  wxPostEvent( &aSender, changeEvt );
127 }
static const wxSize SWATCH_SIZE_DU ( ,
 
)
static
wxDEFINE_EVENT ( COLOR_SWATCH_CHANGED  ,
wxCommandEvent   
)