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);

Object Hierarchy

  GObject
   +----AwnEffects

Properties

  "active"                   gboolean              : Read / Write / Construct
  "active-rect-color"        DesktopAgnosticColor*  : Read / Write
  "active-rect-outline"      DesktopAgnosticColor*  : Read / Write
  "arrow-png"                gchar*                : Read / Write / Construct
  "arrows-count"             gint                  : Read / Write / Construct
  "border-clip"              gint                  : Read / Write / Construct
  "custom-active-png"        gchar*                : Read / Write / Construct
  "depressed"                gboolean              : Read / Write / Construct
  "dot-color"                DesktopAgnosticColor*  : Read / Write
  "effects"                  gint                  : Read / Write / Construct
  "icon-alpha"               gfloat                : Read / Write / Construct
  "icon-offset"              gint                  : Read / Write / Construct
  "indirect-paint"           gboolean              : Read / Write / Construct
  "make-shadow"              gboolean              : Read / Write / Construct
  "no-clear"                 gboolean              : Read / Write / Construct
  "position"                 GtkPositionType       : Read / Write / Construct
  "progress"                 gfloat                : Read / Write / Construct
  "reflection-alpha"         gfloat                : Read / Write / Construct
  "reflection-offset"        gint                  : Read / Write / Construct
  "reflection-visible"       gboolean              : Read / Write / Construct
  "spotlight-png"            gchar*                : Read / Write / Construct
  "widget"                   GtkWidget*            : Read / Write

Signals

  "animation-end"                                  : Run First
  "animation-start"                                : Run First

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;

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);

Property Details

The "active" property

  "active"                   gboolean              : Read / Write / Construct

Determines whether to draw the active rectangle behind the icon.

Default value: FALSE


The "active-rect-color" property

  "active-rect-color"        DesktopAgnosticColor*  : Read / Write

Color used for painting active rectangle.


The "active-rect-outline" property

  "active-rect-outline"      DesktopAgnosticColor*  : Read / Write

Color used for painting outline of active rectangle.


The "arrow-png" property

  "arrow-png"                gchar*                : Read / Write / Construct

Icon to draw when arrows-count is more than 0.

Default value: "__awn_internal_arrow1"


The "arrows-count" property

  "arrows-count"             gint                  : Read / Write / Construct

Determines the number of arrows drawn.

Allowed values: >= 0

Default value: 0


The "border-clip" property

  "border-clip"              gint                  : Read / Write / Construct

Determines amount of clipping of the icon edge. (suitable for offset on the 3D bar)

Allowed values: >= 0

Default value: 0


The "custom-active-png" property

  "custom-active-png"        gchar*                : Read / Write / Construct

Path to a custom png icon which will be painted when the property "active" is set to TRUE.

Default value: NULL


The "depressed" property

  "depressed"                gboolean              : Read / Write / Construct

Determines whether to draw the icon slightly desaturated.

Default value: FALSE


The "dot-color" property

  "dot-color"                DesktopAgnosticColor*  : Read / Write

Color used for painting glowing dot.


The "effects" property

  "effects"                  gint                  : Read / Write / Construct

Set a bitmask to specify which kind of effects are used on the widget.

Default value: 0


The "icon-alpha" property

  "icon-alpha"               gfloat                : Read / Write / Construct

Determines alpha value of the drawn icon.

Allowed values: [0,1]

Default value: 1


The "icon-offset" property

  "icon-offset"              gint                  : Read / Write / Construct

Determines offset of the icon from border of the widget's window.

Default value: 0


The "indirect-paint" property

  "indirect-paint"           gboolean              : Read / Write / Construct

Determines whether transformations are applied directly to the widget, or to an offscreen buffer before being painted to target widget. Set to FALSE to improve performance, but will cause artifacts if used on non-transparent window.

Default value: TRUE


The "make-shadow" property

  "make-shadow"              gboolean              : Read / Write / Construct

Determines whether to draw a shadow around the icon.

Default value: FALSE


The "no-clear" property

  "no-clear"                 gboolean              : Read / Write / Construct

Whether the context should be cleared when painting. Set no-clear to FALSE to improve performace if you're using background of proper color on the widget.

Default value: TRUE


The "position" property

  "position"                 GtkPositionType       : Read / Write / Construct

Determines position of the widget.

Default value: GTK_POS_BOTTOM


The "progress" property

  "progress"                 gfloat                : Read / Write / Construct

Extra progress pie painted on the pie and percentage value it represents. Set to 1.0 to hide the progress pie.

Allowed values: [0,1]

Default value: 1


The "reflection-alpha" property

  "reflection-alpha"         gfloat                : Read / Write / Construct

Determines alpha value of the reflected icon.

Allowed values: [0,1]

Default value: 0.25


The "reflection-offset" property

  "reflection-offset"        gint                  : Read / Write / Construct

Determines offset of the reflection from the drawn icon.

Default value: 0


The "reflection-visible" property

  "reflection-visible"       gboolean              : Read / Write / Construct

Determines whether the reflection is visible.

Default value: TRUE


The "spotlight-png" property

  "spotlight-png"            gchar*                : Read / Write / Construct

Path to png icon which will be used for the spotlight effect.

Default value: "__awn_internal_spotlight"


The "widget" property

  "widget"                   GtkWidget*            : Read / Write

Determines which widget is animated by this instance of AwnEffects.

Signal Details

The "animation-end" signal

void                user_function                      (AwnEffects *arg0,
                                                        AwnEffect   arg1,
                                                        gpointer    user_data)      : Run First

fx: The AwnEffects instance which received the signal. effect: Effect type which just finished.

The ::animation-end signal is emitted when the animation finishes, and as ::animation-start signal is emitted only once for the entire animation (see the note in description for ::animation-start signal). You also have to explicitely ask AwnEffects to emit this signal using awn_effects_start_ex method.

user_data :

user data set when the signal handler was connected.

The "animation-start" signal

void                user_function                      (AwnEffects *arg0,
                                                        AwnEffect   arg1,
                                                        gpointer    user_data)      : Run First

fx: The AwnEffects instance which received the signal. effect: Effect type which was started.

The ::animation-start signal is emitted when the animation starts playing (ie. all other animations queued before it finish playing). You also have to explicitely ask AwnEffects to emit this signal using awn_effects_start_ex method. Note: Signal is emitted only once even if another animation with higher priority interrupts the animation and this animation is started again later (ie. no signal on this second start).

user_data :

user data set when the signal handler was connected.