Logo Search packages:      
Sourcecode: teg version File versions  Download package

GtkWidget * create_mainwin ( void   ) 

Crea la ventana principal

Definition at line 437 of file interface.c.

{
      GtkWidget *app1;
      GtkWidget *dock1;
      GtkWidget *eventbox1;
      GtkWidget *viewport1;
      GtkWidget *vbox_main;
      GtkWidget *vbox_paned;
      GtkWidget *scrolledwindow;
      GtkWidget *paned;
      GtkWidget *text;
      GtkWidget *inputline;
      GtkWidget *sw;
      GtkWidget *ahbox;

      app1 = gnome_app_new ( PACKAGE, "Tenes Empanadas Graciela");
      gtk_object_set_data (GTK_OBJECT (app1), "app1", app1);
      gtk_window_set_default_size (GTK_WINDOW (app1), 664, 640);
      gtk_window_set_policy (GTK_WINDOW (app1), TRUE, TRUE, FALSE);

      dock1 = GNOME_APP (app1)->dock;
      gtk_widget_ref (dock1);
      gtk_object_set_data_full (GTK_OBJECT (app1), "dock1", dock1,
            (GtkDestroyNotify) gtk_widget_unref);
      gtk_widget_show (dock1);

      gnome_app_create_menus (GNOME_APP (app1), menubar_uiinfo);
      gnome_app_create_toolbar(GNOME_APP(app1), toolbar_main);

      /* TODO: ask in GNOME if this is wanted */
      /* gtk_menu_item_right_justify( GTK_MENU_ITEM(menubar_uiinfo[4].widget)); */

      gtk_widget_realize (app1);

      gtk_signal_connect ( GTK_OBJECT(app1), "destroy",
            GTK_SIGNAL_FUNC( on_exit_activate ), NULL );

      gtk_signal_connect ( GTK_OBJECT(app1), "delete_event",
            GTK_SIGNAL_FUNC( on_exit_activate ), NULL );


      SensiData.connect_button = toolbar_main[0].widget;
      SensiData.start_button = toolbar_main[1].widget;
      /* 2 is a separator */
      SensiData.enviarfichas_button = toolbar_main[3].widget;
      SensiData.reagrupe_button = toolbar_main[4].widget;
      SensiData.getcard_button = toolbar_main[5].widget;
      SensiData.endturn_button = toolbar_main[6].widget;
      /* 7 is a separator */
      SensiData.status_button = toolbar_main[8].widget;

      eventbox1 = gtk_event_box_new ();
      gtk_widget_ref (eventbox1);
      gtk_object_set_data_full (GTK_OBJECT (app1), "eventbox1", eventbox1,
            (GtkDestroyNotify) gtk_widget_unref);
      gtk_widget_show (eventbox1);
      gnome_app_set_contents (GNOME_APP (app1), eventbox1);

      viewport1 = gtk_viewport_new (NULL, NULL);
      gtk_widget_show (viewport1);
      gtk_container_add (GTK_CONTAINER (eventbox1), viewport1);

      vbox_main = gtk_vbox_new (FALSE, 0);
      gtk_widget_show (vbox_main);
      gtk_container_add (GTK_CONTAINER (viewport1), vbox_main);

      /* status map */
      if( mainstatus_create(&window_mainstatus) != TEG_STATUS_SUCCESS )
            goto error;
      gtk_box_pack_start( GTK_BOX(vbox_main), window_mainstatus, FALSE,FALSE,0);

      /* paned */
      paned = gtk_vpaned_new();
      gtk_box_pack_start( GTK_BOX( vbox_main ), paned, TRUE, TRUE, 0 );
      vbox_paned = gtk_vbox_new (FALSE, 0);
      gtk_paned_add1(GTK_PANED(paned), vbox_paned);
      gtk_widget_show (vbox_paned);

      /* map */
      scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
      gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(scrolledwindow),
                  GTK_POLICY_AUTOMATIC,
                  GTK_POLICY_AUTOMATIC);
      gtk_widget_set_usize(scrolledwindow, 640, 394);

      if( canvas_create_map() != TEG_STATUS_SUCCESS )
            goto error;

      gtk_container_add(GTK_CONTAINER(scrolledwindow), canvas_map);
      gtk_container_add(GTK_CONTAINER(vbox_paned),scrolledwindow);
      gtk_widget_show (canvas_map);
      gtk_widget_show (scrolledwindow);


      /* text */
      ahbox = gtk_hbox_new(FALSE, 2);
      gtk_paned_pack2(GTK_PANED(paned), ahbox, TRUE, TRUE);

      sw = gtk_scrolled_window_new(NULL, NULL);

      gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC,
                               GTK_POLICY_ALWAYS);
      gtk_box_pack_start(GTK_BOX(ahbox), sw, TRUE, TRUE, 0);

      gtk_widget_set_size_request(sw, 620, 60);

      text = gtk_text_view_new();
      gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
      gtk_container_add(GTK_CONTAINER(sw), text);

      gtk_widget_set_name(text, "chatline");

      gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
      gtk_widget_realize(text);
      gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 5);

      main_message_area = GTK_TEXT_VIEW(text);

/*    set_output_window_text(_("Tenes Empanadas Graciela")); */

      gtk_widget_show(text);
      gtk_widget_show(sw);
      gtk_widget_show(ahbox);
      gtk_widget_show(paned);

      /* the chat line */
      inputline = gtk_entry_new();
      gtk_box_pack_start( GTK_BOX( vbox_main ), inputline, FALSE, FALSE, 0 );
      gtk_widget_show(inputline);
      g_signal_connect(inputline, "activate", G_CALLBACK(inputline_return), NULL);


      chatline_init();


      /* status bar */
      statusbar = gnome_appbar_new (FALSE, TRUE, GNOME_PREFERENCES_NEVER);
      gtk_widget_ref (statusbar);
      gtk_object_set_data_full (GTK_OBJECT (app1), "statusbar", statusbar,
            (GtkDestroyNotify) gtk_widget_unref);
      gtk_widget_show (statusbar);
      gnome_app_set_statusbar (GNOME_APP (app1), statusbar);

      gtk_box_pack_start(GTK_BOX(statusbar),
            ministatus_build(), FALSE, TRUE, 0);


      gnome_appbar_set_status(GNOME_APPBAR(statusbar),
                        _("Welcome to TEG!"));

      gnome_app_install_menu_hints( GNOME_APP(app1), menubar_uiinfo );

      /* icono */
      {
            GdkBitmap *mask;
            GdkPixmap *icono;
            #include "../teg_pix/teg_icono.xpm"
            gtk_widget_realize (app1);
            icono = gdk_pixmap_create_from_xpm_d( app1->window, &mask, &app1->style->bg[GTK_STATE_NORMAL],teg_icono_xpm );
            gdk_window_set_icon (app1->window, NULL, icono , mask );
      }

      gtk_widget_show(app1);
      return app1;

error:
      g_error(_("Unable to create map!"));
      return NULL;
}


Generated by  Doxygen 1.6.0   Back to index