Example #1
0
void update_screen (int priority, char *msg, enum pic_type 
            pic_on_screen_val, boolean crit_path_button_enabled) {

/* Updates the screen if the user has requested graphics.  The priority  *
 * value controls whether or not the Proceed button must be clicked to   *
 * continue.  Saves the pic_on_screen_val to allow pan and zoom redraws. */

 if (!show_graphics)         /* Graphics turned off */
    return;  


/* If it's the type of picture displayed has changed, set up the proper  *
 * buttons.                                                              */

 if (pic_on_screen != pic_on_screen_val) {
    if (pic_on_screen_val == PLACEMENT && pic_on_screen == NO_PICTURE) {
       create_button ("Window", "Toggle Nets", toggle_nets);
    }

    else if (pic_on_screen_val == ROUTING && pic_on_screen == PLACEMENT) {
       create_button ("Toggle Nets", "Toggle RR", toggle_rr);
       create_button ("Toggle RR", "Congestion", toggle_congestion);

       if (crit_path_button_enabled) 
          create_button ("Congestion", "Crit. Path", highlight_crit_path);
    }

    else if (pic_on_screen_val == PLACEMENT && pic_on_screen == ROUTING) {
       destroy_button ("Toggle RR");
       destroy_button ("Congestion");

       if (crit_path_button_enabled) 
          destroy_button ("Crit. Path");
    }
 }

/* Save the main message. */

 strncpy (default_message, msg, BUFSIZE);

 pic_on_screen = pic_on_screen_val;
 update_message (msg); 
 drawscreen();
 if (priority >= gr_automode) {

    event_loop(highlight_blocks, drawscreen);
 }

 else {
    flushinput();
 }
}
Example #2
0
void DesktopExample::OnCreateWindowClick() {
	++m_count;

	// Create a new window.
	sfg::Window::Ptr window( sfg::Window::Create() );

	std::stringstream sstr;
	sstr << "A new window (" << m_count << ")";
	window->SetTitle( sstr.str() );

	// Widgets.
	sfg::Button::Ptr destroy_button( sfg::Button::Create( "Destroy" ) );
	sfg::Button::Ptr front_button( sfg::Button::Create( "Main window to front" ) );

	// Layout.
	sfg::Box::Ptr box( sfg::Box::Create( sfg::Box::VERTICAL, 5.f ) );
	box->Pack( sfg::Label::Create( "This is a newly created window, from runtime, interactively." ), false );
	box->Pack( sfg::Label::Create( "You can move me around, try it!" ), false );
	box->Pack( sfg::Label::Create( "Or click the button below to destroy me. :-(" ), false );
	box->Pack( destroy_button, false );
	box->Pack( front_button, false );

	window->Add( box );
	m_desktop.Add( window );

	// Signals.
	destroy_button->GetSignal( sfg::Widget::OnLeftClick ).Connect( &DesktopExample::OnDestroyWindowClick, this );
	front_button->GetSignal( sfg::Widget::OnLeftClick ).Connect( &DesktopExample::OnFrontClick, this );
}
Example #3
0
void buttons_destroy_all(Buttons *buttons)
{
  gbitmap_destroy(buttons->background);
  buttons->background = NULL;
  destroy_button(buttons->hunger_button);
  destroy_button(buttons->flush_button);
  destroy_button(buttons->exercise_button);
  destroy_button(buttons->medicine_button);
  destroy_button(buttons->sleep_button);
  destroy_button(buttons->settings_button);
  free(buttons);
}