Ejemplo n.º 1
0
void KeyOptionView::_createItem() {
	myKeyEntry = GTK_ENTRY(gtk_entry_new());
	gtk_signal_connect(GTK_OBJECT(myKeyEntry), "focus_in_event", G_CALLBACK(key_view_focus_in_event), 0);
	gtk_signal_connect(GTK_OBJECT(myKeyEntry), "focus_out_event", G_CALLBACK(key_view_focus_out_event), 0);
	gtk_signal_connect(GTK_OBJECT(myKeyEntry), "key_press_event", G_CALLBACK(key_view_key_press_event), this);
	key_view_focus_out_event(GTK_WIDGET(myKeyEntry), 0, 0);

	myLabel = GTK_LABEL(gtkLabel(ZLResource::resource("keyOptionView")["actionFor"].value()));

	myComboBox = GTK_COMBO_BOX(gtk_combo_box_new_text());
	const std::vector<std::string> &actions = ((ZLKeyOptionEntry&)*myOption).actionNames();
	for (std::vector<std::string>::const_iterator it = actions.begin(); it != actions.end(); ++it) {
		gtk_combo_box_append_text(myComboBox, it->c_str());
	}

	myTable = GTK_TABLE(gtk_table_new(2, 2, false));
	gtk_table_set_col_spacings(myTable, 5);
	gtk_table_set_row_spacings(myTable, 5);
	gtk_table_attach_defaults(myTable, GTK_WIDGET(myLabel), 0, 1, 0, 1);
	gtk_table_attach_defaults(myTable, GTK_WIDGET(myKeyEntry), 1, 2, 0, 1);
	gtk_table_attach_defaults(myTable, GTK_WIDGET(myComboBox), 0, 2, 1, 2);
	g_signal_connect(GTK_WIDGET(myComboBox), "changed", G_CALLBACK(_onValueChanged), this);

	myHolder.attachWidget(*this, GTK_WIDGET(myTable));
}
Ejemplo n.º 2
0
void KeyOptionView::_createItem() {
	myKeyButton = gtk_button_new();
	gtk_signal_connect(GTK_OBJECT(myKeyButton), "focus_in_event", G_CALLBACK(key_view_focus_in_event), 0);
	gtk_signal_connect(GTK_OBJECT(myKeyButton), "focus_out_event", G_CALLBACK(key_view_focus_out_event), 0);
	gtk_signal_connect(GTK_OBJECT(myKeyButton), "key_press_event", G_CALLBACK(key_view_key_press_event), this);
	gtk_signal_connect(GTK_OBJECT(myKeyButton), "button_press_event", G_CALLBACK(key_view_button_press_event), this);
	key_view_focus_out_event(myKeyButton, 0, 0);

	myLabel = gtk_label_new("");

	myComboBox = gtk_option_menu_new();
	const std::vector<std::string> &actions = ((ZLKeyOptionEntry*)myOption)->actionNames();
	GtkWidget *menu = gtk_menu_new();
	for (std::vector<std::string>::const_iterator it = actions.begin(); it != actions.end(); ++it) {
		GtkWidget *menuItem = gtk_menu_item_new_with_label(it->c_str());
		gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuItem);
		gtk_widget_show(menuItem);
	}
	gtk_option_menu_set_menu(GTK_OPTION_MENU(myComboBox), menu);

	myWidget = gtk_table_new(2, 2, false);
	gtk_table_set_col_spacings(GTK_TABLE(myWidget), 5);
	gtk_table_set_row_spacings(GTK_TABLE(myWidget), 5);
	gtk_table_attach_defaults(GTK_TABLE(myWidget), myKeyButton, 0, 2, 0, 1);
	gtk_table_attach_defaults(GTK_TABLE(myWidget), myLabel, 0, 1, 1, 2);
	gtk_table_attach_defaults(GTK_TABLE(myWidget), myComboBox, 1, 2, 1, 2);
	g_signal_connect(myComboBox, "changed", G_CALLBACK(_onValueChange), this);

	myTab->addItem(myWidget, myRow, myFromColumn, myToColumn);
}