/* 
   make "CFLAGS=`pkg-config gtk+-2.0 --cflags`" \
        "LDFLAGS=`pkg-config gtk+-2.0 --libs`" paned
*/

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

int main(int argc, char **argv)
{
    gtk_init(&argc, &argv);

    GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_container_set_border_width(GTK_CONTAINER(window), 5);
    gtk_window_set_default_size(GTK_WINDOW(window), 500, 200);

    GtkWidget *paned = gtk_hpaned_new();
    gtk_container_add(GTK_CONTAINER(window), paned);

    GtkWidget *scroll1 = gtk_scrolled_window_new(0, 0);
    gtk_scrolled_window_set_shadow_type(
            GTK_SCROLLED_WINDOW(scroll1), GTK_SHADOW_ETCHED_IN);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll1),
            GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
    gtk_paned_pack1(GTK_PANED(paned), scroll1, TRUE, FALSE);
    GtkWidget *text1 = gtk_text_view_new();
    gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text1)),
            "some text for line1\nsome text for line2\nsome text for line3",-1);
    gtk_container_add(GTK_CONTAINER(scroll1), text1);

    GtkWidget *scroll2 = gtk_scrolled_window_new(0, 0);
    gtk_scrolled_window_set_shadow_type(
            GTK_SCROLLED_WINDOW(scroll2), GTK_SHADOW_ETCHED_IN);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll2),
            GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
    gtk_paned_pack2(GTK_PANED(paned), scroll2, TRUE, FALSE);
    GtkWidget *text2 = gtk_text_view_new();
    gtk_text_view_set_justification(GTK_TEXT_VIEW(text2), GTK_JUSTIFY_RIGHT);
    gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text2)),
            "some text for line1\nsome text for line2\nsome text for line3",-1);
    gtk_container_add(GTK_CONTAINER(scroll2), text2);

    gtk_widget_show_all(window);

    gtk_main();

    return 0;
}

