コード例 #1
0
ファイル: gnm-dao.c プロジェクト: nzinfo/gnumeric
GtkWidget *
gnm_dao_new (WBCGtk *wbcg, gchar *inplace_str)
{
	GnmDao *gdao = GNM_DAO (g_object_new (GNM_DAO_TYPE, NULL));
	GtkGrid *grid;

	g_return_val_if_fail (wbcg != NULL, NULL);
	gdao->wbcg = wbcg;

	/* Create the output range expression entry */
	grid = GTK_GRID (go_gtk_builder_get_widget (gdao->gui, "output-grid"));
	gdao->output_entry = gnm_expr_entry_new (wbcg, TRUE);
	gnm_expr_entry_set_flags (gdao->output_entry,
				  GNM_EE_SINGLE_RANGE, GNM_EE_MASK);
	gtk_widget_set_hexpand (GTK_WIDGET (gdao->output_entry), TRUE);
	gtk_grid_attach (grid, GTK_WIDGET (gdao->output_entry),
			  1, 3, 1, 1);
	go_atk_setup_label (gdao->output_range,
			     GTK_WIDGET (gdao->output_entry));
	gtk_widget_show (GTK_WIDGET (gdao->output_entry));
	/* Finished creating the output range expression entry */

	gnm_dao_set_inplace (gdao, inplace_str);
	gnm_dao_setup_signals (gdao);
	cb_set_sensitivity (NULL, gdao);

	return GTK_WIDGET (gdao);
}
コード例 #2
0
ファイル: gnm-dao.c プロジェクト: Ghnuberath/gnumeric
GtkWidget *
gnm_dao_new (WBCGtk *wbcg, gchar *inplace_str)
{
	GnmDao *gdao = GNM_DAO (g_object_new (GNM_DAO_TYPE, NULL));
	GtkTable *table;

	g_return_val_if_fail (wbcg != NULL, NULL);
	gdao->wbcg = wbcg;

	/* Create the output range expression entry */
	table = GTK_TABLE (glade_xml_get_widget (gdao->gui, "output-table"));
	gdao->output_entry = gnm_expr_entry_new (wbcg, TRUE);
	gnm_expr_entry_set_flags (gdao->output_entry,
				  GNM_EE_SINGLE_RANGE, GNM_EE_MASK);
	gtk_table_attach (table, GTK_WIDGET (gdao->output_entry),
			  2, 3, 3, 4,
			  GTK_EXPAND | GTK_FILL, 0,
			  0, 0);
	go_atk_setup_label (gdao->output_range,
			     GTK_WIDGET (gdao->output_entry));
	gtk_widget_show (GTK_WIDGET (gdao->output_entry));
	/* Finished creating the output range expression entry */

	gnm_dao_set_inplace (gdao, inplace_str);
	gnm_dao_setup_signals (gdao);
	cb_set_sensitivity (NULL, gdao);

	return GTK_WIDGET (gdao);
}
コード例 #3
0
ファイル: dialog-preferences.c プロジェクト: UIKit0/gnumeric
static void
pref_create_label (GOConfNode *node, GtkWidget *grid,
		   gint row, gchar const *default_label, GtkWidget *w)
{
	GtkWidget *label;

	if (NULL == default_label) {
		const char *desc = gnm_conf_get_short_desc (node);
		label = gtk_label_new (desc);
	} else
		label = gtk_label_new_with_mnemonic (default_label);

	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
	gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
	gtk_widget_set_hexpand (label, TRUE);
	gtk_grid_attach (GTK_GRID (grid), label, 0, row, 1, 1);

	gtk_label_set_mnemonic_widget (GTK_LABEL (label), w);
	go_atk_setup_label (label, w);
}
コード例 #4
0
/**
 * dialog_kaplan_meier_tool:
 * @wbcg:
 * @sheet:
 *
 * Show the dialog (guru).
 *
 **/
