GtkWidget *
lok_bag_pack_widget_new (LokGameWidget * game_widget)
{
  GtkWidget *widget;
  GtkWidget *view;
  GtkWidget *box;
  GtkWidget *button_pop, *button_use;
  GtkWidget *dialog, *content_area;
  LokBagPack *bag_pack;

  bag_pack = game_widget->game->hero->bag_pack;

  widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  view = create_view_and_model (game_widget);

  dialog = gtk_dialog_new ();
  content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));

  box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  gtk_box_pack_start (GTK_BOX (box), view, TRUE, TRUE, 1);


  button_pop = gtk_dialog_add_button (GTK_DIALOG (dialog), "POP",
      RESPONSE_ID_POP);
  button_use = gtk_dialog_add_button (GTK_DIALOG (dialog), "USE",
      RESPONSE_ID_USE);

  gtk_container_add (GTK_CONTAINER (content_area), box);

  game_widget->bag_pack_tree_model =\
      gtk_tree_view_get_model (GTK_TREE_VIEW (view));


  return dialog;
}
GtkWidget *
lok_bag_pack_widget_new (LokBagPack * bag_pack)
{
  GtkWidget *widget;
  GtkWidget *view;
  GtkWidget *box, *box_buttons;
  GtkWidget *button_pop;
  DummyType *dummy;

  widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  view = create_view_and_model (bag_pack);


  box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  gtk_box_pack_start (GTK_BOX (box), view, TRUE, TRUE, 1);

  button_pop = gtk_button_new_with_label ("POP");

  box_buttons = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
  gtk_box_pack_start (GTK_BOX (box_buttons), button_pop, TRUE, TRUE, 0);

  gtk_box_pack_start (GTK_BOX (box), box_buttons, TRUE, TRUE, 0);
  gtk_container_add (GTK_CONTAINER (widget), box);

  dummy = malloc (sizeof (DummyType));
  dummy->bag_pack = bag_pack;
  dummy->tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));

  g_signal_connect (G_OBJECT (button_pop), "clicked", G_CALLBACK (pop_item_cb),
      dummy);

  g_signal_connect (G_OBJECT (widget), "destroy", gtk_main_quit, NULL);

  return widget;
}
void create_Window()
{
	
	bdk_window.fenster = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_signal_connect(GTK_OBJECT(bdk_window.fenster), "destroy", GTK_SIGNAL_FUNC(gtk_main_quit),NULL);
	//g_signal_connect (G_OBJECT (fenster), "delete_event", G_CALLBACK (delete_event), NULL);
	gtk_window_set_title (GTK_WINDOW(bdk_window.fenster), "Bilddatenkompression(BDK) Tool");
	gtk_widget_set_size_request (GTK_WIDGET(bdk_window.fenster), 600, 600);

	/* Make a vbox to put the three menus in */
	bdk_window.main_vbox = gtk_vbox_new (FALSE, 1);
	gtk_container_set_border_width (GTK_CONTAINER (bdk_window.main_vbox), 1);
	gtk_container_add (GTK_CONTAINER (bdk_window.fenster), bdk_window.main_vbox);

	create_menubar_menu();
	create_toolbar_menu();

	bdk_window.image			= gtk_image_new_from_file("C:\\Dokumente und Einstellungen\\uwe_work\\Eigene Dateien\\Eigene Bilder\\Battlestar\\battlestargalpic_01.jpg");
	bdk_window.scrolled_window	= gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (bdk_window.scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (bdk_window.scrolled_window), bdk_window.image);

	bdk_window.hpaned = gtk_hpaned_new();
	create_view_and_model();
	gtk_paned_add1(GTK_PANED(bdk_window.hpaned), bdk_window.view);
	gtk_paned_add2(GTK_PANED(bdk_window.hpaned), bdk_window.scrolled_window);
	gtk_box_pack_start (GTK_BOX (bdk_window.main_vbox), bdk_window.hpaned, TRUE, TRUE, 0);
}
Esempio n. 4
0
int main(int argc, char **argv)
{
    GtkWidget *view;
    GtkWidget *window;
    GtkTreeSelection *selection;
    GtkWidget *vbox;
    GtkWidget *statusbar;
    
    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    gtk_window_set_title(GTK_WINDOW(window), "Tree View");
    gtk_widget_set_size_request(window, 200, 500);
    
    vbox = gtk_vbox_new(FALSE, 2);
    gtk_container_add(GTK_CONTAINER(window), vbox);

    view = create_view_and_model();
    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
        
    gtk_box_pack_start(GTK_BOX(vbox), view, TRUE, TRUE, 1);
    
    statusbar = gtk_statusbar_new();
    gtk_box_pack_start(GTK_BOX(vbox), statusbar, FALSE, TRUE, 1);
    
    g_signal_connect(view, "row-activated", (GCallback)view_onRowActivated, NULL);
    
    gtk_widget_show_all(window);
    
    gtk_main();

    return 0;
}
END_TEST

