發表文章

目前顯示的是有「gtk」標籤的文章

GtkTreeModel 解釋

GtkTreeModel GtkTreeModel : "One can convert a path to an iterator by calling gtk_tree_model_get_iter(). These iterators are the primary way of accessing a model and are similar to the iterators used by GtkTextBuffer. They are generally statically allocated on the stack and only used for a short time. The model interface defines a set of operations using them for navigating the model."

GTK 如何傳遞signal ?

圖片
GTK 如何傳遞signal  ? GTK透過GDK來處理事件,GDK會將每個接受到的XEvent轉換為GdkEvent,然後傳播給GtkWidget,引發一個與事件相對應的事件Signal,再透過Callback函式處理事件。 from 良葛格GTK學習筆記  GDK 事件結構

GtkContainer 概念介紹

圖片
GtkContainer : "gtk_container_get_focus_vadjustment () GtkAdjustment* gtk_container_get_focus_vadjustment (GtkContainer *container); Retrieves the vertical focus adjustment for the container. See gtk_container_set_focus_vadjustment(). container : a GtkContainer Returns : the vertical focus adjustment, or NULL if none has been set. gtk_container_set_focus_vadjustment () void gtk_container_set_focus_vadjustment (GtkContainer *container, GtkAdjustment *adjustment); Hooks up an adjustment to focus handling in a container, so when a child of the container is focused, the adjustment is scrolled to show that widget. This function sets the vertical alignment. See gtk_scrolled_window_get_vadjustment() for a typical way of obtaining the adjustment and gtk_container_set_focus_hadjustment() for setting the horizontal adjustment. The adjustments have to be in pixel units and in the same coordinate system as the allo...

GTK中對於Key Values的解釋

GTK中對於Key Values的解釋 Key Values : "gdk_keymap_get_entries_for_keyval () gboolean gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap, guint keyval, GdkKeymapKey **keys, gint *n_keys);

Common Questions about GTK

Common Questions : "1.4. How does memory management work in GTK+? Should I free data returned from functions? See the documentation for GObject and GtkObject. For GObject note specifically g_object_ref() and g_object_unref(). GtkObject is a subclass of GObject so the same points apply, except that it has a 'floating' state (explained in its documentation). For strings returned from functions, they will be declared 'const' (using G_CONST_RETURN) if they should not be freed. Non-const strings should be freed with g_free(). Arrays follow the same rule. (If you find an exception to the rules, please report a bug to http://bugzilla.gnome.org.)"

GtkListStore

圖片
GtkListStore : "Object Hierarchy GObject +----GtkListStore Implemented Interfaces GtkListStore implements GtkBuildable, GtkTreeModel, GtkTreeDragSource, GtkTreeDragDest and GtkTreeSortable."

GObject說明 The Base Object Type

圖片
The Base Object Type : "Description 主要是想要知道為什麼在宣告一個GObject A之後要先做g_object_ref(A)。 宣告跟g_object_ref(A)有什麼不同, 以及g_object_unref(A)跟g_object_ref_sink(A)分別是什麼意思。 GObject is the fundamental type providing the common attributes and methods for all object types in GTK+, Pango and other libraries based on GObject. The GObject class provides methods for object construction and destruction, property access methods, and signal support. Signals are described in detail in Signals(3). GInitiallyUnowned is derived from GObject. The only difference between the two is that the initial reference of a GInitiallyUnowned is flagged as a floating reference. This means that it is not specifically claimed to be 'owned' by any code portion. The main motivation for providing floating references is C convenience"

String Utility Functions : g_strsplit ()

圖片
String Utility Functions : "g_strsplit () gchar** g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens); Splits a string into a maximum of max_tokens pieces, using the given delimiter. If max_tokens is reached, the remainder of string is appended to the last token. As a special case, the result of splitting the empty string '' is an empty vector, not a vector containing a single string. The reason for this special case is that being able to represent a empty vector is typically more useful than consistent handling of empty elements. If you do need to represent empty elements, you'll need to check for the empty string before calling g_strsplit(). string : a string to split. delimiter : a string which specifies the places at which to split the string. The delimiter is not included in any of the resulting strings, unless max_tokens is reached. max_tokens : the maximum number of pieces to split string into. If thi...

什麼是GTK(GIMP ToolKit)

