| libstarred Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Implemented Interfaces | Properties | ||||
#include <libstarrred/libstarrred.h> struct StarredRating; struct StarredRatingClass; gunichar starred_rating_get_black_char (StarredRating *rating); const gchar * starred_rating_get_black_icon_name (StarredRating *rating); gboolean starred_rating_get_editable (StarredRating *rating); gboolean starred_rating_get_has_frame (StarredRating *rating); GtkIconSize starred_rating_get_icon_size (StarredRating *rating); gint starred_rating_get_max_rating (StarredRating *rating); gint starred_rating_get_min_rating (StarredRating *rating); gint starred_rating_get_rating (StarredRating *rating); gunichar starred_rating_get_white_char (StarredRating *rating); const gchar * starred_rating_get_white_icon_name (StarredRating *rating); GtkWidget * starred_rating_new (void); void starred_rating_set_black_char (StarredRating *rating,gunichar black_char); void starred_rating_set_black_icon_name (StarredRating *rating,const gchar *icon_name); void starred_rating_set_editable (StarredRating *rating,gboolean editable); void starred_rating_set_has_frame (StarredRating *rating,gboolean has_frame); void starred_rating_set_icon_size (StarredRating *rating,GtkIconSize size); void starred_rating_set_max_rating (StarredRating *rating,gint value); void starred_rating_set_min_rating (StarredRating *rating,gint value); void starred_rating_set_rating (StarredRating *rating,gint value); void starred_rating_set_white_char (StarredRating *rating,gunichar white_char); void starred_rating_set_white_icon_name (StarredRating *rating,const gchar *icon_name);
StarredRating implements AtkImplementorIface, GtkBuildable and GtkCellEditable.
"black-char" guint : Read / Write "black-icon-name" gchar* : Read / Write "editable" gboolean : Read / Write "has-frame" gboolean : Read / Write "icon-size" GtkIconSize : Read / Write "max-rating" gint : Read / Write "min-rating" gint : Read / Write "rating" gint : Read / Write "white-char" guint : Read / Write "white-icon-name" gchar* : Read / Write
By adjusting properties like "min-rating" and "max-rating" also other rating systems systems but five-star rating are supported.
Example 1. Single-star favorites
GtkWidget *widget = starred_rating_new ();
starred_rating_set_editable (STARRED_RATING (widget), TRUE);
starred_rating_set_max_rating (STARRED_RATING (widget), 1);
Example 2. Require at least one star
GtkWidget *widget = starred_rating_new ();
starred_rating_set_editable (STARRED_RATING (widget), TRUE);
starred_rating_set_min_rating (STARRED_RATING (widget), 1);
Example 3. Display hearts instead of stars
GtkWidget *widget = starred_rating_new ();
starred_rating_set_editable (STARRED_RATING (widget), TRUE);
starred_rating_set_black_char (STARRED_RATING (widget), 0x2665); /* BLACK HEART SUIT */
starred_rating_set_white_char (STARRED_RATING (widget), 0x2661); /* WHITE HEART SUIT */
struct StarredRating;
Opaque data structure representing StarredRating instances.
struct StarredRatingClass {
GtkMiscClass parent_class;
/* Padding for future expansion */
void (*_starred_reserved1) (void);
void (*_starred_reserved2) (void);
void (*_starred_reserved3) (void);
void (*_starred_reserved4) (void);
void (*_starred_reserved5) (void);
};
Virtual methods of the StarredRating class.
| Virtual methods of the super class. | |
| (skip) Padding for future expansion | |
| (skip) Padding for future expansion | |
| (skip) Padding for future expansion | |
| (skip) Padding for future expansion | |
| (skip) Padding for future expansion |
gunichar starred_rating_get_black_char (StarredRating *rating);
Reads the "black-char" property.
|
The StarredRating instance |
Returns : |
The current property value. |
const gchar * starred_rating_get_black_icon_name (StarredRating *rating);
Reads the "black-icon-name" property.
|
The StarredRating instance |
Returns : |
The current property value. |
gboolean starred_rating_get_editable (StarredRating *rating);
Reads the "editable" property.
|
The StarredRating instance |
Returns : |
The current property value. |
gboolean starred_rating_get_has_frame (StarredRating *rating);
Reads the "has-frame" property.
|
The StarredRating instance |
Returns : |
The current property value. |
GtkIconSize starred_rating_get_icon_size (StarredRating *rating);
Reads the "icon-size" property.
|
The StarredRating instance |
Returns : |
The current property value. |
gint starred_rating_get_max_rating (StarredRating *rating);
Reads the "max-rating" property.
|
The StarredRating instance |
Returns : |
The current property value. |
gint starred_rating_get_min_rating (StarredRating *rating);
Reads the "min-rating" property.
|
The StarredRating instance |
Returns : |
The current property value. |
gint starred_rating_get_rating (StarredRating *rating);
Reads the "rating" property.
|
The StarredRating instance |
Returns : |
The current property value. |
gunichar starred_rating_get_white_char (StarredRating *rating);
Reads the "white-char" property.
|
The StarredRating instance |
Returns : |
The current property value. |
const gchar * starred_rating_get_white_icon_name (StarredRating *rating);
Reads the "white-icon-name" property.
|
The StarredRating instance |
Returns : |
The current property value. |
GtkWidget * starred_rating_new (void);
Creates a new StarredRating instance. Its default properties represent an immutable five-star rating.
Returns : |
The newly allocated widget. |
void starred_rating_set_black_char (StarredRating *rating,gunichar black_char);
Writes to the "black-char" property.
|
The StarredRating instance |
|
The new property value. |
void starred_rating_set_black_icon_name (StarredRating *rating,const gchar *icon_name);
Writes to the "black-icon-name" property.
|
The StarredRating instance |
|
The new property value. [allow-none] |
void starred_rating_set_editable (StarredRating *rating,gboolean editable);
Writes to the "editable" property.
|
The StarredRating instance |
|
The new property value. |
void starred_rating_set_has_frame (StarredRating *rating,gboolean has_frame);
Writes to the "has-frame" property.
|
The StarredRating instance |
|
The new property value. |
void starred_rating_set_icon_size (StarredRating *rating,GtkIconSize size);
Writes to the "icon-size" property.
|
The StarredRating instance |
|
The new property value. |
void starred_rating_set_max_rating (StarredRating *rating,gint value);
Writes to the "max-rating" property.
|
The StarredRating instance |
|
The new property value. |
void starred_rating_set_min_rating (StarredRating *rating,gint value);
Writes to the "min-rating" property.
|
The StarredRating instance |
|
The new property value. |
void starred_rating_set_rating (StarredRating *rating,gint value);
Writes to the "rating" property.
|
The StarredRating instance |
|
The new property value. |
void starred_rating_set_white_char (StarredRating *rating,gunichar white_char);
Writes to the "white-char" property.
|
The StarredRating instance |
|
The new property value. |
void starred_rating_set_white_icon_name (StarredRating *rating,const gchar *icon_name);
Writes to the "white-icon-name" property.
|
The StarredRating instance |
|
The new property value. [allow-none] |
"black-char" property"black-char" guint : Read / Write
The character to use for assigned stars.
Default value: 0
"black-icon-name" property"black-icon-name" gchar* : Read / Write
The icon to use for assigned stars.
Default value: NULL
"editable" property"editable" gboolean : Read / Write
Whether the rating can be modified by the user.
Default value: FALSE
"has-frame" property"has-frame" gboolean : Read / Write
FALSE removes outside bevel from widget.
Default value: TRUE
"icon-size" property"icon-size" GtkIconSize : Read / Write
Size of star icons.
Default value: GTK_ICON_SIZE_MENU
"max-rating" property"max-rating" gint : Read / Write
Maximum rating in stars.
Allowed values: >= 1
Default value: 5
"min-rating" property"min-rating" gint : Read / Write
Minimum rating in stars.
Allowed values: [0,1]
Default value: 0
"rating" property"rating" gint : Read / Write
Rating in stars.
Allowed values: >= 0
Default value: 0
"white-char" property"white-char" guint : Read / Write
The character to use for missing stars.
Default value: 0
"white-icon-name" property"white-icon-name" gchar* : Read / Write
The icon to use for missing stars.
Default value: NULL