LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1503|回复: 6

GTK#是什么东东?和GTK+有什么区别?

[复制链接]
发表于 2004-6-30 20:47:50 | 显示全部楼层 |阅读模式
不解
发表于 2004-6-30 20:54:29 | 显示全部楼层
1.1  What is Gtk#?

Gtk# brings the power and ease of .Net development paradigms to the free software GUI application development community.  Gtk# provides a C source parser and C# code generator which can be used to produce .Net assemblies that bind to GObject based libraries.  Among the libraries currently wrapped are gtk, gdk, atk, pango, gda, gnomedb, gconf, libgnomecanvas, libgnomeui, and libglade.


1.2  Why isn't it called Gnome# or Gnome.Net?

When the project was started, the idea was to wrap the Gtk+ libraries with a set of C# classes.  It quickly became apparent that the source parser and C# code generator could be used to wrap any GObject based API.  Contributors started wrapping their favorite GNOME libraries.  Mailing lists and a sourceforge project were already open under the gtk-sharp nomenclature and no compelling technical reasons for renaming presented themselves.  The decision was made to continue under the Gtk# name, even though the binding encompasses more than just Gtk, and more than just C#.


2.1  What are the Dependencies to build Gtk# on X11 platforms?

You'll need a .Net framework installed. Gtk# has been successfully used with both the mono and Portable.Net frameworks. The bare minimum requirement is a complete installation of the Gtk+-2.0 libraries.  Keep in mind that if your Gtk+ installation is provided by binary packages, you will also need to install the *-devel packages.  If you have additional GNOME-2.0 libraries installed, the configure script will detect their presence and the associated wrappers will be built.  A summary of the libraries which will be built is printed at the end of the configure step.


2.2  What about building on Win32 platforms?

To build Gtk# on win32, you will need a working cygwin installation.  Keep in mind that the default cygwin installation may not have all the tools you need.  Cygwin provides the gnu make tool which builds the Gtk# library.  You will also need the mingw-gcc compiler installed in order to build the Gtk# glue library.  There are binary packages of the Gtk+-2.0 libs and dependencies available from the Gtk+ for Win32 project page.  You will also need these libraries installed, along with their devel packages in order to build the glue library.  Once you have this environment set up, expand the gtk-sharp source into a directory and in a cygwin shell window, cd to the gtk-sharp directory and execute the command "make -f makefile.win32".


3.1  Why can't mono find gtk-sharp.dll?

You most likely have installed Gtk# into a prefix other than where mono is installed.  In order for the runtime to locate the Gtk# assemblies, you will need to add their location to the MONO_PATH environment variable. For the default installation prefix, this will mean executing the following command:

export MONO_PATH=/usr/local/libMONO_PATH



3.2  Why can't my compiler find the Gtk# classes?

You need to provide an assembly reference in your compilation command. The easiest way to add references is to use the -pkg: switch to mcs. For the GLib, Pango, Atk, Gdk, and Gtk namespaces, use -pkg:gtk-sharp. There are also pkg options for each of the optional assemblies (e.g. gnome-sharp).


3.3  Why don't I get ButtonPressEvents from my Button/Treeview?

As of release 0.15, Gtk# started using the CONNECT_AFTER flag when connecting event handlers to signals. This means that the event handlers are not run until after the default signal handlers, which means that the widget will be updated when the event handlers run. A side effect of this change is that in the case where default handlers return true to stop signal propogation, Gtk# events will not be emitted. This is the case for example in Gtk.Button, where the button-press-event default signal handler is overridden to emit Pressed events. TreeView has a similar situation.
While potentially confusing, this is not really a bug. When you use a Gtk.Button, you are getting a widget that emits Pressed events in response to Button1 presses. If you also want your Button to change colors, or popup a context menu on Button3 presses, that's not a Gtk.Button. The correct way to implement such a widget is to subclass Gtk.Button and override the OnButtonPressEvent virtual method to implement the new behaviors you desire.

Many Gtk+ developers have gotten used to being able to do these kind of things via signal handlers since g_signal_connect is typically used without the CONNECT_AFTER flag in C code. If you are convinced that you want to use g_signal_connect to pierce the encapsulation of a Widget and alter its default behavior, you can tag your callback method with the [GLib.ConnectBefore] attribute to force it to run before the default handler. This attribute was added in version 0.18 due to public outcry, but the default behavior is still to run event handlers after the default handler.


3.4  Why do I get DllNotFoundExceptions for glibsharpglue?

You have most likely installed Gtk# into a prefix that is not listed in /etc/ld.so.conf or your LD_LIBRARY_PATH. You either need to add the prefix/lib path (e.g. /usr/local/lib) to the /etc/ld.so.conf file and execute ldconfig, or add the path to your LD_LIBRARY_PATH environment variable and export it to your shell (i.e. export LD_LIBRARY_PATH=/usr/local/lib).
发表于 2004-6-30 21:02:45 | 显示全部楼层
SuSE9.1的软件包中见过?
 楼主| 发表于 2004-6-30 21:03:43 | 显示全部楼层
这个是啥呀?
发表于 2004-6-30 21:14:56 | 显示全部楼层
看见一大红叉。。?
 楼主| 发表于 2004-6-30 21:29:02 | 显示全部楼层
有图片的刚才看了会,好象是QT里的啥东东,因为是国外的站,所以速度慢
发表于 2004-12-21 13:27:44 | 显示全部楼层
怎么这么像dephi for linux啊.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表