AwnEffects

AwnEffects

Synopsis

enum                AwnEffect;
                    AwnEffectsPrivate;
struct              AwnEffects;
AwnEffects *        awn_effects_new_for_widget          (GtkWidget *widget);
void                awn_effects_start                   (AwnEffects *fx,
                                                         const AwnEffect effect);
void                awn_effects_stop                    (AwnEffects *fx,
                                                         const AwnEffect effect);
void                awn_effects_start_ex                (AwnEffects *fx,
                                                         const AwnEffect effect,
                                                         gint max_loops,
                                                         gboolean signal_start,
                                                         gboolean signal_end);
void                awn_effects_set_icon_size           (AwnEffects *fx,
                                                         gint width,
                                                         gint height,
                                                         gboolean requestSize);
cairo_t *           awn_effects_cairo_create            (AwnEffects *fx);
cairo_t *           awn_effects_cairo_create_clipped    (AwnEffects *fx,
                                                         GdkEventExpose *event);
void                awn_effects_cairo_destroy           (AwnEffects *fx);
void                awn_effects_add_overlay             (AwnEffects *fx,
                                                         AwnOverlay *overlay);
void                awn_effects_remove_overlay          (AwnEffects *fx,
                                                         AwnOverlay *overlay);
GList *             awn_effects_get_overlays            (AwnEffects *fx);
void                awn_effects_redraw                  (AwnEffects *fx);
void                awn_effects_main_effect_loop        (AwnEffects *fx);
void                awn_effects_emit_anim_start         (AwnEffects *fx,
                                                         AwnEffect effect);
void                awn_effects_emit_anim_end           (AwnEffects *fx,
                                                         AwnEffect effect);

Description

Details

enum AwnEffect

typedef enum {
  AWN_EFFECT_NONE = 0,
  AWN_EFFECT_OPENING = 1,
  AWN_EFFECT_CLOSING = 2,
  AWN_EFFECT_HOVER = 3,
  AWN_EFFECT_LAUNCHING = 4,
  AWN_EFFECT_ATTENTION = 5,
  AWN_EFFECT_DESATURATE
} AwnEffect;


AwnEffectsPrivate

typedef struct _AwnEffectsPrivate AwnEffectsPrivate;


struct AwnEffects

struct AwnEffects {
  GObject parent;

  /* Properties */
  GtkWidget *widget;
  gboolean no_clear;
  gboolean indirect_paint;
  gint position;
  guint set_effects;
  gint icon_offset;
  gint refl_offset;
  gfloat icon_alpha;
  gfloat refl_alpha;
  gboolean do_reflection;
  gboolean make_shadow;
  gboolean is_active;
  gboolean depressed;
  gint arrows_count;
  gchar *label;
  gfloat progress;
  gint border_clip;
  GQuark spotlight_icon;
  GQuark arrow_icon;
  GQuark custom_active_icon;
  /* properties end */

  cairo_t * window_ctx;
  cairo_t * virtual_ctx;

  AwnEffectsPrivate *priv;
};

Class containing all necessary variables for effects state for particular widget.


awn_effects_new_for_widget ()

AwnEffects *        awn_effects_new_for_widget          (GtkWidget *widget);

Creates new AwnEffects instance.

widget :

Managed widget, computing window width and height is based on it and it is also passed to gtk_widget_queue_draw() during the animations.

awn_effects_start ()

void                awn_effects_start                   (AwnEffects *fx,
                                                         const AwnEffect effect);

Start a single effect. The effect will loop until awn_effect_stop() is called.

fx :

Pointer to AwnEffects instance.

effect :

AwnEffect to schedule.

awn_effects_stop ()

void                awn_effects_stop                    (AwnEffects *fx,
                                                         const AwnEffect effect);

Stop a single effect.

fx :

Pointer to AwnEffects instance.

effect :

AwnEffect to stop.

awn_effects_start_ex ()

void                awn_effects_start_ex                (AwnEffects *fx,
                                                         const AwnEffect effect,
                                                         gint max_loops,
                                                         gboolean signal_start,
                                                         gboolean signal_end);

Extended effect start, which provides a way to specify maximum number of loops and possibility to emit signals for animation start & end.

fx :

Pointer to AwnEffects instance.

effect :

Effect to schedule.

max_loops :

Number of maximum animation loops (0 for unlimited).

signal_start :

Determines whether the animation should emit "animation-start" signal when it starts.

signal_end :

Determines whether the animation should emit "animation-end" signal when it finishes.

awn_effects_set_icon_size ()

void                awn_effects_set_icon_size           (AwnEffects *fx,
                                                         gint width,
                                                         gint height,
                                                         gboolean requestSize);

Sets up correct offsets in managed window based on dimensions of drawn icon.

fx :

Pointer to AwnEffects instance.

width :

Width of drawn icon.

height :

Height of drawn icon.

requestSize :

Set to true to call gtk_widget_set_size_request for the managed widget.

awn_effects_cairo_create ()

cairo_t *           awn_effects_cairo_create            (AwnEffects *fx);

Note

Make sure you call awn_effects_cairo_destroy() on the cairo context returned by this call.

fx :

Pointer to AwnEffects instance.

Returns :

cairo context where an icon can be drawn. (the icon should have dimensions specified by a previous call to awn_effects_set_icon_size)

awn_effects_cairo_create_clipped ()

cairo_t *           awn_effects_cairo_create_clipped    (AwnEffects *fx,
                                                         GdkEventExpose *event);

Creates a Cairo context for drawing to "widget". The drawing region will be clipped to event's region member, and translated to its area member, so you can always paint the icon at coordinates [0, 0].

Note

Make sure you call awn_effects_cairo_destroy() on the cairo context returned by this call.

fx :

Pointer to AwnEffects instance.

event :

GdkEventExpose received by the widget.

Returns :

cairo context where an icon can be drawn. (the icon should have dimensions specified by a previous call to awn_effects_set_icon_size)

awn_effects_cairo_destroy ()

void                awn_effects_cairo_destroy           (AwnEffects *fx);

Finish drawing of the icon and run all post-ops.

fx :

Pointer to AwnEffects instance.

awn_effects_add_overlay ()

void                awn_effects_add_overlay             (AwnEffects *fx,
                                                         AwnOverlay *overlay);

Adds an overlay to the list of rendered overlays.

fx :

AwnEffects instance.

overlay :

AwnOverlay instance which should be added.

awn_effects_remove_overlay ()

void                awn_effects_remove_overlay          (AwnEffects *fx,
                                                         AwnOverlay *overlay);

Removes overlay from the list of rendered overlays.

fx :

AwnEffects instance.

overlay :

AwnOverlay which was previously added using awn_effects_add_overlay.

awn_effects_get_overlays ()

GList *             awn_effects_get_overlays            (AwnEffects *fx);

fx :

AwnEffects instance.

Returns :

a newly-allocated list of the overlays added to this effects instance.

awn_effects_redraw ()

void                awn_effects_redraw                  (AwnEffects *fx);

Schedules redraw of the managed widget. Contrary to gtk_widget_queue_draw, this function tries to minimize the area that needs to be redrawn.

fx :

AwnEffects instance.

awn_effects_main_effect_loop ()

void                awn_effects_main_effect_loop        (AwnEffects *fx);


awn_effects_emit_anim_start ()

void                awn_effects_emit_anim_start         (AwnEffects *fx,
                                                         AwnEffect effect);


awn_effects_emit_anim_end ()

void                awn_effects_emit_anim_end           (AwnEffects *fx,
                                                         AwnEffect effect);