KiCad PCB EDA Suite
APP_SINGLE_TOP Struct Reference

Struct APP_SINGLE_TOP implements a bare naked wxApp (so that we don't become dependent on functionality in a wxApp derivative that we cannot deliver under wxPython). More...

Inheritance diagram for APP_SINGLE_TOP:

Public Member Functions

 APP_SINGLE_TOP ()
 
bool OnInit () override
 
int OnExit () override
 
int OnRun () override
 
int FilterEvent (wxEvent &aEvent) override
 

Detailed Description

Struct APP_SINGLE_TOP implements a bare naked wxApp (so that we don't become dependent on functionality in a wxApp derivative that we cannot deliver under wxPython).

Definition at line 132 of file single_top.cpp.

Constructor & Destructor Documentation

◆ APP_SINGLE_TOP()

APP_SINGLE_TOP::APP_SINGLE_TOP ( )
inline

Definition at line 134 of file single_top.cpp.

134  : wxApp()
135  {
136  // Init the environment each platform wants
138  }
void Init()
Perform environment initialization tasks.

References KIPLATFORM::ENV::Init().

Member Function Documentation

◆ FilterEvent()

int APP_SINGLE_TOP::FilterEvent ( wxEvent &  aEvent)
inlineoverride

Definition at line 206 of file single_top.cpp.

207  {
208  if( aEvent.GetEventType() == wxEVT_SHOW )
209  {
210  wxShowEvent& event = static_cast<wxShowEvent&>( aEvent );
211  wxDialog* dialog = dynamic_cast<wxDialog*>( event.GetEventObject() );
212 
213  if( dialog && dialog->IsModal() )
214  Pgm().m_ModalDialogCount += event.IsShown() ? 1 : -1;
215  }
216 
217  return Event_Skip;
218  }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106

References Pgm().

◆ OnExit()

int APP_SINGLE_TOP::OnExit ( )
inlineoverride

Definition at line 175 of file single_top.cpp.

176  {
177  program.OnPgmExit();
178  return wxApp::OnExit();
179  }
void OnPgmExit()
Definition: single_top.cpp:70
PGM_SINGLE_TOP program

References PGM_SINGLE_TOP::OnPgmExit(), and program.

◆ OnInit()

bool APP_SINGLE_TOP::OnInit ( )
inlineoverride

Definition at line 141 of file single_top.cpp.

142  {
143  // Perform platform-specific init tasks
144  if( !KIPLATFORM::APP::Init() )
145  return false;
146 
147  // Force wxHtmlWinParser initialization when a wxHtmlWindow is used only
148  // in a shared library (.so or .dll file)
149  // Otherwise the Html text is displayed as plain text.
150  HtmlModule html_init;
151 
152  try
153  {
154  return program.OnPgmInit();
155  }
156  catch( const std::exception& e )
157  {
158  wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
159  FROM_UTF8( typeid( e ).name() ), FROM_UTF8( e.what() ) );
160  }
161  catch( const IO_ERROR& ioe )
162  {
163  wxLogError( ioe.What() );
164  }
165  catch(...)
166  {
167  wxLogError( wxT( "Unhandled exception of unknown type" ) );
168  }
169 
170  program.OnPgmExit();
171 
172  return false;
173  }
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110
void OnPgmExit()
Definition: single_top.cpp:70
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
bool Init()
Perform application-specific initialization tasks.
Definition: gtk/app.cpp:40
const char * name
Definition: DXF_plotter.cpp:56
PGM_SINGLE_TOP program
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75

References FROM_UTF8(), KIPLATFORM::APP::Init(), name, PGM_SINGLE_TOP::OnPgmExit(), PGM_SINGLE_TOP::OnPgmInit(), program, and IO_ERROR::What().

◆ OnRun()

int APP_SINGLE_TOP::OnRun ( )
inlineoverride

Definition at line 181 of file single_top.cpp.

182  {
183  int ret = -1;
184 
185  try
186  {
187  ret = wxApp::OnRun();
188  }
189  catch( const std::exception& e )
190  {
191  wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
192  FROM_UTF8( typeid( e ).name() ), FROM_UTF8( e.what() ) );
193  }
194  catch( const IO_ERROR& ioe )
195  {
196  wxLogError( ioe.What() );
197  }
198  catch(...)
199  {
200  wxLogError( wxT( "Unhandled exception of unknown type" ) );
201  }
202 
203  return ret;
204  }
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
const char * name
Definition: DXF_plotter.cpp:56
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75

References FROM_UTF8(), name, and IO_ERROR::What().


The documentation for this struct was generated from the following file: