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

# window

## Name

window —

## Synopsis

    GR_WINDOW_ID GrNewWindow                    (GR_WINDOW_ID parent,
                                                 GR_COORD x,
                                                 GR_COORD y,
                                                 GR_SIZE width,
                                                 GR_SIZE height,
                                                 GR_SIZE bordersize,
                                                 GR_COLOR background,
                                                 GR_COLOR bordercolor);
    GR_WINDOW_ID GrNewPixmap                    (GR_SIZE width,
                                                 GR_SIZE height,
                                                 void *addr);
    GR_WINDOW_ID GrNewInputWindow               (GR_WINDOW_ID parent,
                                                 GR_COORD x,
                                                 GR_COORD y,
                                                 GR_SIZE width,
                                                 GR_SIZE height);
    void        GrDestroyWindow                 (GR_WINDOW_ID wid);
    void        GrMapWindow                     (GR_WINDOW_ID wid);
    void        GrUnmapWindow                   (GR_WINDOW_ID wid);
    void        GrRaiseWindow                   (GR_WINDOW_ID wid);
    void        GrLowerWindow                   (GR_WINDOW_ID wid);
    void        GrMoveWindow                    (GR_WINDOW_ID wid,
                                                 GR_COORD x,
                                                 GR_COORD y);
    void        GrResizeWindow                  (GR_WINDOW_ID wid,
                                                 GR_SIZE width,
                                                 GR_SIZE height);
    void        GrReparentWindow                (GR_WINDOW_ID wid,
                                                 GR_WINDOW_ID pwid,
                                                 GR_COORD x,
                                                 GR_COORD y);
    void        GrGetWindowInfo                 (GR_WINDOW_ID wid,
                                                 GR_WINDOW_INFO *infoptr);
    void        GrSetWMProperties               (GR_WINDOW_ID wid,
                                                 GR_WM_PROPERTIES *props);
    void        GrGetWMProperties               (GR_WINDOW_ID wid,
                                                 GR_WM_PROPERTIES *props);
    void        GrSetFocus                      (GR_WINDOW_ID wid);
    GR_WINDOW_ID GrGetFocus                     (void);
    void        GrSetBorderColor                (GR_WINDOW_ID wid,
                                                 GR_COLOR color);
    void        GrSetBackgroundPixmap           (GR_WINDOW_ID wid,
                                                 GR_WINDOW_ID pixmap,
                                                 int flags);
    void        GrClearWindow                   (GR_WINDOW_ID wid,
                                                 GR_BOOL exposeflag);
    void        GrCloseWindow                   (GR_WINDOW_ID wid);
    void        GrKillWindow                    (GR_WINDOW_ID wid);

## Description

## Details

### GrNewWindow ()

    GR_WINDOW_ID GrNewWindow                    (GR_WINDOW_ID parent,
                                                 GR_COORD x,
                                                 GR_COORD y,
                                                 GR_SIZE width,
                                                 GR_SIZE height,
                                                 GR_SIZE bordersize,
                                                 GR_COLOR background,
                                                 GR_COLOR bordercolor);

Create a new window with the specified parent and window attributes.

`parent` : | the ID of the parent window
`x` : | the X coordinate of the new window relative to the parent window
`y` : | the Y coordinate of the new window relative to the parent window
`width` : | the width of the new window
`height` : | the height of the new window
`bordersize` : | the width of the window border
`background` : | the colour of the window background
`bordercolor` : | the colour of the window border
Returns : | the ID of the newly created window

### GrNewPixmap ()

    GR_WINDOW_ID GrNewPixmap                    (GR_SIZE width,
                                                 GR_SIZE height,
                                                 void *addr);

Create a new server side pixmap (an offscreen drawing area which can be copied into a window using a GrCopyArea call) of the specified width and height.

`width` : | the width of the pixmap
`height` : | the height of the pixmap
`addr` : | currently unused in client/server mode
Returns : | the ID of the newly created pixmap

### GrNewInputWindow ()

    GR_WINDOW_ID GrNewInputWindow               (GR_WINDOW_ID parent,
                                                 GR_COORD x,
                                                 GR_COORD y,
                                                 GR_SIZE width,
                                                 GR_SIZE height);

Create a new input-only window with the specified dimensions which is a child of the specified parent window.

`parent` : | the ID of the window to use as the parent of the new window
`x` : | the X coordinate of the new window relative to the parent window
`y` : | the Y coordinate of the new window relative to the parent window
`width` : | the width of the new window
`height` : | the height of the new window
Returns : | the ID of the newly created window

### GrDestroyWindow ()

    void        GrDestroyWindow                 (GR_WINDOW_ID wid);

Recursively unmaps and frees the data structures associated with the specified window and all of its children.

`wid` : | the ID of the window to destroy

### GrMapWindow ()

    void        GrMapWindow                     (GR_WINDOW_ID wid);

Recursively maps (makes visible) the specified window and all of the child windows which have a sufficient map count. The border and background of the window are painted, and an exposure event is generated for the window and every child which becomes visible.

`wid` : | the ID of the window to map

### GrUnmapWindow ()

    void        GrUnmapWindow                   (GR_WINDOW_ID wid);

Recursively unmaps (makes invisible) the specified window and all of the child windows.

`wid` : | the ID of the window to unmap

