首頁 / LinuxDev / G_OBJECT vs GTK_OBJECT

G_OBJECT vs GTK_OBJECT

http://ts-hoop.blogspot.com/2008/03/gtkcasting.html的

看GTK的Casting發現一個小問題

提到這兩個型別轉換的問題,看了 Foundations of GTK+ Development的課本後,才發現這應該是版本的問題。

GObject is the fundamental type providing common attributes for all libraries based
on it including GTK+ and Pango. It allows objects derived from it to be constructed,
destroyed, referenced, and unreferenced. It also provides the signal system and object
property functions. You can cast an object as a GObject with G_OBJECT(). If you try to
cast an object with G_OBJECT() that is not a GObject or derived from it, GLib will throw a
critical error, and the cast will fail. This will occur with any other GTK+ casting function.

GtkObject is the base class for all GTK+ objects. It was replaced as the absolute base
class of all objects in GTK+ 2.0, but GtkObject was kept for backward compatibility of
nonwidget classes like GtkAdjustment. You can cast an object as a GtkObject with
GTK_OBJECT().

Print Friendly, PDF & Email
馬上成為工作達人的Fans

About flylinux

發表迴響

你的電子郵件位址並不會被公開。 Required fields are marked *

*

這個網站採用 Akismet 服務減少垃圾留言。進一步瞭解 Akismet 如何處理網站訪客的留言資料

Scroll To Top