KiCad PCB EDA Suite
test_app_main.cpp File Reference
#include <typeinfo>
#include <macros.h>
#include <wx/filename.h>
#include <wx/stdpaths.h>
#include <wx/snglinst.h>
#include <wx/html/htmlwin.h>
#include <pgm_base.h>
#include <kiface_i.h>
#include <kiway.h>
#include <kiway_player.h>
#include <confirm.h>
#include <settings/settings_manager.h>
#include <qa_utils/utility_registry.h>

Go to the source code of this file.

Classes

struct  IFACE
 
struct  PGM_TEST_FRAME
 
struct  APP_TEST
 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...
 

Functions

IFACE KIFACE_I kiface ("pcb_test_frame", KIWAY::FACE_PCB)
 
 IFACE (const char *aName, KIWAY::FACE_T aType)
 
bool OnKifaceStart (PGM_BASE *aProgram, int aCtlBits) override
 
void OnKifaceEnd () override
 
wxWindow * CreateWindow (wxWindow *aParent, int aClassId, KIWAY *aKiway, int aCtlBits=0) override
 
void * IfaceOrAddress (int aDataId) override
 Function IfaceOrAddress return a pointer to the requested object. More...
 
KIWAY KiwayPgm (), KFCTL_STANDALONE
 The global Program "get" accessor. More...
 
PGM_BASEPgmOrNull ()
 similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from a script, not from a kicad appl More...
 
KIFACE_IKiface ()
 Global KIFACE_I "get" accessor. More...
 
void SetTopFrame (wxFrame *aFrame)
 
 IMPLEMENT_APP_NO_MAIN (APP_TEST)
 
int main (int argc, char **argv)
 

Variables

PGM_TEST_FRAME program
 

Function Documentation

◆ CreateWindow()

wxWindow* kiface::CreateWindow ( wxWindow *  aParent,
int  aClassId,
KIWAY aKiway,
int  aCtlBits = 0 
)
override

Definition at line 100 of file test_app_main.cpp.

100  {
101  printf("Destroy\n");
102  Kiway.OnKiwayEnd();
103 
104  // Destroy everything in PGM_BASE, especially wxSingleInstanceCheckerImpl
void OnKiwayEnd()
Definition: kiway.cpp:614
KIWAY Kiway

References PGM_BASE::Destroy(), Kiway, and KIWAY::OnKiwayEnd().

◆ IFACE()

kiface::IFACE ( const char *  aName,
KIWAY::FACE_T  aType 
)

Definition at line 89 of file test_app_main.cpp.

95  : public PGM_BASE
Container for data for KiCad programs.
Definition: pgm_base.h:130

◆ IfaceOrAddress()

void* kiface::IfaceOrAddress ( int  aDataId)
override

Function IfaceOrAddress return a pointer to the requested object.

The safest way to use this is to retrieve a pointer to a static instance of an interface, similar to how the KIFACE interface is exported. But if you know what you are doing use it to retrieve anything you want.

Parameters
aDataIdidentifies which object you want the address of.
Returns
void* - and must be cast into the know type.

Definition at line 117 of file test_app_main.cpp.

◆ IMPLEMENT_APP_NO_MAIN()

IMPLEMENT_APP_NO_MAIN ( APP_TEST  )

◆ kiface()

IFACE KIFACE_I kiface ( "pcb_test_frame"  ,
KIWAY::FACE_PCB   
)
static

Referenced by Kiface().

◆ Kiface()

KIFACE_I& Kiface ( )

Global KIFACE_I "get" accessor.

Definition at line 145 of file test_app_main.cpp.

146 {
147  return kiface;
148 }
IFACE KIFACE_I kiface("pcb_test_frame", KIWAY::FACE_PCB)

References kiface(), and BMP2CMP::kiface().

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 256 of file test_app_main.cpp.

257 {
258  wxInitialize( argc, argv );
259 
260  Pgm().InitPgm();
261 
262  auto ret = wxEntry( argc, argv );
263 
264  // This causes some glib warnings on GTK3 (http://trac.wxwidgets.org/ticket/18274)
265  // but without it, Valgrind notices a lot of leaks from WX
266  wxUninitialize();
267 
268  return ret;
269 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.

References Pgm().

◆ OnKifaceEnd()

void kiface::OnKifaceEnd ( )
override

Definition at line 98 of file test_app_main.cpp.

100 {

◆ OnKifaceStart()

bool kiface::OnKifaceStart ( PGM_BASE aProgram,
int  aCtlBits 
)
override

Definition at line 93 of file test_app_main.cpp.

95  : public PGM_BASE
96 {
Container for data for KiCad programs.
Definition: pgm_base.h:130

◆ Pgm()

KIWAY Kiway & Pgm ( )

The global Program "get" accessor.

Implemented in: 1) common/single_top.cpp, 2) kicad/kicad.cpp, and 3) scripting/kiway.i

Definition at line 131 of file test_app_main.cpp.

132 {
133  return program;
134 }
PGM_TEST_FRAME program

References program.

Referenced by main(), and SetTopFrame().

◆ PgmOrNull()

PGM_BASE* PgmOrNull ( )

similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from a script, not from a kicad appl

Definition at line 139 of file test_app_main.cpp.

140 {
141  return &program;
142 }
PGM_TEST_FRAME program

References process, and program.

◆ SetTopFrame()

void SetTopFrame ( wxFrame *  aFrame)

Definition at line 246 of file test_app_main.cpp.

247 {
248  Pgm().App().SetTopWindow( aFrame ); // wxApp gets a face.
249  aFrame->Show();
250 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.

References Pgm().

Variable Documentation

◆ program