X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/930fb29eb860d7bcc1da3c7d98ff5342d2ada15a..2d17efa94e68c37fb415cf530daa558692ab7c2d:/src/generic/datectlg.cpp?ds=sidebyside diff --git a/src/generic/datectlg.cpp b/src/generic/datectlg.cpp index 97baf6e944..8a1c2bcf2e 100644 --- a/src/generic/datectlg.cpp +++ b/src/generic/datectlg.cpp @@ -155,10 +155,6 @@ bool wxDropdownButton::Create(wxWindow *parent, pos, wxDefaultSize, BTN_FLAGS, validator) ) return false; -#if (BTNFLAGS & wxBU_AUTODRAW ) == 0 - m_windowStyle |= wxBU_AUTODRAW; -#endif - const wxSize sz = GetSize(); int w = chkBmp.GetWidth(), h = chkBmp.GetHeight(); @@ -196,8 +192,36 @@ void wxDropdownButton::DoMoveWindow(int x, int y, int w, int h) wxBitmap bmp(bw, bh); dc.SelectObject(bmp); - wxRendererNative::Get().DrawComboBoxDropButton(this, dc, wxRect(0,0,bw, bh)); + wxRect r(0,0,bw, bh); + wxRendererNative& renderer = wxRendererNative::Get(); + +#ifdef __WXGTK__ + wxColour magic(255,0,255); + dc.SetBrush( wxBrush( magic ) ); + dc.SetPen( *wxTRANSPARENT_PEN ); + dc.DrawRectangle(0,0,bw,bh); + renderer.DrawComboBoxDropButton(this, dc, r); + wxMask *mask = new wxMask( bmp, magic ); + bmp.SetMask( mask ); +#else + renderer.DrawComboBoxDropButton(this, dc, r); +#endif SetBitmapLabel(bmp); + + wxBitmap bmpSel(bw, bh); + dc.SelectObject(bmpSel); + +#ifdef __WXGTK__ + dc.SetBrush( wxBrush( magic ) ); + dc.SetPen( *wxTRANSPARENT_PEN ); + dc.DrawRectangle(0,0,bw,bh); + renderer.DrawComboBoxDropButton(this, dc, r, wxCONTROL_PRESSED); + mask = new wxMask( bmpSel, magic ); + bmpSel.SetMask( mask ); +#else + renderer.DrawComboBoxDropButton(this, dc, r, wxCONTROL_PRESSED); +#endif + SetBitmapSelected(bmpSel); } wxBitmapButton::DoMoveWindow(x, y, w, h); @@ -341,7 +365,7 @@ bool wxDatePickerCtrlGeneric::Create(wxWindow *parent, wxFocusEventHandler(wxDatePickerCtrlGeneric::OnSetFocus)); wxClientDC dc(yearControl); - dc.SetFont(m_font); + dc.SetFont(yearControl->GetFont()); wxCoord width, dummy; dc.GetTextExtent(wxT("2000"), &width, &dummy); width += ConvertDialogToPixels(wxSize(20, 0)).x; @@ -375,10 +399,7 @@ bool wxDatePickerCtrlGeneric::Create(wxWindow *parent, m_popup->SetClientSize(panel->GetSize()); m_popup->Hide(); - if (!date.IsValid()) - date.Today(); - - SetValue(date); + SetValue(date.IsValid() ? date : wxDateTime::Today()); SetBestFittingSize(size); @@ -471,8 +492,8 @@ bool wxDatePickerCtrlGeneric::Enable(bool enable) if ( !enable ) { - if ( m_cal ) - m_cal->Hide(); + if ( m_popup ) + m_popup->Hide(); } if ( m_btn )