GwyShader: Gwyddion Widgets Library Reference Manual

## GwyShader GwyShader — Spherical angle selector |

## Functions

GtkWidget * | gwy_shader_new ()
gdouble | gwy_shader_get_theta ()
gdouble | gwy_shader_get_phi ()
void | gwy_shader_set_theta ()
void | gwy_shader_set_phi ()
void | gwy_shader_set_angle ()
const gchar * | gwy_shader_get_gradient ()
void | gwy_shader_set_gradient ()
GtkUpdateType | gwy_shader_get_update_policy ()
void | gwy_shader_set_update_policy ()

## Properties

char * | gradient | Read / Write
GtkUpdateType | update-policy | Read / Write

## Signals

void | angle-changed | Run First

## Types and Values

struct | GwyShader
struct | GwyShaderClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkObject
                ╰── GtkWidget
                    ╰── GwyShader

## Implemented Interfaces

GwyShader implements AtkImplementorIface and GtkBuildable.

## Includes

    #include <libgwydgets/gwydgets.h>

## Description

GwyShader is a spherical angle selector that allows user to change angle by simply moving the north pole of a sphere around with mouse. It can display the sphere colored with various GwyGradient's.

## Functions

### gwy_shader_new ()

    GtkWidget *
    gwy_shader_new (const gchar *gradient);

Creates a new spherical shader.

The widget takes up all the space allocated for it.

#### Parameters

gradient | Name of gradient to color the spehere with. Can be `NULL` to use the default gradient. |

#### Returns

The new shader as a GtkWidget.

### gwy_shader_get_theta ()

    gdouble
    gwy_shader_get_theta (GwyShader *shader);

Returns the theta coordinate of a shader.

#### Parameters

shader | A shader. |

#### Returns

The theta coordinate, in radians. Theta coordinate is angle from sphere's north pole.

### gwy_shader_get_phi ()

    gdouble
    gwy_shader_get_phi (GwyShader *shader);

Returns the phi coordinate of a shader.

#### Parameters

shader | A shader. |

#### Returns

The phi coordinate, in radians. Phi coordinate is orientation in horizontal plane, measured from x axis, counterclockwise.

### gwy_shader_set_theta ()

    void
    gwy_shader_set_theta (GwyShader *shader,
                          gdouble theta);

Sets the theta coordinate of a shader.

#### Parameters

shader | A shader. |
theta | The theta coordinate to set. See `gwy_shader_get_theta()` for description. |

### gwy_shader_set_phi ()

    void
    gwy_shader_set_phi (GwyShader *shader,
                        gdouble phi);

Sets the phi coordinate of a shader.

#### Parameters

shader | A shader. |
phi | The phi coordinate to set. See `gwy_shader_get_phi()` for description. |

### gwy_shader_set_angle ()

    void
    gwy_shader_set_angle (GwyShader *shader,
                          gdouble theta,
                          gdouble phi);

Sets the spherical angle of a shader.

#### Parameters

shader | A shader. |
theta | The theta coordinate to set. See `gwy_shader_get_theta()` for description. |
phi | The phi coordinate to set. See `gwy_shader_get_phi()` for description. |

### gwy_shader_get_gradient ()

    const gchar *
    gwy_shader_get_gradient (GwyShader *shader);

Returns the name of color gradient a shader uses.

#### Parameters

shader | A shader. |

#### Returns

The gradient name. It must not be modified or freed. It may differ the name that was used on initialization or set with `gwy_shader_set_gradient()`, if the gradient didn't exist or was renamed meanwhile.

### gwy_shader_set_gradient ()

    void
    gwy_shader_set_gradient (GwyShader *shader,
                             const gchar *gradient);

Sets the gradient a shader uses.

#### Parameters

shader | A shader. |
gradient | Name of gradient `shader` should use. It should exist. |

### gwy_shader_get_update_policy ()

    GtkUpdateType
    gwy_shader_get_update_policy (GwyShader *shader);

Returns the update policy of a shader.

#### Parameters

shader | A shader. |

#### Returns

The update policy.

### gwy_shader_set_update_policy ()

    void
    gwy_shader_set_update_policy (GwyShader *shader,
                                  GtkUpdateType update_policy);

Sets the update policy of a shader.

#### Parameters

shader | A shader. |
update_policy | The update policy `shader` should use. |

## Types and Values

### struct GwyShader

    struct GwyShader;

### struct GwyShaderClass

    struct GwyShaderClass {
        GtkWidgetClass parent_class;

        void (*angle_changed)(GwyShader *shader);

        void (*reserved1)(void);
    };

## Property Details

### The `“gradient”` property

      “gradient”                 char *

Name of gradient the sphere is colored with.

Owner: GwyShader

Flags: Read / Write

Default value: NULL

### The `“update-policy”` property

      “update-policy”            GtkUpdateType

When value change causes signal emission.

Owner: GwyShader

Flags: Read / Write

Default value: GTK_UPDATE_CONTINUOUS

## Signal Details

### The `“angle-changed”` signal

    void
    user_function (GwyShader *gwyshader,
                   gpointer   user_data)

The ::angle-changed signal is emitted when the spherical angle changes.

#### Parameters

gwyshader | The GwyShader which received the signal. |
user_data | user data set when the signal handler was connected. |

Flags: Run First