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.
Closes #16807.
(this is a backport of 9bedba0bf3
from master)
This commit is contained in:
committed by
Vadim Zeitlin
parent
9153da02e7
commit
3cae6b0b82
@@ -640,6 +640,7 @@ wxOSX:
|
|||||||
- Fix handling of "Cancel" button in wxSearchCtrl (John Roberts).
|
- Fix handling of "Cancel" button in wxSearchCtrl (John Roberts).
|
||||||
- Generate correct events for WXK_NUMPAD_ENTER (John Roberts).
|
- Generate correct events for WXK_NUMPAD_ENTER (John Roberts).
|
||||||
- Fix handling of WXK_NUMPAD_ENTER in wxTextCtrl (John Roberts).
|
- Fix handling of WXK_NUMPAD_ENTER in wxTextCtrl (John Roberts).
|
||||||
|
- Don't show wxDatePickerCtrl as being disabled when it isn't (John Roberts).
|
||||||
- Generate wxEVT_TEXT_ENTER for wxTE_PASSWORD controls too (mj_smoker).
|
- Generate wxEVT_TEXT_ENTER for wxTE_PASSWORD controls too (mj_smoker).
|
||||||
- Send wxIconizeEvent when a window is iconized/restore (Rob Krakora).
|
- Send wxIconizeEvent when a window is iconized/restore (Rob Krakora).
|
||||||
- Use correct colour for disabled wxStaticText (sbrowne).
|
- Use correct colour for disabled wxStaticText (sbrowne).
|
||||||
|
@@ -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:
|
private:
|
||||||
wxNSDatePicker* View() const
|
wxNSDatePicker* View() const
|
||||||
{
|
{
|
||||||
@@ -170,6 +190,9 @@ wxDateTimeWidgetImpl::CreateDateTimePicker(wxDateTimePickerCtrl* wxpeer,
|
|||||||
|
|
||||||
[v setDatePickerStyle: NSTextFieldAndStepperDatePickerStyle];
|
[v setDatePickerStyle: NSTextFieldAndStepperDatePickerStyle];
|
||||||
|
|
||||||
|
// Avoid a disabled looking transparent background for the text cells.
|
||||||
|
[v setDrawsBackground: YES];
|
||||||
|
|
||||||
if ( dt.IsValid() )
|
if ( dt.IsValid() )
|
||||||
{
|
{
|
||||||
[v setDateValue: NSDateFromWX(dt)];
|
[v setDateValue: NSDateFromWX(dt)];
|
||||||
|
Reference in New Issue
Block a user