コード例 #1
0
ファイル: animation.c プロジェクト: Distrotech/gtk-engines
/* Create all the relevant information for the animation, and insert it into the hash table. */
static void
add_animation (const GtkWidget *widget, gdouble stop_time)
{
	AnimationInfo *value;
	
	/* object already in the list, do not add it twice */
	if (lookup_animation_info (widget))
		return;
	
	if (animated_widgets == NULL)
		animated_widgets = g_hash_table_new_full (g_direct_hash, g_direct_equal,
		                                          NULL, destroy_animation_info_and_weak_unref);
	
	value = g_new(AnimationInfo, 1);
	
	value->widget = (GtkWidget*) widget;
	
	value->timer = g_timer_new ();
	value->stop_time= stop_time;
	value->start_modifier = 0.0;

	g_object_weak_ref (G_OBJECT (widget), on_animated_widget_destruction, value);
	g_hash_table_insert (animated_widgets, (GtkWidget*) widget, value);
	
	start_timer ();
}
コード例 #2
0
ファイル: animation.c プロジェクト: iegor/x11-themes-aurora
/* returns the origional state_type for the animation */
GtkStateType
aurora_animation_starting_state (gpointer data)
{
	AnimationInfo *animation_info = lookup_animation_info (data);
	
	if (animation_info)
		return animation_info->starting_state_type;
	else
		return GTK_STATE_NORMAL;
}
コード例 #3
0
ファイル: animation.c プロジェクト: iegor/x11-themes-aurora
/* returns the elapsed time for the animation */
gdouble
aurora_animation_elapsed (gpointer data)
{
	AnimationInfo *animation_info = lookup_animation_info (data);
	
	if (animation_info)
		return   g_timer_elapsed (animation_info->timer, NULL)- animation_info->start_modifier;
	else
		return 0.0;
}
コード例 #4
0
ファイル: animation.c プロジェクト: Distrotech/gtk-engines
static void
on_checkbox_toggle (GtkWidget *widget, gpointer data)
{
	AnimationInfo *animation_info = lookup_animation_info (widget);
	
	if (animation_info != NULL)
	{
		gfloat elapsed = g_timer_elapsed (animation_info->timer, NULL);
		
		animation_info->start_modifier = elapsed - animation_info->start_modifier;
	}
	else
	{
		add_animation (widget, CHECK_ANIMATION_TIME);
	}
}
コード例 #5
0
ファイル: animation.c プロジェクト: iegor/x11-themes-aurora
static void
on_button_toggle (GtkWidget *widget, GtkStateType prev_state, gpointer data)
{
	AnimationInfo *animation_info = lookup_animation_info (widget);
	
	if (animation_info != NULL)
	{
		gfloat elapsed = g_timer_elapsed (animation_info->timer, NULL);
		animation_info->start_modifier = elapsed - animation_info->start_modifier;
		animation_info->starting_state_type = prev_state;
	}
	else
	{
		add_animation (widget, ANIMATION_TRANS_TIME, prev_state, 0);
	}
}
コード例 #6
0
ファイル: animation.c プロジェクト: Distrotech/gtk-engines
/* returns TRUE if the widget is animated, and FALSE otherwise */
gboolean
clearlooks_animation_is_animated (GtkWidget *widget)
{
	return lookup_animation_info (widget) != NULL ? TRUE : FALSE;
}