Пример #1
0
        void initialize_dialog()
        {
            m_base.set_text(m_message_catalog.get(TETENGO2_TEXT("Dialog:About:About")));

            m_p_application_image = create_application_image();
            m_p_title_label = create_title_label();
            m_p_copyright_label = create_copyright_label();
            m_p_link_label = create_link_label();
            m_p_ok_button = create_ok_button();

            locate_controls();
        }
Пример #2
0
/**
 * \brief Create the static text components.
 */
void ptb::frame_play_story::create_controls()
{
  m_thumb = new bear::gui::picture( get_default_thumb() );
  m_name_text = new bear::gui::scene_element();
  m_status_picture = new bear::gui::picture( get_status_picture() );

  get_content().insert( m_thumb );
  get_content().insert( m_name_text );
  get_content().insert( m_status_picture );

  m_second_player_status.energy = new horizontal_gauge
    ( get_layer().get_level().get_globals(), 100, "bar (light blue)",
      "bar (red)", "heart", true );

  m_first_player_status.energy = new horizontal_gauge
    ( get_layer().get_level().get_globals(), 100, "bar (green)",
      "bar (red)", "heart", true );

  create_player_component(m_first_player_status);
  create_player_component(m_second_player_status);
  create_bonus_component();

  bear::gui::visual_component* ok = create_ok_button();
  bear::gui::visual_component* back = create_back_button();
  bear::gui::visual_component* previous = create_previous_button();
  bear::gui::visual_component* next = create_next_button();

  position_controls( ok->top() + get_margin() );

  bear::gui::size_type sum_w
    ( 3 * get_margin() + ok->width() + back->width() + previous->width()
      + next->width() );

  const bear::gui::size_type w
    ( (m_bonus->width() + m_thumb->width() + 2*get_margin() - sum_w) / 3);

  back->set_left( ok->right() + w );
  previous->set_left( back->right() + w );
  next->set_right( m_status_picture->right() );

  ok->set_focus();

  fit( get_margin() );
} // frame_play_story::create_controls()
Пример #3
0
/**
 * \brief Create the static text components.
 */
void ptb::frame_profiles::create_controls()
{
  bear::visual::font font = get_font();

  m_profiles = create_profiles_radio_buttons( font );
  bear::gui::visual_component* ok_button = create_ok_button( font );
  bear::gui::visual_component* cancel_button = create_back_button( font );
  bear::gui::visual_component* remove_button = create_remove_button( font );

  ok_button->set_top( m_profiles->bottom() - get_margin() );

  cancel_button->set_top( ok_button->top() );
  cancel_button->set_left( ok_button->right() + get_margin() );

  remove_button->set_top( ok_button->top() );
  remove_button->set_left( cancel_button->right() + get_margin() );

  ok_button->set_focus();
  update_controls();

  fit( get_margin() );
} // frame_profiles::create_controls()
Пример #4
0
int main (int argc, char *argv[])
{
   gchar *ok_label = NULL;
   gchar *cancel_label = NULL;
   gint c,cont;
/*-------------*/
#ifdef ENABLE_NLS
  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif
  setlocale(LC_ALL,"es_ES");
/*-------------*/
   gtk_init (&argc, &argv);
   
   win = gtk_dialog_new ();
   if (!win) quit (RETURN_ERROR_NOMEM);
   gtk_signal_connect ((GtkObject *)win, "delete_event", // quit if window
		       GTK_SIGNAL_FUNC (cancel_cb), NULL);// gets closed
   msgbox = gtk_vbox_new (FALSE, 0);
   if (!msgbox) quit (RETURN_ERROR_NOMEM);
   gtk_container_set_border_width((GtkContainer *)msgbox, 5);
   //gtk_box_pack_start_defaults ((GtkBox*)(((GtkDialog*)win)->vbox), msgbox);
 
    // para que no haya límite al minimizar 
    gtk_window_set_policy (GTK_WINDOW(win), TRUE,TRUE,FALSE);
    //
   gtk_box_pack_start ((GtkBox*)(((GtkDialog*)win)->vbox), msgbox,TRUE,TRUE,0);
   cont=0; 
   while ((c = getopt (argc, argv, "h?m:t:p:E::e::d:B::b::r:X::x::z:Z:c:C:a::o:N::n::")) != -1)
     {
	extern char *optarg;
	extern int optind;
	switch (c)
	  {
	   case 't':  
	     Debug("set window title: %s\n", optarg);
	     gtk_window_set_title ((GtkWindow *)win, (gchar *)optarg);
	     break;
	   case 'c':
	   case 'C':
	     create_check_button(optarg, c=='C');
	     Debug("checkbox: %s\n",optarg);
	     break;
	   case 'p':
	     create_text_prompt(optarg);
	     break;
	   case 'e':
	   case 'E':  
	     create_entry_field(optarg, c=='E');
	     Debug("text entry field: %s\n", optarg);
	     break;
	   case 'd':
	     last_entry_default(optarg);
	     Debug("defaults to: %s\n", optarg);
	     break;
	   case 'b':
	   case 'B':
	     create_combo_field(optarg,c=='B');
	     Debug("defaults to: %s\n", optarg);
	     break;
	   case 'r':
	     last_combo_default(optarg);
	     Debug("defaults to: %s\n", optarg);
	     break;
	   case 'x':
	   case 'X':
	     create_text_field(optarg, c=='X');
	     Debug("text field: %s\n", optarg);
	     break;
	   case 'n':
	   case 'N':
	     create_text_paned(optarg, c=='N');
	     Debug("text paned: %s\n", optarg);
	     break;
	   case 'z':
	   case 'Z':
	     last_text_default(optarg,c=='Z',++cont);
	     Debug("defaults to: %s\n", optarg);
	     break;
	   case 'm':
	     optind = create_option_menu(optind, optarg, argv);
	     break;
	   case 'o':
	     ok_label = (gchar *)optarg;
	     break;
	   case 'a':
	     if(optarg) {
		cancel_label = (gchar *)optarg;
	     } else {
		/* set to an impossible value, so that we know later on, that
		 * we don't want to create the cancel button.
		 */
		cancel_label = (gchar *)win;
	     } 
	     break;
	   case '?':
	   case 'h':
	     fputs(GREQ_VERSION, stderr);
	     fprintf(stderr,"Usage: %s [-t<window-title>] [-p<text-prompt>] [[-(e | E)[<entry-label>] [-d<default-value>]] [-(c | C)<checkbox-label>] [-m<menu-label> <menu-item> ...] [-o<ok-label>] [-a[<abort-label>]]\n", argv[0]);
	     quit(RETURN_ERROR_ARG);
	  }
     }
   
   if ( optind < argc )
     {
	fprintf(stderr, "%s: Unknown argument", argv[0]);
	if (optind < argc - 1) fputc ('s', stderr);
	fputc(':',stderr);
	do {
	   fputc(' ', stderr);
	   fputs(argv[optind++], stderr);
	} while (optind < argc);
	fputc('\n', stderr);
	quit(RETURN_ERROR_ARG);
     }
   
   create_ok_button(ok_label);
   if(cancel_label != (gchar *)win)
     create_cancel_button(cancel_label);

#if GTK_MAJOR_VERSION < 2
   if(widgets) {
      Debug ("Setting focus\n");
      gtk_widget_grab_focus((GtkWidget *) widgets->data);
   };
#endif
   
   gtk_widget_show_all (win);
   gtk_main();
   
   // we should never get here, but just to make gcc happy
   return (RETURN_OK);
}