#include <gtk/gtk.h>
#include <glib.h>

GtkWidget* window;

void on_window_destroy (GtkWidget *widget, gpointer user_data)
{
	gtk_main_quit ();
}

int main (int argc, char** argv)
{
	gtk_set_locale ();
	gtk_init (&argc, &argv);
	
	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	
	GtkWidget *textview1 = gtk_text_view_new ();
	GtkWidget *textview2 = gtk_text_view_new ();
	GtkWidget *textview3 = gtk_text_view_new ();
	GtkWidget *textview4 = gtk_text_view_new ();
	GtkWidget *textview5 = gtk_text_view_new ();
	GtkWidget *textview6 = gtk_text_view_new ();
	GtkWidget *vbox = gtk_vbox_new (TRUE, 0);
	
	gtk_container_add (GTK_CONTAINER (window), vbox);

	gtk_box_pack_start_defaults (GTK_BOX (vbox), textview1);
	gtk_box_pack_start_defaults (GTK_BOX (vbox), textview2);
	gtk_box_pack_start_defaults (GTK_BOX (vbox), textview3);
	gtk_box_pack_start_defaults (GTK_BOX (vbox), textview4);
	gtk_box_pack_start_defaults (GTK_BOX (vbox), textview5);
	gtk_box_pack_start_defaults (GTK_BOX (vbox), textview6);

	GtkTextBuffer *buf1 = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview1));
	GtkTextBuffer *buf2 = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview2));
	GtkTextBuffer *buf3 = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview3));
	GtkTextBuffer *buf4 = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview4));
	GtkTextBuffer *buf5 = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview5));
	GtkTextBuffer *buf6 = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview6));
	
	gtk_text_buffer_set_text (buf1, "Begin:\tLeft Tab\tCenter Tab\tRight Tab\tabc123456.78de", -1);
	gtk_text_buffer_set_text (buf2, "0\t>\t|\t<\t.", -1);
	gtk_text_buffer_set_text (buf3, "Begin:\tLeft Tab\tCenter Tab\tRight Tab\tabc123456.78de", -1);
	gtk_text_buffer_set_text (buf4, "0\t>\t|\t<\t.", -1);
	gtk_text_buffer_set_text (buf5, "התחלה:\tטאב שמאלי\tטאב אמצעי\tטאב ימני\tאבג123456.78דה", -1);
	gtk_text_buffer_set_text (buf6, "‏0\t>\t|\t<\t.", -1);

	PangoTabArray *tabs1 = pango_tab_array_new_with_positions (4, TRUE, 
											PANGO_TAB_LEFT, 100,
											PANGO_TAB_CENTER, 300,
											PANGO_TAB_RIGHT, 500,
					/*PANGO_TAB_NUMERIC*/	PANGO_TAB_RIGHT, 700);
	
	PangoTabArray *tabs2 = pango_tab_array_new_with_positions (4, TRUE, 
											PANGO_TAB_LEFT, 100,
											PANGO_TAB_CENTER, 150,
											PANGO_TAB_RIGHT, 200,
					/*PANGO_TAB_NUMERIC*/	PANGO_TAB_RIGHT, 250);
	
	gtk_text_view_set_tabs (GTK_TEXT_VIEW (textview1), tabs1);
	gtk_text_view_set_tabs (GTK_TEXT_VIEW (textview2), tabs1);
	gtk_text_view_set_tabs (GTK_TEXT_VIEW (textview3), tabs2);
	gtk_text_view_set_tabs (GTK_TEXT_VIEW (textview4), tabs2);
	gtk_text_view_set_tabs (GTK_TEXT_VIEW (textview5), tabs1);
	gtk_text_view_set_tabs (GTK_TEXT_VIEW (textview6), tabs1);

	gtk_widget_set_direction (textview5, GTK_TEXT_DIR_RTL);
	gtk_widget_set_direction (textview6, GTK_TEXT_DIR_RTL);
	
	g_signal_connect ((gpointer) window, "destroy",
			G_CALLBACK (on_window_destroy),
			NULL);
	
	gtk_widget_show_all (window);
	gtk_main ();
	return 0;
}