圖片
GTK Programming Zone : "GTK (GIMP ToolKit) 原本只是 GIMP 開發過程上管理圖型介面的一套工具程式庫. 由於它使用 LGPL 執照, 程式開發者可以免費使用它來發展公開程式碼的軟體, 免費軟體或甚至商用軟體. 隨著使用率及使用範圍的增加, 很快的 GTK 從只為了滿足 GIMP 需求而存在的印象中跳出, 發展成今日功能廣泛的一套程式庫. GTK 的穩定版已從 1.2 發行到現在的 2.0. 舊的 1.2 版基本上只有 GLIB 跟 GTK+ 兩個套件, 而 GTK 中另含有 GDK (GIMP Drawing Kit) 程式庫. 一般我們直接使用的是 GTK. 其中幾乎所有繪圖功能都是透過 GDK 來達成的. GDK 主要負責和 X Window 的程式庫做"

GTK字串處理 String Utility Functions

圖片
String Utility Functions g_ascii_strtod () Converts a string to a gdouble value. This function behaves like the standard strtod() function does in the C locale. It does this without actually changing the current locale, since that would not be thread-safe. This function is typically used when reading configuration files or other non-user input that should be locale independent. To handle input from the user you should normally use the locale-sensitive system strtod() function. To convert from a gdouble to a string in a locale-insensitive way, use g_ascii_dtostr(). If the correct value would cause overflow, plus or minus HUGE_VAL is returned (according to the sign of the value), and ERANGE is stored in errno. If the correct value would cause underflow, zero is returned and ERANGE is stored in errno. This function resets errno before calling strtod() so that you can reliably detect overflow and underflow.

gtk 如何debug

圖片
要檢查gtk程式除了手動gprintf, 還可以在程式中使用這個 function 來做一點簡單的檢查 : g_return_val_if_fail (expr) Logs a warning if the expression is not true. 其他參見 Message Output and Debugging Functions Message Output and Debugging Functions — functions to output messages and help debug applications

如何用GTK寫踩地雷

圖片
這是我google "gtk tutorial" 得到的一個介紹gtk的網站 GTK Programming Zone http://debian.linux.org.tw/~kevpeng/ 最後介紹了一個簡單的踩地雷遊戲。 而在yahoo知識上面,搜尋GTK, 有讀者問問題,而作者也剛好在用yahoo知識 "四五年前的東西, 連我自己都忘了有它的存在, 居然還有人在看... 真感動! @@~" 還幫忙回答了問題 1.要怎麼修改,能夠爆掉之後能夠顯示所有炸彈的位置? 2.爆掉之後能夠顯示全部位置數字(就好像過關的畫面,全部都按出來了)? http://tw.knowledge.yahoo.com/question/question?qid=1607112006602 有興趣的讀者可以參考看看。 看到這個故事,才驚覺網路上有最新的資源,但也同時會有很多古老的資源。 如果沒有注意好時間,搞不好會因為沒有注意到版本的更新等問題,而走進死胡同。 推荐jserv前輩的一篇好文: 對自己好一些:談技術手冊閱讀 不能一直把Google大神,當作一切,需要認真K書的時候不能逃避。

網路上學習GTK的資源

圖片
如果google "gtk reference" 排名第1順位的是: GTK+ Reference Manual 在官方網站中對於所有可用的函式介紹比較詳盡。 有了正確可供參考的資源後,如果有一些範例介紹,相信會更好。 ubuntu平台可以利用以下指令 apt-cache search gtk examples 找到套件 gtk2.0-examples - Examples files for the GTK+ 2.0 安裝之後可以有一些範例可以使用。 相信會更容易上手GTK。 另外推薦 GTK學習筆記

看GTK的Casting發現一個小問題

圖片
在看網路上的頭影片的時候 發現介紹GTK的Casting 時 列出以下幾種 G_OBJECT (object)‏ GTK_WIDGET (widget)‏ GTK_OBJECT (object)‏ GTK_SIGNAL_FUNC (function)‏ GTK_CONTAINER (container)‏ GTK_WINDOW (window)‏ GTK_BOX (box)‏ 不知道 G_OBJECT跟GTK_OBJECT 有什麼不一樣呢 @@

使用GDK的函式庫從檔案讀取圖片

圖片
放一下 簡單的code 作個備份 #include #include #include int main(int argc, char**argv) { GtkWidget *window; GtkWidget *frame; GdkPixbuf *pixbuf; GtkWidget *img; gtk_init(&argc, &argv); window=gtk_window_new(GTK_WINDOW_TOPLEVEL); pixbuf = NULL; pixbuf = gdk_pixbuf_new_from_file("test00.jpg",GError); img = gtk_image_new_from_pixbuf(pixbuf); gtk_container_add(GTK_CONTAINER(window),img); gtk_widget_show_all(window); gtk_main(); return 0; } --

Google Search

推薦內容橫式

本月熱門文章