switch: Make final

This should not be subclassed.
This commit is contained in:
Matthias Clasen
2019-05-26 15:34:31 -04:00
parent 96eefd49fa
commit fb334b1b15
2 changed files with 24 additions and 40 deletions

View File

@@ -73,6 +73,9 @@
#include "fallback-c89.c"
typedef struct _GtkSwitchPrivate GtkSwitchPrivate;
typedef struct _GtkSwitchClass GtkSwitchClass;
struct _GtkSwitchPrivate
{
GtkActionHelper *action_helper;
@@ -91,7 +94,27 @@ struct _GtkSwitchPrivate
GtkWidget *off_image;
GtkWidget *slider;
};
typedef struct _GtkSwitchPrivate GtkSwitchPrivate;
/**
* GtkSwitch:
*
* The #GtkSwitch-struct contains private
* data and it should only be accessed using the provided API.
*/
struct _GtkSwitch
{
/*< private >*/
GtkWidget parent_instance;
};
struct _GtkSwitchClass
{
GtkWidgetClass parent_class;
void (* activate) (GtkSwitch *sw);
gboolean (* state_set) (GtkSwitch *sw, gboolean state);
};
enum
{

View File

@@ -37,48 +37,9 @@ G_BEGIN_DECLS
#define GTK_TYPE_SWITCH (gtk_switch_get_type ())
#define GTK_SWITCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SWITCH, GtkSwitch))
#define GTK_IS_SWITCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SWITCH))
#define GTK_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SWITCH, GtkSwitchClass))
#define GTK_IS_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SWITCH))
#define GTK_SWITCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SWITCH, GtkSwitchClass))
typedef struct _GtkSwitch GtkSwitch;
typedef struct _GtkSwitchClass GtkSwitchClass;
/**
* GtkSwitch:
*
* The #GtkSwitch-struct contains private
* data and it should only be accessed using the provided API.
*/
struct _GtkSwitch
{
/*< private >*/
GtkWidget parent_instance;
};
/**
* GtkSwitchClass:
* @parent_class: The parent class.
* @activate: An action signal and emitting it causes the switch to animate.
* @state_set: Class handler for the ::state-set signal.
*/
struct _GtkSwitchClass
{
GtkWidgetClass parent_class;
/*< public >*/
void (* activate) (GtkSwitch *sw);
gboolean (* state_set) (GtkSwitch *sw, gboolean state);
/*< private >*/
void (* _switch_padding_1) (void);
void (* _switch_padding_2) (void);
void (* _switch_padding_3) (void);
void (* _switch_padding_4) (void);
void (* _switch_padding_5) (void);
};
GDK_AVAILABLE_IN_ALL
GType gtk_switch_get_type (void) G_GNUC_CONST;