// wxWindow overrides
virtual bool SetFont(const wxFont& font);
+ virtual bool SetBackgroundColour(const wxColour& colour);
// search control generic only
void SetSearchBitmap( const wxBitmap& bitmap );
private:
friend class wxSearchButton;
+ // Implement pure virtual function inherited from wxCompositeWindow.
+ virtual wxWindowList GetCompositeWindowParts() const;
+
#if wxUSE_MENUS
void PopupSearchMenu();
#endif // wxUSE_MENUS
// no native version, use the generic one
#define wxUSE_NATIVE_SEARCH_CONTROL 0
+ #include "wx/compositewin.h"
#include "wx/containr.h"
class WXDLLIMPEXP_CORE wxSearchCtrlBaseBaseClass
- : public wxNavigationEnabled<wxControl>,
+ : public wxCompositeWindow< wxNavigationEnabled<wxControl> >,
public wxTextCtrlIface
{
};
m_cancelBitmap);
SetForegroundColour( m_text->GetForegroundColour() );
- m_searchButton->SetForegroundColour( m_text->GetForegroundColour() );
- m_cancelButton->SetForegroundColour( m_text->GetForegroundColour() );
-
SetBackgroundColour( m_text->GetBackgroundColour() );
- m_searchButton->SetBackgroundColour( m_text->GetBackgroundColour() );
- m_cancelButton->SetBackgroundColour( m_text->GetBackgroundColour() );
RecalcBitmaps();
y + ICON_OFFSET - 1, sizeCancel.x, height);
}
+wxWindowList wxSearchCtrl::GetCompositeWindowParts() const
+{
+ wxWindowList parts;
+ parts.push_back(m_text);
+ parts.push_back(m_searchButton);
+ parts.push_back(m_cancelButton);
+ return parts;
+}
// accessors
// ---------
bool wxSearchCtrl::SetFont(const wxFont& font)
{
- bool result = wxSearchCtrlBase::SetFont(font);
- if ( result && m_text )
- {
- result = m_text->SetFont(font);
- }
+ if ( !wxSearchCtrlBase::SetFont(font) )
+ return false;
+
+ // Recreate the bitmaps as their size may have changed.
RecalcBitmaps();
- return result;
+
+ return true;
+}
+
+bool wxSearchCtrl::SetBackgroundColour(const wxColour& colour)
+{
+ if ( !wxSearchCtrlBase::SetBackgroundColour(colour) )
+ return false;
+
+ // When the background changes, re-render the bitmaps so that the correct
+ // colour shows in their "transparent" area.
+ RecalcBitmaps();
+
+ return true;
}
// search control generic only