Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'apress foundations_of gtk plus development 2007 phần 6', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | CHAPTER 8 THE TREE VIEW WIDGET 271 Renderers and Columns After creating the Gt kTreeView you need to add one or more columns to the view for it to be of any use. Each GtkTreeViewColumn is composed of a header which displays a short description of its content and at least one cell renderer. Tree view columns do not actually render any content. Tree view columns hold one or more cell renderers that are used to draw the data on the screen. All cell renderers are derived from the GtkCellRenderer class and are referred to as objects in this chapter because GtkCellRenderer is derived directly from GtkObject not from GtkWidget. Each cell renderer contains a number of properties that determine how the data will be drawn within a cell. The GtkCellRenderer class provides common properties to all derivative renderers including background color size parameters alignments visibility sensitivity and padding. A full list of GtkCellRenderer properties can be found in Appendix A. It also provides the editing-canceled and editing-started signals which allow you to implement editing in custom cell renderers. In Listing 8-1 you were introduced to GtkCellRendererText which is capable of rendering strings numbers and gboolean values as text. Textual cell renderers are initialized with gtk_cell_renderer_text_new . GtkCellRendererText provides a number of additional properties that dictate how each cell will be rendered. You should always set the text property which is the string that will be displayed in the cell. The rest of the properties are similar to those used with text tags. GtkCellRendererText contains a large number of properties that dictate how every row will be rendered. g_object_set was used in the following example to set the foreground color of every piece of text in the renderer to orange. Some properties have a corresponding set property as well which must be set to TRUE if you want the value to be used. For example you should set foreground-set to TRUE for the changes .