#include <gtk/gtk.h>

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


int
main(int argc, char *argv[])
{
  GtkWidget *window;
  GtkWidget *text_view;
  GtkWidget *scrolled_window;
  GtkTextBuffer *buffer;

  gtk_init (&argc, &argv);

  /* Create a Window. */
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "Simple Multiline Text Input");

  /* Set a decent default size for the window. */
  gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
  g_signal_connect (G_OBJECT (window), "destroy",
                    G_CALLBACK (on_window_destroy),
                    NULL);

  scrolled_window = gtk_scrolled_window_new(FALSE, FALSE);

  /* Create a multiline text widget. */
  text_view = gtk_text_view_new ();
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view),
                               GTK_WRAP_WORD_CHAR);

  /* Obtaining the buffer associated with the widget. */
  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
  /* Set the default buffer text. */
  gtk_text_buffer_set_text (buffer, "A line with many??????????????????????????????????????????????????????????????????????????????????chars", -1);

  gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
  gtk_container_add (GTK_CONTAINER (window), scrolled_window);

  gtk_widget_show_all (window);

  gtk_main ();
  return 0;
}
