void
TApplication::ReadyToRun()
{
	EAlert *alert = new EAlert("Question",
				   "Would you like to run the scroll-test?\nChoose \"Cancel\" to quit.",
				   "Cancel", "OK", NULL,
				   E_WIDTH_AS_USUAL, E_IDEA_ALERT);

	if(alert->Go() != 1)
	{
		Quit();
		return;
	}

	TWindow *win = new TWindow(ERect(100, 100, 550, 500), "Scroll Test", E_TITLED_WINDOW, 0);
	win->Show();
}
Beispiel #2
0
void TMyApp::HandleEvent(TEvent& e)
{
  TProgram::HandleEvent(e);
  if (e.type&evMessage) {
    TMessage m(e.msg);
    switch (m.message) {
       case cmNuevo:
	 doc->newDoc();
	 canvas->doDraw();
       break;
       case cmAbrir: {
	 TFileDialog *d = new TFileDialog ("Abrir archivo", ".ggg");
	 TRect r (d->Bounds);
	 r.centeron (Application->Bounds);
	 d->move (r.a.x, r.a.y);
	 d->doDraw();
	 ExecView (d);
	 if (d->isok) {
	   char s1[256];
	   sprintf( s1, "%s", d->filelist->getabsolute() );
	   if ( !doc->load( s1 ) ) {
	     doc->newDoc();
	     canvas->doDraw();
	     MessageBox( "Error al leer el archivo %s",
	       d->filename->text );
	   } else {
	     canvas->moveall( canvas->Bounds.a.x, canvas->Bounds.a.y );
	     canvas->doDraw();
	   }
	 }
	 delete d;
	 mainWindow->GotFocus();
       } break;
       case cmGuardar: {
	 TFileDialog *d = new TFileDialog ("Guardar archivo", ".ggg");
	 TRect r (d->Bounds);
	 r.centeron (Application->Bounds);
	 d->move (r.a.x, r.a.y);
	 d->doDraw();
	 ExecView (d);
	 if (d->isok) {
	   canvas->moveall( -canvas->Bounds.a.x, -canvas->Bounds.a.y );
	   if ( !doc->save( d->filename->text ) )
	     MessageBox( "No se pudo guardar el archivo %s\n",
	       d->filename->text);
	   canvas->moveall( canvas->Bounds.a.x, canvas->Bounds.a.y );
	 }
	 delete d;
	 mainWindow->GotFocus();
       } break;
       case cmSalir:
	 SetState( stModal, 0 ); break;
       case cmBorrar:
	 if (selectc) {
	   doc->delComponent( selectc );
	   doc->purgeNodes();
	   canvas->doDraw();
	   selectc = NULL;
	 }
       break;
       case cmPropiedades:
	 if (selectc) {
	   if (selectc->doDialog())
	     do_draw_comps();
	   mainWindow->GotFocus();
	 }
       break;
       case cmSimOn:
	 simOn = true;
	 led->On();
	 do_draw_nodes();
       break;
       case cmSimOff:
	 simOn = false;
	 led->Off();
	 do_draw_nodes();
       break;
       case cmAcerca_de: {
	 TWindow *w = new AboutOneSHOT();
	 w->Show();
	 ExecView (w);
	 delete w;
	 mainWindow->GotFocus();
       } break;
    }
  }
  if (simOn) {
    QComponent *c;
    for (c=doc->comps; c; c=c->next)
	c->sim();
    if (e.type&evTimerOut)
      for (c=doc->comps; c; c=c->next)
	c->simTick();
    if (doc->modified) {
      do_draw_nodes();
      doc->modified = false;
    }
  }
}
Beispiel #3
0
void
TApplication::ReadyToRun()
{
	TWindow *win = new TWindow(BRect(100, 100, 500, 500), "Button Test", B_TITLED_WINDOW, 0);
	win->Show();
}
Beispiel #4
0
// pass in pixelCount to maintain backward compatibility of setting
// the pixelcount from the command line
TApp::TApp(int32 pixelCount)
	: BApplication("application/x-vnd.Haiku-Magnify")
{
	TWindow* magWindow = new TWindow(pixelCount);
	magWindow->Show();
}