File: notes.txt

package info (click to toggle)
glade-nonus 0.6.4-5
  • links: PTS
  • area: main
  • in suites: woody
  • size: 12,152 kB
  • ctags: 3,879
  • sloc: ansic: 54,332; sh: 6,839; makefile: 743; sed: 93
file content (85 lines) | stat: -rw-r--r-- 2,820 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

Dynamic Loading
===============

	- Aim is to allow users of Glade to specify extra libraries
	  containing more GTK widgets (which Glade has no knowledge of at all!)
	  so that Glade can use these widgets while creating the interface.

	- How portable is it??

	  On Linux need to link with -ldl (see ld.so info files).
	  Load library with:    handle = dlopen ("/lib/libm.so", RTLD_LAZY);
	  Look up symbol with:  cosine = dlsym(handle, "cos");
	  Call it with:         printf ("%f\\n", (*cosine)(2.0));

	  Does it need a completely different procedure on each Unix platform?
	  Maybe we could support just Linux and a few other popular platforms.
	  Maybe someone has written a portable library of functions for this?
	  (Tim Janik is adding this to glib)

	- How does Glade determine what widgets are available and what
	  functions?
	  Need a standard function included with the library to initialize
	  it and return info on the included widgets?

	  This would call gtk_<widget>_get_type() on all the widgets in the
	  library.

	  If GTK's get_arg/set_arg mechanism works OK, then all we need
	  returned is an array of widget type IDs?

	     void *handle;
	     gint* (*library_info_fn)();
	     gint* library_info;

	     handle = dlopen (library, RTLD_LAZY);
	     library_info_fn = dlsym(handle, "library_info");
             library_info = (*library_info_fn)();


	  We create new widgets with:     widget = gtk_type_new(type);
	  query the widgets properties:   gtk_object_query_args(type);
	  and show/apply properties with: gtk_object_getv/setv(widget, ...);

	  Is that all we need??

	  Some way of getting icons and tooltips for the palette would be nice
	  (though we could provide a number of custom icons and the class name
	   could be used for the tooltip).

	- The libraries could also contain customization functions which,
	  when called, pop up a dialog box or something to customize the
	  widget.

	- User could specify additional widget libraries in a Glade config
	  file. - Or even in a dialog in Glade itself.
	- Glade could even look for some standard libraries - GtkXmHTML,
	  Gnome's widget libraries. - May be a problem with versions?


In summary, people creating their own widgets to use with Glade (or any other
UI builder) should:

  1. compile them into a library.
  2. make sure the widgets are configurable with GTK's get_arg/set_arg
     mechanism (and also that creating the widget with gtk_type_new()
     results in a valid widget).
  3. include one extra function to initialize the widgets and return the
     types, something like this:

gint*
library_info()
{
  gint types[4];

  types[0] = gtk_myfirstwidget_get_type();
  types[1] = gtk_mysecondwidget_get_type();
  types[2] = gtk_mythirdwidget_get_type();
  types[3] = 0;

  return types;
}


Damon, 14th May 1998