bx-lib : the Basic X11 Library tuned for C beginners  1.0
Functions
Windows

Functions

bx_window bx_create_window (char const name[], int x, int y, unsigned w, unsigned h)
void bx_destroy_window (bx_window window)
char * bx_window_name (bx_window window)
void bx_rename_window (bx_window window, char const name[])
unsigned bx_window_width (bx_window window)
unsigned bx_window_height (bx_window window)
void bx_resize_window (bx_window window, unsigned w, unsigned h)
int bx_window_x (bx_window window)
int bx_window_y (bx_window window)
void bx_move_window (bx_window window, int x, int y)

Detailed Description

Function Documentation

bx_window bx_create_window ( char const  name[],
int  x,
int  y,
unsigned  w,
unsigned  h 
)

creates and displays a top-level window with a specified location on the screen, a specified name in the title bar, and a specified canvas size.

Parameters
namethe name in the title bar.
x,ythe location of the top left corner of the title bar.
w,hthe size (width and height) of the canvas of the window.
Returns
the created window.
Remarks
  • the window is displayed at creation time.
  • the initial size of the window is the size of the canvas.
  • the canvas size is not the canvas window but the drawable area available inside the window, which is fixed once the window is created.
  • the canvas is always centered in the window.
void bx_destroy_window ( bx_window  window)

destroys a window.

Parameters
windowthe window to be destroyed.
Returns
nothing.
char* bx_window_name ( bx_window  window)

gets the name displayed in the title bar of window

@ param window the window whose title is queried.

Returns
the queried name. This pointer points to a string owned by the function. You cannot free it and its contents changes at each call. Therefore, you should strcpy() the result to your own allocated memory if yu want a persistent result.
void bx_rename_window ( bx_window  window,
char const  name[] 
)

changes the title of the window displayed in its title bar.

Parameters
windowthe window to be renamed
namethe new name for the window
Returns
nothing.
unsigned bx_window_width ( bx_window  window)

gets the width of the window.

Parameters
windowthe window whose size is queried
Returns
the width of the window in pixels
unsigned bx_window_height ( bx_window  window)

gets the height of the window.

Parameters
windowthe window whose size is queried
Returns
the height of the window in pixels
void bx_resize_window ( bx_window  window,
unsigned  w,
unsigned  h 
)

changes the width and height of the window.

Parameters
windowthe window to be resized
wthe new width in pixels for the window
hthe new height in pixels for the window
Returns
nothing.
int bx_window_x ( bx_window  window)

gets the x-coordinate of the top-left corner of the window in the screen.

Parameters
windowthe window whose location is queried
Returns
the x-coordinate of the window in pixels
int bx_window_y ( bx_window  window)

gets the y-coordinate of the top-left corner of the window in the screen.

Parameters
windowthe window whose location is queried
Returns
the y-coordinate of the window in pixels
void bx_move_window ( bx_window  window,
int  x,
int  y 
)

changes the location of the window in the screen. Recall that pixel (0,0) is in top-left cormer, and that y-coordinates increase downwards.

Parameters
windowthe window to be moved
xthe new x-coordinate for the window
ythe new y-coordinate for the window
Returns
nothing.