Nano-X API Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# selections

## Name

selections —

## Synopsis

    void        GrSetSelectionOwner             (GR_WINDOW_ID wid,
                                                 GR_CHAR *typelist);
    GR_WINDOW_ID GrGetSelectionOwner            (GR_CHAR **typelist);
    void        GrRequestClientData             (GR_WINDOW_ID wid,
                                                 GR_WINDOW_ID rid,
                                                 GR_SERIALNO serial,
                                                 GR_MIMETYPE mimetype);
    void        GrSendClientData                (GR_WINDOW_ID wid,
                                                 GR_WINDOW_ID did,
                                                 GR_SERIALNO serial,
                                                 GR_LENGTH len,
                                                 GR_LENGTH thislen,
                                                 void *data);

## Description

## Details

### GrSetSelectionOwner ()

    void        GrSetSelectionOwner             (GR_WINDOW_ID wid,
                                                 GR_CHAR *typelist);

Sets the current selection (otherwise known as the clipboard) ownership to the specified window. Specifying an owner of 0 disowns the selection. The typelist argument is a list of mime types (seperated by space characters) which the window is able to supply the data as. At least one type must be specified unless you are disowning the selection (typically text/plain for plain ASCII text or text/uri-list for a filename).

The window which owns the current selection must be prepared to handle SELECTION_LOST events (received when another window takes ownership of the selection) and CLIENT_DATA_REQ events (received when a client wishes to retreive the selection data).

`wid` : | the ID of the window to set the selection owner to
`typelist` : | list of mime types selection data can be supplied as

### GrGetSelectionOwner ()

    GR_WINDOW_ID GrGetSelectionOwner            (GR_CHAR **typelist);

Finds the window which currently owns the selection and returns its ID, or 0 if no window currently owns the selection. A pointer to the list of mime types the selection owner is capable of supplying is placed in the pointer specified by the typelist argument. The typelist is null terminated, and the fields are seperated by space characters. It is the callers responsibility to free the typelist string, as it is allocated dynamically. If the allocation fails, it will be set to a NULL pointer, so remember to check the value of it before using it.

`typelist` : | pointer used to return the list of available mime types
Returns : | the ID of the window which currently owns the selection, or 0

### GrRequestClientData ()

    void        GrRequestClientData             (GR_WINDOW_ID wid,
                                                 GR_WINDOW_ID rid,
                                                 GR_SERIALNO serial,
                                                 GR_MIMETYPE mimetype);

Sends a CLIENT_DATA_REQ event to the specified window. Used for requesting both selection and "drag and drop" data. The mimetype argument specifies the format of the data you would like to receive, as an index into the list returned by GrGetSelectionOwner (the first type in the list is index 0). The server makes no guarantees as to when, or even if, the client will reply to the request. If the client does reply, the reply will take the form of one or more CLIENT_DATA events. The request serial number is typically a unique ID which the client can assign to a request in order for it to be able to keep track of transfers (CLIENT_DATA events contain the same number in the sid field). Remember to free the data field of the CLIENT_DATA events as they are dynamically allocated. Also note that if the allocation fails the data field will be set to NULL, so you should check the value before using it.

`wid` : | the ID of the window requesting the data
`rid` : | the ID of the window to request the data from
`serial` : | the serial number of the request
`mimetype` : | the number of the desired mime type to request

### GrSendClientData ()

    void        GrSendClientData                (GR_WINDOW_ID wid,
                                                 GR_WINDOW_ID did,
                                                 GR_SERIALNO serial,
                                                 GR_LENGTH len,
                                                 GR_LENGTH thislen,
                                                 void *data);

Used as the response to a CLIENT_DATA_REQ event. Sends the specified data of the specified length to the specified window using the specified source window ID and transfer serial number. Any fragmentation of the data into multiple CLIENT_DATA events which is required is handled automatically. The serial number should always be set to the value supplied by the CLIENT_DATA_REQ event. The thislen parameter is used internally to split the data up into packets. It should be set to the same value as the len parameter.

`wid` : | the ID of the window sending the data
`did` : | the ID of the destination window
`serial` : |
`len` : | the number of bytes of data to transfer
`thislen` : | the number of bytes in this packet
`data` : | pointer to the data to transfer

<<< Previous Page | Home | Up | Next Page >>>
regions | misc