suggestions on creating "blurb" boxes



I'm still tinkering with GTK, and I have a few questions on the GtkText
type.

I've been using gtk_text_new to create a text box to contain a small blurb,
such as found in most 'about' box.

Here's my questions...

1. The text box seems to be of set size.  If I usize the window to a
   smaller v-length, the "close" button will be clipped out.  Can I
   decrease the size of the text box?

2. Do I have to use the GtkAdjustment values in gtk_text_new to affect
   this?  If so, how do I use them?

3. Are text boxes always "recessed", do I have to use a label in order to
   create a "flat" surface appearance for a text blurb?

4. gtk_widget_realize, uhm, I use it, I saw it textgtk.c, but I not 100%
   sure what it does.

d.

snippet follows:

void
text_append_line (GtkWidget *text, gchar *data)
{
	gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black,
                         NULL, data, -1);
}

void
menu_help_create_about (GtkWidget *widget, gpointer *data)
{
	GtkWidget *text;
	GtkWidget *window;
	GtkWidget *layout;

	/* create bare bones window with border width of 1 */
	window = create_window_main ("Sample: about Sample", 1);

	/* create a vbox 'layout' for window */
	layout = create_window_layout (window);
	gtk_container_add (GTK_CONTAINER (window), layout);

	/* create text object */
	text = gtk_text_new (NULL, NULL);
	gtk_text_set_editable (GTK_TEXT (text), FALSE);

	gtk_box_pack_start (GTK_BOX (layout), text, TRUE, TRUE, 0);
	gtk_widget_show (text);

	/* program will segfault w/o this */
	gtk_widget_realize (text);

	text_append_line (text, "Sample: sample GTK program\n");
	text_append_line (text, "Author: dhall@virage.org\n");
	text_append_line (text, "Date: Sun Feb 22 19:51:23 EST 1998\n");

	/* create a close button */
	button = gtk_button_new_with_label ("close");
	gtk_signal_connect_obect (GTK_OBJECT (button), "clicked",
				  GTK_SIGNAL_FUNC (gtk_widget_destroy),
				  GTK_OBJECT (window));

	gtk_box_pack_start (GTK_BOX (layout), button, TRUE, TRUE, 0);

	/* set close to be default button to activate in new window */
	GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
	gtk_widget_grab_default (button);

	gtk_widget_show (button);
	gtk_widget_show (layout);
	gtk_widget_show (window);
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]