{
if (ialpha == 100)
return c;
-
+
double r = c.Red(), g = c.Green(), b = c.Blue();
double bg;
-
+
// ialpha is 0..200 where 0 is completely black
// and 200 is completely white and 100 is the same
// convert that to normal alpha 0.0 - 1.0
ialpha = wxMin(ialpha, 200);
ialpha = wxMax(ialpha, 0);
double alpha = ((double)(ialpha - 100.0))/100.0;
-
+
if (ialpha > 100)
{
// blend with white
bg = 0.0;
alpha = 1.0 + alpha; // 0 = transparent fg; 1 = opaque fg
}
-
+
r = wxBlendColour(r, bg, alpha);
g = wxBlendColour(g, bg, alpha);
b = wxBlendColour(b, bg, alpha);
-
+
return wxColour((unsigned char)r, (unsigned char)g, (unsigned char)b);
}
{
m_search = search;
m_defaultFG = GetForegroundColour();
-
+
// remove the default minsize, the searchctrl will have one instead
SetSizeHints(wxDefaultCoord,wxDefaultCoord);
}
{
ChangeValue(wxEmptyString);
}
-
+
m_descriptiveText = text;
}
-
+
wxString GetDescriptiveText() const
{
return m_descriptiveText;
}
-
+
protected:
void OnText(wxCommandEvent& eventText)
{
SetForegroundColour(m_defaultFG);
}
}
-
+
private:
wxSearchCtrl* m_search;
wxString m_descriptiveText;
wxColour m_defaultFG;
-
+
DECLARE_EVENT_TABLE()
};
const wxValidator& validator,
const wxString& name)
{
+ // force border style for more native appearance
+ style &= ~wxBORDER_MASK;
#ifdef __WXGTK__
- if ( !wxTextCtrlBase::Create(parent, id, pos, size, wxSUNKEN_BORDER | style, validator, name) )
+ style |= wxBORDER_SUNKEN;
#else
- if ( !wxTextCtrlBase::Create(parent, id, pos, size, wxSIMPLE_BORDER | style, validator, name) )
+ style |= wxBORDER_SIMPLE;
#endif
+ if ( !wxTextCtrlBase::Create(parent, id, pos, size, style, validator, name) )
{
return false;
}
m_text = new wxSearchTextCtrl(this, value, style & ~wxBORDER_MASK);
m_text->SetDescriptiveText(_("Search"));
-
+
wxSize sizeText = m_text->GetBestSize();
- m_searchButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN,m_searchBitmap);
- m_cancelButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN,m_cancelBitmap);
+ m_searchButton = new wxSearchButton(this,
+ wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN,
+ m_searchBitmap);
+ m_cancelButton = new wxSearchButton(this,
+ wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN,
+ m_cancelBitmap);
SetForegroundColour( m_text->GetForegroundColour() );
m_searchButton->SetForegroundColour( m_text->GetForegroundColour() );
}
}
wxRect rect = GetRect();
- LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight());
+ LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight());
}
wxMenu* wxSearchCtrl::GetMenu()
{
if ( !m_text )
return;
-
+
wxSize sizeText = m_text->GetBestSize();
// make room for the search menu & clear button
int horizontalBorder = ( sizeText.y - sizeText.y * 14 / 21 ) / 2;
// position the subcontrols inside the client area
m_searchButton->SetSize(x, y + ICON_OFFSET - 1, sizeSearch.x, height);
- m_text->SetSize( x + sizeSearch.x + searchMargin,
+ m_text->SetSize( x + sizeSearch.x + searchMargin,
y + ICON_OFFSET - BORDER,
- textWidth,
+ textWidth,
height);
m_cancelButton->SetSize(x + sizeSearch.x + searchMargin + textWidth + cancelMargin,
y + ICON_OFFSET - 1, sizeCancel.x, height);
mem.DrawPolygon(WXSIZEOF(dropPolygon),dropPolygon,multiplier*triangleX,multiplier*triangleY);
}
mem.SelectObject(wxNullBitmap);
-
+
//===============================================================================
// end drawing code
//===============================================================================