/**
 * Purpose: Check the construction of the scroll-area
 *          invalid values.
 * Cases considered:
 *    - Create with NULL widgets
 *    - Create with actual invalid widget instead of the scrolled-window
 *    - Create with actual invalid widget instead of the treeview
 */
START_TEST (test_create_scroll_area_invalid)
{
  GtkWidget *fixed;
  GtkWidget *label;
  GtkWidget *treew;
  GtkWidget *scroll_window;

  fixed = hildon_scroll_area_new(NULL, NULL);

  /* Test1: Create with NULL widgets */
  fail_if(fixed != NULL,
          "hildon-scroll-area: Invalid creation did not return a NULL value.");

  treew = create_view_and_model();
  label = gtk_label_new("This is an invalid example widget");
  fixed = hildon_scroll_area_new(label, treew);

  /* Test2: Create with actual invalid widget instead of the scrolled-window */
  if (GTK_FIXED(fixed)) 
    {    
      gtk_widget_destroy (GTK_WIDGET (label));
      gtk_widget_destroy (GTK_WIDGET (treew));
      fail ("hildon-scroll-area: Invalid creation did not return a NULL value when we set an invalid value in the first parameter.");
    }
  
  gtk_widget_destroy (GTK_WIDGET (label));
  gtk_widget_destroy (GTK_WIDGET (treew));

  scroll_window = gtk_scrolled_window_new(NULL, NULL);
  fixed = hildon_scroll_area_new(scroll_window, label);

  /* Test3: Create with actual invalid widget instead of the treeview */
  if (!GTK_FIXED(fixed))
    {      
      gtk_widget_destroy (GTK_WIDGET (scroll_window));
      fail ("hildon-scroll-area: Invalid creation returned a NULL value when we set an invalid value in the second parameter.");
    }
  
  gtk_widget_destroy (GTK_WIDGET (scroll_window));
  
}
Esempio n. 6
0
GtkWidget *
packet_list_create(void)
{
	GtkWidget *view, *scrollwin;

	scrollwin = scrolled_window_new(NULL, NULL);

	view = create_view_and_model();

	gtk_container_add(GTK_CONTAINER(scrollwin), view);

	g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_KEY, view);

	return scrollwin;
}
Esempio n. 7
0
GtkWidget *gui_amn_new(struct ps *ps)
{
	GtkWidget *scroll_widget;
	GtkWidget *view;

	scroll_widget = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_widget),
				       GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll_widget),
					    GTK_SHADOW_OUT);

	view = create_view_and_model(ps);
	g_signal_connect(view, "row-activated", G_CALLBACK(module_selected_cb), ps);

	//selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
	gtk_container_add(GTK_CONTAINER(scroll_widget), view);

	return scroll_widget;
}
Esempio n. 8
0
void
treeview_main (SCTX_ struct symbol_list *syms)
{
	GtkWidget *window, *view, *scrollwin;

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_default_size (GTK_WINDOW(window), 600, 800);
	g_signal_connect(window, "delete_event", gtk_main_quit, NULL);

	scrollwin = gtk_scrolled_window_new(NULL,NULL);

	view = create_view_and_model(sctx_ syms);

	gtk_container_add(GTK_CONTAINER(scrollwin), view);
	gtk_container_add(GTK_CONTAINER(window), scrollwin);

	gtk_widget_show_all(window);

	gtk_main();
}
Esempio n. 9
0
int
main (int argc, char **argv)
{
  GtkWidget *window;
  GtkWidget *view;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (window, "delete_event", gtk_main_quit, NULL); /* dirty */

  view = create_view_and_model ();

  gtk_container_add (GTK_CONTAINER (window), view);

  gtk_widget_show_all (window);

  gtk_main ();

  return 0;
}
Esempio n. 10
0
int
navdata_ihm_raw_navdata_create_window ()
{
	if (!window)
	{
		window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
		if (!window) { return -1; }
		gtk_window_set_default_size(GTK_WINDOW(window), 300, 200);
		gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);

		g_signal_connect(window, "delete_event", GTK_SIGNAL_FUNC(navdata_ihm_raw_navdata_window_was_destroyed), NULL); /* dirty */
		view = create_view_and_model();
		if (!view) { return -1; }

		gtk_container_add(GTK_CONTAINER(window), view);
	}

	gtk_widget_show_all(window);

	return 0;
}
Esempio n. 11
0
void
create_cells_window (char* filename)
{
  GtkWidget *window;
  GtkWidget *scrolled_window;
  GtkWidget *view;

  sqlite3* db;
  sqlite3_stmt* stmt;
  int rc;
  char** tables;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (window, "delete_event", gtk_main_quit, NULL); /* dirty */

  scrolled_window = create_scrolled_window();
  gtk_container_add (GTK_CONTAINER (window), scrolled_window);
  /* this is done with gtk_widget_show_all? */
  /* gtk_widget_show (scrolled_window); */

  rc = sqlite3_open_v2(filename, &db, SQLITE_OPEN_READONLY, NULL);
  assert(! rc);

  tables = get_tables(db);

  int tn = 3;
  printf("%s\n", tables[tn]);
  rc = prepare_get_records(db, tables[tn], &stmt);

  view = create_view_and_model(stmt);

  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window),
                                         view);

  gtk_widget_show_all (window);

  return;
}
Esempio n. 12
0
void nv_gui(int *argc, char ***argv)
{
	GtkWidget *window;
	GtkWidget *view;
	GtkWidget *vbox;

	gtk_init(argc, argv);

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
	gtk_window_set_title(GTK_WINDOW(window), "XMI View");
	gtk_widget_set_size_request (window, 350, 300);

	vbox = gtk_vbox_new(FALSE, 2);
	gtk_container_add(GTK_CONTAINER(window), vbox);

	view = create_view_and_model();
	gtk_box_pack_start(GTK_BOX(vbox), view, TRUE, TRUE, 1);
	g_signal_connect(G_OBJECT (window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
	gtk_widget_show_all(window);

	gtk_main();
}
Esempio n. 13
0
GtkWidget *
new_packet_list_create(void)
{
	GtkWidget *view, *scrollwin;

	scrollwin = scrolled_window_new(NULL, NULL);

	view = create_view_and_model();

	gtk_container_add(GTK_CONTAINER(scrollwin), view);

	/* XXX - Implement me
	g_signal_connect(view, "row-activated",
			 G_CALLBACK(popup_menu_handler),
			 g_object_get_data(G_OBJECT(popup_menu_object),
					   PM_PACKET_LIST_KEY));
	g_signal_connect(view, "button_press_event",
			 G_CALLBACK(new_packet_list_button_pressed_cb), NULL);
	*/

	g_object_set_data(G_OBJECT(popup_menu_object), E_MPACKET_LIST_KEY, view);

	return scrollwin;
}
Esempio n. 14
0
static void
fsearch_application_window_init (FsearchApplicationWindow *self)
{
    g_assert (FSEARCH_WINDOW_IS_WINDOW (self));

    gtk_widget_init_template (GTK_WIDGET (self));

    GtkCssProvider *provider = gtk_css_provider_new ();
    gtk_css_provider_load_from_resource (provider, "/org/fsearch/fsearch/shared.css");
    gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
                                    GTK_STYLE_PROVIDER (provider),
                                    GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
    g_object_unref (provider);

    create_view_and_model (self);
    //self->selection_popover = create_popover (self->selection_toggle_button);
    //g_signal_connect (self->selection_popover,
    //                  "closed",
    //                  G_CALLBACK (set_toggle_button),
    //                  (gpointer)self->selection_toggle_button);
    self->database_popover = create_popover (self->database_toggle_button);
    fill_database_popover (self->database_popover);
    g_signal_connect (self->database_popover,
                      "closed",
                      G_CALLBACK (set_toggle_button),
                      (gpointer)self->database_toggle_button);

    FsearchApplication *app = FSEARCH_APPLICATION_DEFAULT;
    g_signal_connect (app,
                      "database-update",
                      G_CALLBACK (update_database_cb),
                      self);
    g_signal_connect (app,
                      "database-updated",
                      G_CALLBACK (updated_database_cb),
                      self);

    g_signal_connect (gtk_icon_theme_get_default (),
                      "changed",
                      G_CALLBACK (icon_theme_changed_cb),
                      self);

    GtkBuilder *builder = gtk_builder_new_from_resource ("/org/fsearch/fsearch/overlay.ui");

    // Overlay when no search results are found
    self->no_search_results_overlay = GTK_WIDGET (gtk_builder_get_object (builder,
                                                                          "no_search_results"));
    gtk_overlay_add_overlay (GTK_OVERLAY (self->search_overlay),
                             self->no_search_results_overlay);

    // Overlay when database is empty
    self->empty_database_overlay = GTK_WIDGET (gtk_builder_get_object (builder,
                                                                       "empty_database"));
    gtk_overlay_add_overlay (GTK_OVERLAY (self->search_overlay),
                             self->empty_database_overlay);

    // Overlay when search query is empty
    self->empty_search_query_overlay = GTK_WIDGET (gtk_builder_get_object (builder,
                                                                           "empty_search_query"));
    gtk_overlay_add_overlay (GTK_OVERLAY (self->search_overlay),
                             self->empty_search_query_overlay);

    // Overlay when database is updating
    self->database_updating_overlay = GTK_WIDGET (gtk_builder_get_object (builder,
                                                                           "database_updating"));
    gtk_overlay_add_overlay (GTK_OVERLAY (self->search_overlay),
                             self->database_updating_overlay);
    self->database_updating_label = GTK_WIDGET (gtk_builder_get_object (builder,
                                                                        "database_updating_label"));

    g_object_unref (builder);
}
Esempio n. 15
0
File: scan.c Progetto: 4179e1/misc
void scan (Collection *collection) {
    GtkWidget *window;
    GtkWidget *vbox;
    GtkWidget *frame;
    GtkWidget *table;
    GtkWidget *entry_ip;
    GtkWidget *radio_button_single;
    GtkWidget *radio_button_multi;
    GtkWidget *entry_port;
    GtkWidget *entry_port_start;
    GtkWidget *entry_port_end;
    GtkWidget *entry_count;
    GtkWidget *label;
    GtkWidget *sw;
    GtkWidget *treeview;
    GtkWidget *progressbar;
    GtkWidget *hbuttonbox;

    GtkWidget *start;
    GtkWidget *end;

    ScanObject *scan_object;
    scan_object = g_slice_new (ScanObject);
    if (scan_object == NULL)
    {
        fprintf (stderr, "Error: not enough space\n");
        exit (1);
    }

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (window), "端口扫描");
    gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (collection->window));
    gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER_ON_PARENT);
    gtk_window_set_destroy_with_parent (GTK_WINDOW (window), TRUE);
    gtk_window_set_modal (GTK_WINDOW (window), TRUE);
    gtk_window_set_default_size (GTK_WINDOW (window), 400, 600);
    gtk_container_set_border_width (GTK_CONTAINER (window), 10);

    vbox = gtk_vbox_new(FALSE, 0);
    gtk_container_add (GTK_CONTAINER (window), vbox);

    frame = gtk_frame_new ("主机IP地址");
    gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 2);

    table = gtk_table_new (4, 7, FALSE);
    gtk_table_set_col_spacings (GTK_TABLE (table), 2);
    gtk_table_set_row_spacings (GTK_TABLE (table), 2);
    gtk_container_add (GTK_CONTAINER (frame), table);

    label = gtk_label_new ("IP地址");
    gtk_table_attach (GTK_TABLE (table), label, 0, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);

    entry_ip = gtk_entry_new();
    gtk_entry_set_text (GTK_ENTRY (entry_ip), "127.0.0.1");
    gtk_table_attach (GTK_TABLE (table), entry_ip, 2, 6, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);

    radio_button_single = gtk_radio_button_new_with_label (NULL, "扫描一个端口");
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button_single), TRUE);
    gtk_table_attach (GTK_TABLE (table), radio_button_single, 0, 2, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0);

    entry_port = gtk_entry_new();
    gtk_entry_set_text (GTK_ENTRY (entry_port), "135");
    gtk_widget_set_size_request (entry_port, 75, -1);
    gtk_table_attach (GTK_TABLE (table), entry_port, 2, 3, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0);

    radio_button_multi = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio_button_single), "扫描多个端口");
    gtk_table_attach (GTK_TABLE (table), radio_button_multi, 0, 2, 2, 3, GTK_SHRINK, GTK_SHRINK, 0, 0);

    entry_port_start = gtk_entry_new ();
    gtk_widget_set_size_request (entry_port_start, 75, -1);
    gtk_table_attach (GTK_TABLE (table), entry_port_start, 2, 3, 2, 3, GTK_SHRINK, GTK_SHRINK, 0, 0);

    label = gtk_label_new ("TO");
    gtk_table_attach (GTK_TABLE (table), label, 3, 4, 2, 3, GTK_SHRINK, GTK_SHRINK, 0, 0);

    entry_port_end = gtk_entry_new ();
    gtk_widget_set_size_request (entry_port_end, 75, -1);
    gtk_table_attach (GTK_TABLE (table), entry_port_end, 4, 5, 2, 3, GTK_SHRINK, GTK_SHRINK, 0, 0);

    label = gtk_label_new ("尝试扫描次数");
    gtk_table_attach (GTK_TABLE (table), label, 0, 2, 3, 4, GTK_SHRINK, GTK_SHRINK, 0, 0);

    entry_count = gtk_entry_new ();
    gtk_entry_set_text (GTK_ENTRY (entry_count), "3");
    gtk_widget_set_size_request (entry_count, 75, -1);
    gtk_table_attach (GTK_TABLE (table), entry_count, 2, 3, 3, 4, GTK_SHRINK, GTK_SHRINK, 0, 0);

    label = gtk_label_new ("扫描结果");
    gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 2);

    sw = gtk_scrolled_window_new (NULL, NULL);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 2);

    treeview = create_view_and_model ();
    gtk_container_add (GTK_CONTAINER (sw), treeview);

    progressbar = gtk_progress_bar_new();
    gtk_box_pack_start (GTK_BOX (vbox), progressbar, FALSE, FALSE, 2);

    hbuttonbox = gtk_hbutton_box_new();
    gtk_box_pack_start (GTK_BOX (vbox), hbuttonbox, FALSE, FALSE, 2);

    start = gtk_button_new_with_label ("开始");
    gtk_box_pack_start (GTK_BOX (hbuttonbox), start, FALSE, FALSE, 2);

    end = gtk_button_new_with_label ("结束");
    gtk_box_pack_start (GTK_BOX (hbuttonbox), end, FALSE, FALSE, 2);

    scan_object->scan_window = window;
    scan_object->entry_ip = entry_ip;
    scan_object->radio_button_single = radio_button_single;
    scan_object->radio_button_multi = radio_button_multi;
    scan_object->entry_port = entry_port;
    scan_object->entry_port_start = entry_port_start;
    scan_object->entry_port_end = entry_port_end;
    scan_object->entry_count = entry_count;
    scan_object->treeview = treeview;
    scan_object->progressbar = progressbar;


    g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (on_window_destroy), scan_object);

    g_signal_connect (GTK_BUTTON (start), "clicked", G_CALLBACK (on_start_clicked), scan_object);

    g_signal_connect (GTK_BUTTON (end), "clicked", G_CALLBACK (on_end_clicked), NULL);

    gtk_widget_show_all (window);
}