Don't show wxDatePickerCtrl as being disabled when it isn't in wxOSX.

Use setDrawsBackground: to fix the background colour and adjust the text
colour whenever the control is enabled or disabled.

See #16807.
This commit is contained in:
John Roberts
2015-07-18 15:15:51 +02:00
committed by Vadim Zeitlin
parent 5ceb470c91
commit 9bedba0bf3

View File

@@ -128,6 +128,26 @@ public:
}
}
virtual void Enable(bool enable = true)
{
wxNSDatePicker* const nsdatePicker = View();
[nsdatePicker setEnabled: enable];
if ( enable )
{
wxWindow* const wxpeer = GetWXPeer();
if ( wxpeer )
[nsdatePicker setTextColor: wxpeer->GetForegroundColour().OSXGetNSColor()];
else
[nsdatePicker setTextColor: [NSColor controlTextColor]];
}
else
{
[nsdatePicker setTextColor: [NSColor disabledControlTextColor]];
}
}
private:
wxNSDatePicker* View() const
{
@@ -170,6 +190,9 @@ wxDateTimeWidgetImpl::CreateDateTimePicker(wxDateTimePickerCtrl* wxpeer,
[v setDatePickerStyle: NSTextFieldAndStepperDatePickerStyle];
// Avoid a disabled looking transparent background for the text cells.
[v setDrawsBackground: YES];
if ( dt.IsValid() )
{
[v setDateValue: NSDateFromWX(dt)];