int
dialog_kaplan_meier_tool (WBCGtk *wbcg, Sheet *sheet)
{
        KaplanMeierToolState *state;
	GtkWidget *widget;
	char const * plugins[] = { "Gnumeric_fnstat",
				   "Gnumeric_fnlookup",
				   "Gnumeric_fnmath",
				   "Gnumeric_fninfo",
				   "Gnumeric_fnlogical",
				   NULL};

	if ((wbcg == NULL) ||
	    gnm_check_for_plugins_missing (plugins, wbcg_toplevel (wbcg)))
		return 1;

	/* Only pop up one copy per workbook */
	if (gnumeric_dialog_raise_if_exists (wbcg, KAPLAN_MEIER_KEY))
		return 0;

	state = g_new0 (KaplanMeierToolState, 1);

	if (dialog_tool_init (&state->base, wbcg, sheet,
			      GNUMERIC_HELP_LINK_KAPLAN_MEIER,
			      "kaplan-meier.glade", "KaplanMeier",
			      _("Could not create the Kaplan Meier Tool dialog."),
			      KAPLAN_MEIER_KEY,
			      G_CALLBACK (kaplan_meier_tool_ok_clicked_cb), NULL,
			      G_CALLBACK (kaplan_meier_tool_update_sensitivity_cb),
			      0))
		return 0;



	state->censorship_button = GTK_WIDGET (glade_xml_get_widget
						  (state->base.gui,
						   "censor-button"));
	state->censor_spin_from = GTK_WIDGET (glade_xml_get_widget
					      (state->base.gui,
					       "censored-spinbutton1"));
	gtk_spin_button_set_range (GTK_SPIN_BUTTON (state->censor_spin_from), 0.,G_MAXSHORT);
	state->censor_spin_to = GTK_WIDGET (glade_xml_get_widget
					    (state->base.gui,
					     "censored-spinbutton2"));
	gtk_spin_button_set_range (GTK_SPIN_BUTTON (state->censor_spin_to), 0.,G_MAXSHORT);
	state->graph_button = GTK_WIDGET (glade_xml_get_widget
						  (state->base.gui,
						   "graph-button"));
	state->tick_button = GTK_WIDGET (glade_xml_get_widget
						  (state->base.gui,
						   "tick-button"));
	state->add_group_button = GTK_WIDGET (glade_xml_get_widget
						  (state->base.gui,
						   "add-button"));
	state->remove_group_button = GTK_WIDGET (glade_xml_get_widget
						  (state->base.gui,
						   "remove-button"));
	state->std_error_button = GTK_WIDGET (glade_xml_get_widget
						  (state->base.gui,
						   "std-error-button"));
	state->logrank_button = GTK_WIDGET (glade_xml_get_widget
						  (state->base.gui,
						   "logrank-button"));

	state->groups_check = GTK_WIDGET (glade_xml_get_widget
						  (state->base.gui,
						   "groups-check"));
	state->groups_table = GTK_WIDGET (glade_xml_get_widget
						  (state->base.gui,
						   "groups-table"));
	state->groups_input = gnm_expr_entry_new (state->base.wbcg, TRUE);
	gnm_expr_entry_set_flags (state->groups_input, GNM_EE_FORCE_ABS_REF,
				  GNM_EE_MASK);
	gtk_table_attach (GTK_TABLE (state->groups_table), GTK_WIDGET (state->groups_input),
			  1, 3, 0, 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);

	dialog_kaplan_meier_tool_setup_treeview (state);

	g_signal_connect_after (G_OBJECT (state->groups_check),
		"toggled",
		G_CALLBACK (kaplan_meier_tool_update_sensitivity_cb), state);
	g_signal_connect_after (G_OBJECT (state->censorship_button),
		"toggled",
		G_CALLBACK (kaplan_meier_tool_update_sensitivity_cb), state);
	g_signal_connect_after (G_OBJECT (state->graph_button),
		"toggled",
		G_CALLBACK (kaplan_meier_tool_update_sensitivity_cb), state);
	g_signal_connect_after (G_OBJECT (state->std_error_button),
		"toggled",
		G_CALLBACK (kaplan_meier_tool_update_sensitivity_cb), state);
	g_signal_connect_after (G_OBJECT (state->groups_input),
				"changed",
				G_CALLBACK (kaplan_meier_tool_update_sensitivity_cb),
				state);

	g_signal_connect_after (G_OBJECT (state->groups_check),
		"toggled",
		G_CALLBACK (kaplan_meier_tool_update_groups_sensitivity_cb), state);
	g_signal_connect_after (G_OBJECT (state->tick_button),
		"toggled",
		G_CALLBACK (kaplan_meier_tool_set_graph_cb), state);
	g_signal_connect_after (G_OBJECT (state->add_group_button),
		"clicked",
		G_CALLBACK (kaplan_meier_tool_add_group_cb), state);
	g_signal_connect_after (G_OBJECT (state->remove_group_button),
		"clicked",
		G_CALLBACK (kaplan_meier_tool_remove_group_cb), state);
	g_signal_connect_after (G_OBJECT (state->censor_spin_from),
		"value-changed",
		G_CALLBACK (kaplan_meier_tool_set_censor_from_cb), state);
	g_signal_connect_after (G_OBJECT (state->censor_spin_to),
		"value-changed",
		G_CALLBACK (kaplan_meier_tool_set_censor_cb), state);
	g_signal_connect (G_OBJECT
			  (gnm_expr_entry_get_entry (
				  GNM_EXPR_ENTRY (state->base.input_entry_2))),
			  "focus-in-event",
			  G_CALLBACK (kaplan_meier_tool_set_censorship_cb), state);
	g_signal_connect (G_OBJECT
			  (gnm_expr_entry_get_entry (
				  GNM_EXPR_ENTRY (state->groups_input))),
			  "focus-in-event",
			  G_CALLBACK (kaplan_meier_tool_set_groups_cb), state);

	gnumeric_editable_enters (GTK_WINDOW (state->base.dialog),
					  GTK_WIDGET (state->groups_input));

	widget = glade_xml_get_widget (state->base.gui, "groups-label");
	gtk_label_set_mnemonic_widget (GTK_LABEL (widget),
				       GTK_WIDGET (state->groups_input));
	go_atk_setup_label (widget, GTK_WIDGET (state->groups_input));

	gnm_dao_set_put (GNM_DAO (state->base.gdao), TRUE, TRUE);
	kaplan_meier_tool_update_sensitivity_cb (NULL, state);
	kaplan_meier_tool_update_groups_sensitivity_cb (NULL, state);
	tool_load_selection ((GenericToolState *)state, TRUE);

	gtk_widget_show_all (GTK_WIDGET (state->base.dialog));
	/* And to hide the in-place button again */
	gnm_dao_set_inplace ( GNM_DAO (state->base.gdao), NULL);

        return 0;
}