AffButton

AffButton is a GtkButton specifically for Affinity. If the "use normal buttons" option is not checked, the buttons are automatically drawn differently. AffButton uses several GObject properties and can be set to open a Uri or run a command when clicked.

Initialization Functions

aff_button_new()

GtkWidget *aff_button_new(GtkWidget *window, GtkWidget *image, const char *text, const char *uri);
window: The AffWindow instance to use.
image: The image to display next to the text.
text: The text to display, or NULL for no text.
uri: The uri to open when clicked.

aff_button_new_with_command()

GtkWidget *aff_button_new_with_command(GtkWidget *window, GtkWidget *image, const char *text, const char *command);
window: The AffWindow instance to use.
image: The image to display next to the text.
text: The text to display, or NULL for no text.
command: The command to run when clicked.

aff_button_new_by_icon_name()

GtkWidget *aff_button_new_by_icon_name(GtkWidget *window, const gchar *icon_name, gint icon_size, const gchar *text);
window: The AffWindow instance to use.
icon_name: The name of the icon to display. (The icon comes from GtkIconTheme.)
icon_size: The size of the icon. Pass anything < 1 or NULL to use the default icon size, 24.
text: The text to display, or NULL for no text.

GObject Properties

See the g_object_get() and the g_object_set() functions if you want to get or set multiple properties at once. Otherwise, use the individual functions below. Note that all of these properties, except use-underline, can be NULL. Changing any of the three icon properties will override the previous setting.

command (string): The command to run when clicked. The uri property overrides the command property.
icon (GtkWidget): The icon to display next to the text, as a GtkImage.
icon-name (string): The name of the icon to display.
icon_size (integer): The size of the icon. Use NULL or anything < 1 to hide the icon.
text (string): The text to display. Note that GtkWidget has a similar property named label; don't use it.
uri (string): The Uri to open when clicked.
use-underline (boolean): Set to TRUE to have the button text set as a mnemonic. (Default: FALSE)
window (GtkWidget): The AffWindow to display the button on. This is used to draw the button if "Use normal buttons" is unchecked and to get the colors to use. If window is NULL, the button will look like a normal GtkButton, though this hasn't been tested.

Other Functions

aff_button_*_command()

void aff_button_set_command(AffButton *button, gchar *command);
gchar *aff_button_get_command(AffButton *button);

Set and get the command to run when the button is clicked. Overridden by uri.
Note that there is a GObject property for this, command. The default is NULL.

aff_button_*_text()

void aff_button_set_text(AffButton *button, gchar *text);
gchar *aff_button_get_text(AffButton *button);

Set and get the text that is displayed. If this is NULL, the button's padding is changed.
Note that GtkButton has a similar property, label; don't use it.

aff_button_*_uri()

void aff_button_set_uri(AffButton *button, gchar *uri);
gchar *aff_button_get_uri(AffButton *button);

Set and get the uri to open when the button is clicked. Overrides command.
Note that there is a GObject property for this, uri. The default is NULL.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License