### GrRaiseWindow ()

    void        GrRaiseWindow                   (GR_WINDOW_ID wid);

Places the specified window at the top of its parents drawing stack, above all of its sibling windows.

`wid` : | the ID of the window to raise

### GrLowerWindow ()

    void        GrLowerWindow                   (GR_WINDOW_ID wid);

Places the specified window at the bottom of its parents drawing stack, below all of its sibling windows.

`wid` : | the ID of the window to lower

### GrMoveWindow ()

    void        GrMoveWindow                    (GR_WINDOW_ID wid,
                                                 GR_COORD x,
                                                 GR_COORD y);

Moves the specified window to the specified position relative to its parent window.

`wid` : | the ID of the window to move
`x` : | the X coordinate to move the window to relative to its parent.
`y` : | the Y coordinate to move the window to relative to its parent.

### GrResizeWindow ()

    void        GrResizeWindow                  (GR_WINDOW_ID wid,
                                                 GR_SIZE width,
                                                 GR_SIZE height);

Resizes the specified window to be the specified width and height.

`wid` : | the ID of the window to resize
`width` : | the width to resize the window to
`height` : | the height to resize the window to

### GrReparentWindow ()

    void        GrReparentWindow                (GR_WINDOW_ID wid,
                                                 GR_WINDOW_ID pwid,
                                                 GR_COORD x,
                                                 GR_COORD y);

Changes the parent window of the specified window to the specified parent window and places it at the specified coordinates relative to the new parent.

`wid` : | the ID of the window to reparent
`pwid` : | the ID of the new parent window
`x` : | the X coordinate to place the window at relative to the new parent
`y` : | the Y coordinate to place the window at relative to the new parent

### GrGetWindowInfo ()

    void        GrGetWindowInfo                 (GR_WINDOW_ID wid,
                                                 GR_WINDOW_INFO *infoptr);

Fills in a GR_WINDOW_INFO structure with information regarding the window with the specified window ID.

`wid` : | the ID of the window to retrieve information about
`infoptr` : | pointer to a GR_WINDOW_INFO structure to return the information in

### GrSetWMProperties ()

    void        GrSetWMProperties               (GR_WINDOW_ID wid,
                                                 GR_WM_PROPERTIES *props);

Copies the provided GR_WM_PROPERTIES structure into the the GR_WM_PROPERTIES structure of the specified window id.

`wid` : | the ID of the window to set the WM properties of
`props` : | pointer to a GR_WM_PROPERTIES structure

### GrGetWMProperties ()

    void        GrGetWMProperties               (GR_WINDOW_ID wid,
                                                 GR_WM_PROPERTIES *props);

Reads the GR_WM_PROPERTIES structure for the window with the specified id and fills in the provided structure with the information. It is the callers responsibility to free the title member as it is allocated dynamically. The title field will be set to NULL if the window has no title.

`wid` : | the ID of the window to retreive the WM properties of
`props` : | pointer to a GR_WM_PROPERTIES structure to fill in

### GrSetFocus ()

    void        GrSetFocus                      (GR_WINDOW_ID wid);

Sets the keyboard focus to the specified window.

`wid` : | the ID of the window to set the focus to

### GrGetFocus ()

    GR_WINDOW_ID GrGetFocus                     (void);

Returns : | the ID of the window which currently has the keyboard focus

### GrSetBorderColor ()

    void        GrSetBorderColor                (GR_WINDOW_ID wid,
                                                 GR_COLOR color);

Sets the border colour of the specified window to the specified colour.

`wid` : | the ID of the window to set the border colour of
`color` : |

### GrSetBackgroundPixmap ()

    void        GrSetBackgroundPixmap           (GR_WINDOW_ID wid,
                                                 GR_WINDOW_ID pixmap,
                                                 int flags);

Sets the background of the specified window to the specified pixmap. The flags which specify how to draw the pixmap (in the top left of the window, in the centre of the window, tiled, etc.) are those which start with GR_BACKGROUND_ in nano-X.h. If the pixmap value is 0, the server will disable the background pixmap and return to using a solid colour fill.

`wid` : | ID of the window to set the background of
`pixmap` : | ID of the pixmap to use as the background
`flags` : | flags specifying how to draw the pixmap onto the window

### GrClearWindow ()

    void        GrClearWindow                   (GR_WINDOW_ID wid,
                                                 GR_BOOL exposeflag);

Clears the specified window by setting it to its background color. If the exposeflag parameter is non zero, an exposure event is generated for the window after it has been cleared.

`wid` : | the ID of the window to clear
`exposeflag` : | a flag indicating whether to also generate an exposure event

### GrCloseWindow ()

    void        GrCloseWindow                   (GR_WINDOW_ID wid);

Sends a CLOSE_REQ event to the specified window if the client has selected to receive CLOSE_REQ events on this window. Used to request an application to shut down but not force it to do so immediately, so the application can ask whether to save changed files before shutting down cleanly.

`wid` : | the ID of the window to send the CLOSE_REQ event to

### GrKillWindow ()

    void        GrKillWindow                    (GR_WINDOW_ID wid);

Forcibly disconnects the client which owns this window with the specified ID number. Used to kill an application which has locked up and is not responding to CLOSE_REQ events.

`wid` : | the ID of the window to kill

<<< Previous Page | Home | Up | Next Page >>>
general | graphics