KiCad PCB EDA Suite
dialog_shim.cpp File Reference
#include <dialog_shim.h>
#include <kiway_player.h>
#include <pgm_base.h>
#include <tool/tool_manager.h>
#include <kiplatform/ui.h>
#include <wx/display.h>
#include <wx/evtloop.h>
#include <wx/app.h>
#include <wx/event.h>
#include <wx/grid.h>
#include <wx/bmpbuttn.h>
#include <wx/textctrl.h>
#include <wx/stc/stc.h>
#include <algorithm>
#include <hashtables.h>
#include <typeinfo>

Go to the source code of this file.

Classes

class  WDO_ENABLE_DISABLE
 Toggle a window's "enable" status to disabled, then enabled on destruction. More...
 

Functions

static void selectAllInTextCtrls (wxWindowList &children)
 

Variables

static std::unordered_map< std::string, wxRect > class_map
 

Function Documentation

◆ selectAllInTextCtrls()

static void selectAllInTextCtrls ( wxWindowList &  children)
static

Definition at line 321 of file dialog_shim.cpp.

322 {
323  for( wxWindow* child : children )
324  {
325  if( wxTextCtrl* childTextCtrl = dynamic_cast<wxTextCtrl*>( child ) )
326  {
327  // We don't currently run this on GTK because some window managers don't hide the
328  // selection in non-active controls, and other window managers do the selection
329  // automatically anyway.
330 #if defined( __WXMAC__ ) || defined( __WXMSW__ )
331  if( !childTextCtrl->GetStringSelection().IsEmpty() )
332  {
333  // Respect an existing selection
334  }
335  else
336  {
337  childTextCtrl->SelectAll();
338  }
339 #endif
340  }
341  else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( child ) )
342  {
343  if( !scintilla->GetSelectedText().IsEmpty() )
344  {
345  // Respect an existing selection
346  }
347  else
348  {
349  scintilla->SelectAll();
350  }
351  }
352 #ifdef __WXMAC__
353  // Temp hack for square (looking) buttons on OSX. Will likely be made redundant
354  // by the image store....
355  else if( dynamic_cast<wxBitmapButton*>( child ) != nullptr )
356  {
357  wxSize minSize( 29, 27 );
358  wxRect rect = child->GetRect();
359 
360  child->ConvertDialogToPixels( minSize );
361 
362  rect.Inflate( std::max( 0, minSize.x - rect.GetWidth() ),
363  std::max( 0, minSize.y - rect.GetHeight() ) );
364 
365  child->SetMinSize( rect.GetSize() );
366  child->SetSize( rect );
367  }
368 #endif
369  else
370  {
371  selectAllInTextCtrls( child->GetChildren() );
372  }
373  }
374 }
const int minSize
Push and Shove router track width and via size dialog.
static void selectAllInTextCtrls(wxWindowList &children)

References minSize.

Referenced by DIALOG_SHIM::OnPaint().

Variable Documentation

◆ class_map

std::unordered_map<std::string, wxRect> class_map
static