Ejemplo n.º 1
0
/*----------------------------------------------------------------------
 *  void install_buffer( PLStream *pls )
 *
 *  If this driver is called from a command line executable (and not
 *  from within a wxWidgets program), this function prepares a DC and a
 *  bitmap to plot into.
 *----------------------------------------------------------------------*/
static void install_buffer( PLStream *pls )
{
  // Log_Verbose( "install_buffer" );

  wxPLDevBase* dev = (wxPLDevBase*)pls->dev;
  static bool initApp=false;

  if( !initApp ) {
    /* this hack enables to have a GUI on Mac OSX even if the
       program was called from the command line (and isn't a bundle) */
#ifdef __WXMAC__
    ProcessSerialNumber psn;

    GetCurrentProcess( &psn );
    CPSEnableForegroundOperation( &psn );
    SetFrontProcess( &psn );
#endif

    /* initialize wxWidgets */
    wxInitialize();
    wxLog::GetActiveTarget();
    wxTRY {
      wxPLGetApp().CallOnInit();
    }
    wxCATCH_ALL( wxPLGetApp().OnUnhandledException(); plexit( "Can't init wxWidgets!"); )
Ejemplo n.º 2
0
//! This method is called right at the beginning and opens a frame for us.
//
bool MyApp::OnInit()
{
#ifdef __WXMAC__
    // this hack enables to have a GUI on Mac OSX even if the
    // program was called from the command line (and isn't a bundle)
    ProcessSerialNumber psn;

    GetCurrentProcess( &psn );
    CPSEnableForegroundOperation( &psn );
    SetFrontProcess( &psn );
#endif

    wxPLplotwindow<wxFrame> *frame = new wxPLplotwindow<wxFrame>();
    frame->Create( NULL, wxID_ANY, wxT( "wxPLplotDemo" ) );
    frame->SetIcon( wxIcon( graph ) );
    frame->Show();
    Plot( frame );

    return true;
}
Ejemplo n.º 3
0
bool RubyApp::OnInit()
{
	wxApp::OnInit();

#ifdef __WXMAC__
     ProcessSerialNumber psn;
 
     GetCurrentProcess( &psn );
     CPSEnableForegroundOperation( &psn );
     SetFrontProcess( &psn );
#endif

	RubyWX::Color::define_const();
	RubyWX::Font::define_const();
	RubyWX::Brush::define_const();
	RubyWX::Pen::define_const();

#if wxUSE_INTL
	wxLocale::CreateLanguagesDB();
	mLocale = new wxLocale(wxLANGUAGE_DEFAULT);
	mLocale->AddCatalog("wxstd");
#ifdef __LINUX__
	mLocale->AddCatalog("fileutils");
#endif
#endif
#if wxUSE_PROPGRID
	wxPropertyGrid::RegisterAdditionalEditors();
#endif

	this->Bind(wxEVT_ASYNC_METHOD_CALL,AppAfter());

	ruby_app_inited = true;

	bool result = RTEST(rb_funcall(mRuby, rb_intern("on_init"), 0));
	if(rb_block_given_p())
		rb_obj_instance_eval(0, 0, mRuby);
	return result;
}