Lablgtk中Gdk.Window,GtkWindow和GWindow之间的区别 [英] Difference between Gdk.Window, GtkWindow and GWindow in lablgtk
问题描述
在Lablgtk中,(至少)有三种类型的窗口命名模块:
In Lablgtk, there are (at least) three types of window-named modules:
- Gdk.Window
- GtkWindow
- GWindow
它们之间有什么区别,我怎么能从另一个过渡到另一个?
What's the difference between them, and how can I go from one to another?
推荐答案
GTK最初用于X11系统.在X11中,窗口"是一个矩形区域,您可以在该区域上进行绘制并从中选择事件.它们可以嵌套在树中,整个屏幕的顶部都带有根窗口". Gdk.window
是X11窗口的薄包装,但足够抽象以支持非X11后端.
GTK was originally for X11 systems. In X11, a "window" is a rectangular area that you can draw on and select events from. They can be nested in a tree, with the "root window" at the top for the whole screen. A Gdk.window
is a thin wrapper around an X11 window, but is abstract enough to support non-X11 backends.
GTK窗口就是用户认为的窗口-屏幕上具有标题,边框等可调整大小的区域.实际上,这可能是由窗口管理器提供的X11窗口,其中包含标题和边框内容区域的另一个X11窗口.然后,此内部窗口可能包含子窗口,例如每个按钮一个.但是,我认为现代GTK通常不会打扰子窗口,而是自己管理所有内容以避免闪烁.
A GTK window is what a user would think of as a window - a resizable area of the screen with a title, border, etc. In fact, this is probably an X11 window provided by the window manager containing the title and border and another X11 window for the content area. This inner window might then contain sub-windows, e.g. one for each button. However, I think modern GTK usually doesn't bother with sub-windows and manages everything itself to avoid flickering.
一个 Gtk.window Gtk.obj
表示GTK C库提供的C对象.C库公开的功能在 GtkWindow.Window
中可用.
A Gtk.window Gtk.obj
represents the C object provided by the GTK C library. The functions exposed by the C library are available in GtkWindow.Window
.
但是,C对象通常由 GWindow.window
类包装以为其提供OO OCaml API.
However, the C object is usually wrapped by the GWindow.window
class to provide an OO OCaml API to it.
使用 gtk_window#misc#window
从 GWindow.window
获取GDK窗口.
Use gtk_window#misc#window
to get the GDK window from a GWindow.window
.
这篇关于Lablgtk中Gdk.Window,GtkWindow和GWindow之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!