#!/usr/bin/python

import sys
import glib
from gi.repository import Gdk, Gtk


class TestWindow(Gtk.Window):
    __gtype_name = "TestWindow"
    
    def __init__(self, with_tab = False):
        super(TestWindow, self).__init__()
        self.connect("destroy", self.destroy_cb)
        self.set_title("Test window")
        self.ta = Gtk.TextView()
        if with_tab:
            self.notebook = Gtk.Notebook()
            self.notebook.append_page(self.ta, Gtk.Label("TextArea test"))
            self.add(self.notebook)
        else:
            self.add(self.ta)
        g = Gdk.Geometry()
        g.min_width = 8
        g.min_height = 15
        g.base_width = 0
        g.base_height = 0
        g.width_inc = 8
        g.height_inc = 15
        h = Gdk.WindowHints
        self.set_geometry_hints(self.ta, g,
                h.MIN_SIZE | h.BASE_SIZE | h.RESIZE_INC)
        self.set_default_geometry(80, 36)
        self.show_all()
    
    def destroy_cb(self, *args):
        Gtk.main_quit()


w = TestWindow("-t" in sys.argv)
Gtk.main()
