gtk_image_new(NULL, NULL), MausinGTK



Hi

gtk_image_new() doesn't allow `val' (image pointer of type GdkImage *)
to be set NULL at the beginning...

Hmm, gtk_image_set() doesn't allow this either. But the code there
(mostly) could take care of it:

#line gtkimage.c:95:
  image->image = val;
  ...
vvvvvvvvvvvvvvvvvvv- here does
  if (image->image)
    {
	...
    }
  else
    {
      GTK_WIDGET (image)->requisition.width = 0;
      GTK_WIDGET (image)->requisition.height = 0;
    }

vvvvvvvvvvvvvv- here doesn't
  if (GTK_WIDGET_VISIBLE (image))
    gtk_widget_queue_resize (GTK_WIDGET (image));
}


Would it be reasonable to allow existing image object without any
image available, or does it have unnecessary overhead.

I'd like to have this feature so I could allocate an image object
and give the image there at some later stage. If there is more cons
against the idea, I just generate some dummy image and use that.


This problem occurred me with my MausinGTK project and it's initial
application `gmame'. MausinGTK is a C code wrapper aroung gtk which
offers programmer to build initial user interface layout (easily)
most of the same way as MagicUserInterface (MUI) does:

Currently, the following code get something appear on my X screen:

  gtk_init(&argc, &argv);

  window = Window(
    GTKA_Window_Title, "gmame",
    Child, VBox(
      Pack_Start, HBox(
        Pack_Start, MenuBar(
          Append, MenuItem(
            GTKA_Label, "File",
            SubMenu, Menu(
              Append, MenuItem(GTKA_Label, "Load Config", End),
              Append, MenuItem(GTKA_Label, "Save Config", End),
              Append, quit_item = MenuItem(GTKA_Label, "Quit", End),
              End),
            End),
          End),
        Pack_Start, OptionMenu(
          SubMenu, Menu(
            Append, MenuItem(GTKA_Label, "scale 1x1", End),
            Append, MenuItem(GTKA_Label, "scale 1x2", End),
            Append, MenuItem(GTKA_Label, "scale 1x3", End),
            Append, MenuItem(GTKA_Label, "scale 2x1", End),
            Append, MenuItem(GTKA_Label, "scale 2x2", End),
            Append, MenuItem(GTKA_Label, "scale 2x3", End),
            Append, MenuItem(GTKA_Label, "scale 3x1", End),
            Append, MenuItem(GTKA_Label, "scale 3x2", End),
            Append, MenuItem(GTKA_Label, "scale 3x3", End),
            End),
          End),
        Pack_Start, OptionMenu(
          SubMenu, Menu(
            Append, MenuItem(GTKA_Label, "sound off", End),
            Append, MenuItem(GTKA_Label, "sound on (dsp)", End),
	/* Append, gtk_menu_item_new_with_label("example line"), */
            Append, MenuItem(GTKA_Label, "sound on (audio)", End),
            End),
          End),
        Pack_Start, OptionMenu(
          SubMenu, Menu(
            Append, MenuItem(GTKA_Label, "frameskip 0", End),
            Append, MenuItem(GTKA_Label, "frameskip 1", End),
            Append, MenuItem(GTKA_Label, "frameskip 2", End),
            Append, MenuItem(GTKA_Label, "frameskip 3", End),
            End),
          End),
        End),
      Pack_Start, HBox(
        Pack_Start, List(
          End),
        Pack_Start, Frame(End),
/*      Pack_Start, image = Image(
        End), */
        End),
      Pack_Start, frame = Frame(
        GTKA_Frame_Shadow_Type, GTK_SHADOW_OUT,
        End),
      End),
    End);

  if (window)
    gtk_widget_show_all(window);

  gtk_main();


The current source code (and that example above) is available on a www
page I just created for it. (http://www.iki.fi/~too/sw/MausinGTK/)

(MUI is available at http://www.sasg.com, is someone is interested)

If you have some comments, improvement ideas (, more code :) etc.. those
are welcome. 

Tomi



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