Temp hack for square looking buttons on OSX.

This commit is contained in:
Jeff Young 2020-11-13 17:52:08 +00:00
parent 34b13e66bf
commit bfe750f88a
1 changed files with 21 additions and 1 deletions

View File

@ -35,6 +35,7 @@
#include <wx/app.h> #include <wx/app.h>
#include <wx/event.h> #include <wx/event.h>
#include <wx/grid.h> #include <wx/grid.h>
#include <wx/bmpbuttn.h>
#include <algorithm> #include <algorithm>
@ -178,6 +179,7 @@ int DIALOG_SHIM::VertPixelsFromDU( int y )
// our hashtable is an implementation secret, don't need or want it in a header file // our hashtable is an implementation secret, don't need or want it in a header file
#include <hashtables.h> #include <hashtables.h>
#include <typeinfo> #include <typeinfo>
#include <wx/osx/bmpbuttn.h>
static RECT_MAP class_map; static RECT_MAP class_map;
@ -279,15 +281,33 @@ static void selectAllInTextCtrls( wxWindowList& children )
{ {
for( wxWindow* child : children ) for( wxWindow* child : children )
{ {
if( auto childTextCtrl = dynamic_cast<wxTextCtrl*>( child ) ) if( wxTextCtrl* childTextCtrl = dynamic_cast<wxTextCtrl*>( child ) )
{ {
// Respect an existing selection // Respect an existing selection
if( childTextCtrl->GetStringSelection().IsEmpty() ) if( childTextCtrl->GetStringSelection().IsEmpty() )
childTextCtrl->SelectAll(); childTextCtrl->SelectAll();
} }
#ifdef __WXMAC__
// Temp hack for square (looking) buttons on OSX. Will likely be made redundant
// by the image store....
else if( dynamic_cast<wxBitmapButton*>( child ) != nullptr )
{
wxSize minSize( 29, 27 );
wxRect rect = child->GetRect();
child->ConvertDialogToPixels( minSize );
rect.Inflate( std::max( 0, minSize.x - rect.GetWidth() ),
std::max( 0, minSize.y - rect.GetHeight() ) );
child->SetSize( rect );
}
#endif
else else
{
selectAllInTextCtrls( child->GetChildren() ); selectAllInTextCtrls( child->GetChildren() );
} }
}
} }