GTK+ Properties
Total Page:16
File Type:pdf, Size:1020Kb
APPENDIX A ■ ■ ■ GTK+ Properties GObject provides a property system, which allows you to customize how widgets interact with the user and how they are drawn on the screen. In the following sections, you will be provided with a complete reference to widget and child properties available in GTK+ 2.10. GTK+ Properties Every class derived from GObject can create any number of properties. In GTK+, these properties store information about the current state of the widget. For example, GtkButton has a property called relief that defines the type of relief border used by the button in its normal state. In the following code, g_object_get() was used to retrieve the current value stored by the button’s relief property. This function accepts a NULL-terminated list of properties and vari- ables to store the returned value. You can also use g_object_set() to set each object property as well. g_object_get (button, "relief", &value, NULL); There are a great number of properties available to widgets; Tables A-1 to A-90 provide a full properties list for each widget and object in GTK+ 2.10. Remember that object properties are inherited from parent widgets, so you should investigate a widget’s hierarchy for a full list of properties. For more information on each object, you should reference the API documentation. Table A-1. GtkAboutDialog Properties Property Type Description artists GStrv A list of individuals who helped create the artwork used by the application. This often includes information such as an e-mail address or URL for each artist, which will be displayed as a link. authors GStrv A list of individuals who helped program the application. This often includes information such as an e-mail address or URL for each programmer, which will be displayed as a link. Continued 481 482 APPENDIX A ■ GTK+ PROPERTIES Table A-1. Continued Property Type Description comments gchararray A short string that describes the gen- eral functionality of the program. This is displayed in the main dialog win- dow, so it should not be too long. copyright gchararray Copyright information about the application. This is displayed in the main dialog window, so it should not be too long. An example copyright string would be "(C) Copyright 2007 Author". documenters GStrv A list of individuals who helped write documentation for the application. This often includes information such as an e-mail address or URL for each documenter, which will be displayed as a link. license gchararray The content of the license for the application. This is displayed with a GtkTextView widget in a secondary dialog, so the length of the string does not matter. logo GdkPixbuf An image that will be displayed as the application’s logo in the main window. If this is not set, gtk_window_get_default_icon_list() will be used. logo-icon-name gchararray An icon name from the icon theme to use as the logo in the main About dia- log. If this is set, it will take precedence over the logo property. name gchararray The name of the application to display in the main About dialog. If you do not set this property, g_get_application_name() will be used. translator-credits gchararray A string that holds information about the translator(s) for the current lan- guage. It should be set as translatable, so each translator can provide a custom string. This often includes information such as an e-mail address or URL for each translator, which will be displayed as a link. version gchararray The version of the application that the user is running. website gchararray A URL to the homepage for the appli- cation. This string must be prefixed with http://. APPENDIX A ■ GTK+ PROPERTIES 483 Property Type Description website-label gchararray A label to display in place of the web site URL. If this is not set, website will be set as the URL label. wrap-license gboolean If set to TRUE, the license content will be wrapped. Table A-2. GtkAccelLabel Properties Property Type Description accel-closure GClosure The closure that should be watched for changes to the keyboard accelerator. accel-widget GtkWidget The widget that should be watched for changes to the keyboard accelerator. Table A-3. GtkAction Properties Property Type Description action-group GtkActionGroup An action group that the action belongs to. You can set this to NULL if the action does not belong to an action group. hide-if-empty gboolean If set to TRUE, menu proxies that are empty will be hidden from view. icon-name gchararray The name of the icon to use from the icon theme. This property is overrid- den by the stock-id property. is-important gboolean If a toolbar is in GTK_TOOLBAR_BOTH_ HORIZ mode, this property will display the label for the item when set to TRUE. Otherwise, it will have no effect. label gchararray The text to display in the menu item or button. Toolbar items use the short- label property. name gchararray A unique string that distinguishes the action. sensitive gboolean If set to TRUE, the action will be enabled. Otherwise, the user will not be able to interact with it. short-label gchararray The text to display in the tool item. Menu items and buttons use the label property. Continued 484 APPENDIX A ■ GTK+ PROPERTIES Table A-3. Continued Property Type Description stock-id gchararray The stock icon to display for widgets using the action. This property takes precedence over icon-name. tooltip gchararray A tooltip for the action that will be dis- played when the user hovers over a toolbar item. visible gboolean If set to TRUE, the action will be visible to the user. visible-horizontal gboolean If set to TRUE, the action will be visible in toolbars when the toolbar orienta- tion is set as horizontal. visible-overflown gboolean If set to TRUE, the action will be dis- played in the toolbar overflow menu. Otherwise, it will be hidden from view. visible-vertical gboolean If set to TRUE, the action will be visible in toolbars when the toolbar orienta- tion is set as vertical. Table A-4. GtkActionGroup Properties Property Type Description name gchararray A string that distinguishes the action group. sensitive gboolean If set to TRUE, the action group is set as active or enabled. visible gboolean If set to TRUE, the action group will be visible to the user. Table A-5. GtkAdjustment Properties Property Type Description lower gdouble The minimum gdouble value that the adjustment can reach. page-increment gdouble The increment that will be shifted when moving one page forward or backward. APPENDIX A ■ GTK+ PROPERTIES 485 Property Type Description page-size gdouble The size of a page of the adjustment. You should set this to zero when you use GtkAdjustment for GtkSpinButton. step-increment gdouble The increment that will be moved in an individual step. For example, with GtkSpinButton, a single step will be taken when an arrow button is pressed. upper gdouble The maximum gdouble value that the adjustment can reach. value gdouble The current value of the adjust- ment, which is always between lower and upper. Table A-6. GtkAlignment Properties Property Type Description bottom-padding guint Padding added along the bottom of the child widget left-padding guint Padding added along the left side of the child widget right-padding guint Padding added along the right side of the child widget top-padding guint Padding added along the top of the child widget xalign (yalign) gfloat A number between 0.0 and 1.0 used to align the child widget, where 1.0 is aligned to the right side or bottom of the container xscale (yscale) gfloat A number between 0.0 and 1.0 used to expand the child to fill extra space Table A-7. GtkArrow Properties Property Type Description arrow-type GtkArrowType The direction the GtkArrow will point shadow-type GtkShadowType The type of shadow to place around the arrow 486 APPENDIX A ■ GTK+ PROPERTIES Table A-8. GtkAspectFrame Properties Property Type Description obey-child gboolean If set to TRUE, use the aspect ratio defined by the child widget instead of the ratio property. ratio gfloat A number between 0.0001 and 10,000 that defines the aspect ratio. xalign (yalign) gfloat The alignment of the child within the container as defined by a number between 0.0 and 1.0, where 0.5 is centered. Table A-9. GtkBox Properties Property Type Description homogeneous gboolean If set to TRUE, all of the children will be set to the same size. spacing gint The spacing to add between each child and its neighbors. Table A-10. GtkButton Properties Property Type Description focus-on-click gboolean If set to TRUE, the button will grab focus when it is clicked by the mouse. image GtkWidget A widget to display beside the but- ton’s text. image-position GtkPositionType The position of image with respect to the label. label gchararray A text label to display within the but- ton if the button contains a label. relief GtkReliefStyle The type of border to place around the button. use-stock gboolean If set to TRUE, a stock item will be used as the button’s content. use-underline gboolean If set to TRUE, a mnemonic keyboard accelerator will be used for the charac- ter following an underscore. xalign (yalign) gfloat A floating point number between 0.0 and 1.0 that aligns the child widget if it is a GtkMisc or GtkAlignment widget, where 0.5 is centered. APPENDIX A ■ GTK+ PROPERTIES 487 Table A-11. GtkButtonBox Properties Property Type Description layout-style GtkButtonBoxStyle The type of layout that is used for the child buttons Table A-12.