From e14b589e8e4036ae2581b3a196139f7bdbcfbdfb Mon Sep 17 00:00:00 2001 From: John Roberts Date: Sat, 27 Feb 2016 16:31:47 +0100 Subject: [PATCH] Add support for right-aligned checkboxes to wxOSX Honour wxALIGN_RIGHT style. Closes #17380. --- docs/changes.txt | 1 + interface/wx/checkbox.h | 3 +-- src/osx/cocoa/checkbox.mm | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index c626ad1145..9f36db6ef1 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -234,3 +234,4 @@ wxOSX/Cocoa: - Don't generate wxEVT_TEXT_ENTER for controls without wxTE_PROCESS_ENTER. - Implement wxToolTip::SetDelay() (David Vanderson). - Correct positioning of popup menus relative to mouse pointer (John Roberts). +- Add support for right-aligned checkboxes (John Roberts). diff --git a/interface/wx/checkbox.h b/interface/wx/checkbox.h index c54231bc7c..203928873c 100644 --- a/interface/wx/checkbox.h +++ b/interface/wx/checkbox.h @@ -56,8 +56,7 @@ enum wxCheckBoxState It can only be done from code. Using this flags allows the user to set the checkbox to the third state by clicking. @style{wxALIGN_RIGHT} - Makes the text appear on the left of the checkbox. Not implemented - in wxOSX. + Makes the text appear on the left of the checkbox. @endStyleTable @beginEventEmissionTable{wxCommandEvent} diff --git a/src/osx/cocoa/checkbox.mm b/src/osx/cocoa/checkbox.mm index 941ea79a5a..8a8dddeabd 100644 --- a/src/osx/cocoa/checkbox.mm +++ b/src/osx/cocoa/checkbox.mm @@ -28,6 +28,8 @@ wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer, wxNSButton* v = [[wxNSButton alloc] initWithFrame:r]; [v setButtonType:NSSwitchButton]; + if (style & wxALIGN_RIGHT) + [v setImagePosition:NSImageRight]; if (style & wxCHK_3STATE) [v setAllowsMixedState:YES];