## InfTextUser InfTextUser |

## Functions

InfTextUser * | inf_text_user_new ()
guint | inf_text_user_get_caret_position ()
gint | inf_text_user_get_selection_length ()
void | inf_text_user_set_selection ()
gdouble | inf_text_user_get_hue ()

## Properties

guint | caret-position | Read / Write / Construct
gdouble | hue | Read / Write / Construct
gint | selection-length | Read / Write / Construct

## Signals

void | selection-changed | Run Last

## Types and Values

struct | InfTextUser
struct | InfTextUserClass

## Object Hierarchy

        GObject
        ╰── InfUser
            ╰── InfAdoptedUser
                ╰── InfTextUser

## Description

## Functions

### inf_text_user_new ()

    InfTextUser *
    inf_text_user_new (guint id,
                       const gchar *name,
                       InfAdoptedStateVector *vector,
                       double hue);

Creates a new InfTextUser. `id` should be unique for all users working together. InfUserTable will refuse to add users with duplicate id. If `vector` is `NULL`, then the vector with all components zero is used.

[constructor]

#### Parameters

id | The user ID for this user. |
name | The user's name. |
vector | The state at which the user is at, or `NULL`. | [allow-none]
hue | The hue value of the user's color. |

#### Returns

A new InfTextUser. Free with `g_object_unref()` when no longer needed.

[transfer full]

### inf_text_user_get_caret_position ()

    guint
    inf_text_user_get_caret_position (InfTextUser *user);

Returns the position of `user` 's caret.

#### Parameters

user | A InfTextUser. |

#### Returns

`user` 's caret position.

### inf_text_user_get_selection_length ()

    gint
    inf_text_user_get_selection_length (InfTextUser *user);

Returns the number of characters this user has selected, starting from the caret position. Negative number mean selection towards the beginning of the buffer.

#### Parameters

user | A InfTextUser. |

#### Returns

`user` 's selection length in characters.

### inf_text_user_set_selection ()

    void
    inf_text_user_set_selection (InfTextUser *user,
                                 guint position,
                                 gint length,
                                 gboolean by_request);

Changes `user` 's selection (i.e. caret position and selection length). The `by_request` parameter should be set to `TRUE` if the selection change was requested explicitly, for example by the user actively moving the cursor using the mouse or the keyboard. If the cursor position changes only because another user inserted text at a position before the user's cursor and this results in a change of the selection position, the `by_request` parameter should be set to `FALSE`.

#### Parameters

user | A InfTextUser. |
position | The new position for the user's caret. |
length | The number of characters to select. Negative numbers mean selection towards the beginning. |
by_request | `TRUE` if explicitly requested or `FALSE` when just an effect of another operation. |

### inf_text_user_get_hue ()

    gdouble
    inf_text_user_get_hue (InfTextUser *user);

Returns the hue of the user's color as a double ranging from 0 to 1. The other components (saturation and lightness) are not specific to the user and may be chosen indivudually to optimize the actual visual display.

#### Parameters

user | A InfTextUser. |

#### Returns

The hue of the `user` 's color.

## Types and Values

### struct InfTextUser

    struct InfTextUser;

### struct InfTextUserClass

    struct InfTextUserClass {
      InfAdoptedUserClass parent_class;

      void(*selection_changed)(InfTextUser* user,
                               guint position,
                               guint length,
                               gboolean by_request);
    };

## Property Details

### The `“caret-position”` property

      “caret-position”           guint

The position of this user's caret.

Flags: Read / Write / Construct

Default value: 0

### The `“hue”` property

      “hue”                      gdouble

The hue value of the user's color. saturation and lightness are set by each client individually.

Flags: Read / Write / Construct

Allowed values: [0,1]

Default value: 0

### The `“selection-length”` property

      “selection-length”         gint

The number of characters of this user's selection.

Flags: Read / Write / Construct

Default value: 0

## Signal Details

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

    void
    user_function (InfTextUser *inftextuser,
                   guint        arg1,
                   gint         arg2,
                   gboolean     arg3,
                   gpointer     user_data)

#### Parameters

inftextuser | the object which received the signal. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last