intended gtk_frame behavior as container?



When I set the border width of a gtk_frame as a container, with:

gtk_container_set_border_width(GTK_CONTAINER(frame),30);

the interior of the frame doesn't get the 30 pixels of border width as
expected. Instead of this, the exterior of the frame gets the 30 pixels
of border width.
I consider this more a bug than a feature, because when I set the border
width of a container, the contained widget gets the border width around
it, and inside the container.
For example, this is what happens with gtk_windows,gtk_buttons, etc...

I attach a simple code to illustrate this:

#include <gtk/gtk.h>

int main(int argc,char **argv)
{
  GtkWidget *w,*frame;

  gtk_init(&argc,&argv);

  w=gtk_window_new(GTK_WINDOW_TOPLEVEL);

  frame=gtk_frame_new("Test of frame border width as container");
  gtk_container_set_border_width(GTK_CONTAINER(frame),30);
  gtk_container_add(GTK_CONTAINER(frame),gtk_label_new("Label inside
frame"));
  gtk_container_add(GTK_CONTAINER(w),frame);
  gtk_container_set_border_width(GTK_CONTAINER(w),10);
  gtk_widget_show_all(w);

  gtk_main();

  return 0;
}

As you can see, the expected result should be a 10 pixels border width
around the frame, and a 30 pixels border width inside the frame. But the
result is a 10+30=40 pixels border width around the frame.
This is strange, because if I want to put a border inside the frame I
must create a container inside the frame and set the border of this last
container. (A waste of resources and widgets).

Is this considered a bug? If so, do I post it to the bug tracker?

By the way, if I want to send a patch, which are the "diff" switches I
must use? Do I have to make a .tgz file? Do I have to use the last
CVS module? (I still don't know how to use the CVS thingie (:^(   )




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