Use more descriptive symbolic constants in wxSearchCtrl code

Replace LIGHT_STEP macro and 20 magic number with
SEARCH_BITMAP_LIGHTNESS and CANCEL_BITMAP_LIGHTNESS constants which are
a bit more clear, hopefully.

No real changes.
This commit is contained in:
Vadim Zeitlin
2018-07-09 16:50:10 +02:00
parent 587e0d8e64
commit ed8ac7059c

View File

@@ -37,7 +37,10 @@
// the margin between the text control and the search/cancel buttons // the margin between the text control and the search/cancel buttons
static const wxCoord MARGIN = 2; static const wxCoord MARGIN = 2;
#define LIGHT_STEP 160 // arguments to wxColour::ChangeLightness() for making the search/cancel
// bitmaps foreground colour, respectively
static const int SEARCH_BITMAP_LIGHTNESS = 140; // slightly lighter
static const int CANCEL_BITMAP_LIGHTNESS = 160; // a bit more lighter
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxSearchTextCtrl: text control used by search control // wxSearchTextCtrl: text control used by search control
@@ -952,7 +955,7 @@ static void RescaleBitmap(wxBitmap& bmp, const wxSize& sizeNeeded)
wxBitmap wxSearchCtrl::RenderSearchBitmap( int x, int y, bool renderDrop ) wxBitmap wxSearchCtrl::RenderSearchBitmap( int x, int y, bool renderDrop )
{ {
wxColour bg = GetBackgroundColour(); wxColour bg = GetBackgroundColour();
wxColour fg = GetForegroundColour().ChangeLightness(LIGHT_STEP-20); wxColour fg = GetForegroundColour().ChangeLightness(SEARCH_BITMAP_LIGHTNESS);
//=============================================================================== //===============================================================================
// begin drawing code // begin drawing code
@@ -1055,7 +1058,7 @@ wxBitmap wxSearchCtrl::RenderSearchBitmap( int x, int y, bool renderDrop )
wxBitmap wxSearchCtrl::RenderCancelBitmap( int x, int y ) wxBitmap wxSearchCtrl::RenderCancelBitmap( int x, int y )
{ {
wxColour bg = GetBackgroundColour(); wxColour bg = GetBackgroundColour();
wxColour fg = GetForegroundColour().ChangeLightness(LIGHT_STEP); wxColour fg = GetForegroundColour().ChangeLightness(CANCEL_BITMAP_LIGHTNESS);
//=============================================================================== //===============================================================================
// begin drawing code // begin drawing code