GTK+ -- from knowing nothing to knowing something (5)

  Other related Libraries

GLib - data types, type conversions, string utilities and other type related stuff.

GObject - the basic object type. I'm not sure if it is proper to list it as a "library", but it does appear in a seperate api document. We need to check it from time to time, for we have encounter it anyway when making use of the widgets.

Pango - font related stuff. With the help of this library, internationalization becomes easier.

ATK - Accessibility Toolkit. I'm not sure what we can do with it. I haven't used it yet. Comments will be highly appreciated.

GdkPixbuff - image buffer for loading image from and save to file and related stuff.

GDK - all drawing related stuff. Not very sure about this library, though encountered a little bit when loading the images.

Miscellaneous

Date

GLib has a date type called GDate. According to the api document " GDate is meant to represent everyday dates, not astronomical dates or historical dates or ISO timestamps or the like.", we can not get "today's" date from it. But it is still useful. I used it to test the validation of user's input. When failed, I know the user input an invalid date. It's much easier to do so with GDate than doing it manually.

CheckBox

When there are a lot of checkbox for user input, using a binary number to represent each box, together form a number. When checkbox active, OR operation will be implemented; otherwise, AND will be implemented. This way, we manipulate the data more efficiently.

Call back function

While implementing GTK in C++, callback functions cannot be a normal member function. The reason is a normal member function has a default argument - "this" pointer while when the callback is called, it's impossible for the GTK system to pass it a "this" pointer. One of the solution is, defining the callback as a static member function.

Strings

Unavoidably, we have to encounter may char strings in GTK (such as GtkEntry, GtkComboBoxEntry, etc). Some of these strings have to be released while other should not be released, depending on whether the return value is const_char type or not. Reading the api document carefully is very important.

 Data type in TreeView

There is a pointer type, which may be used to store any customised data. Might be useful in some cases.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值