Public Attributes | List of all members
CwChessboardClass Struct Reference

The Class structure of CwChessboard. More...

#include <CwChessboard.h>

Public Attributes

GtkDrawingAreaClass parent_class
 
Virtual functions of CwChessboard
gint(* calc_board_border_width )(CwChessboard const* chessboard, gint sside)
 
void(* draw_border )(CwChessboard* chessboard)
 
void(* draw_turn_indicator )(CwChessboard* chessboard, gboolean white, gboolean on)
 
void(* draw_piece [6])(CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white)
 
void(* draw_hud_layer )(CwChessboard* chessboard, cairo_t* cr, gint sside, guint hud)
 
gboolean(* draw_hud_square )(CwChessboard* chessboard, cairo_t* cr, gint col, gint row, gint sside, guint hud)
 
void(* cursor_left_chessboard )(CwChessboard* chessboard, gint prev_col, gint prev_row)
 
void(* cursor_entered_square )(CwChessboard* chessboard, gint prev_col, gint prev_row, gint col, gint row)
 

Detailed Description

The Class structure of CwChessboard.

Definition at line 125 of file CwChessboard.h.

Member Data Documentation

gint(* CwChessboardClass::calc_board_border_width) (CwChessboard const* chessboard, gint sside)

Calculate the border width of the chessboard as function of the side of a square, in pixels.

This function must use the parameter sside being passed and not the current sside of the passed chessboard (which can still be undefined even). The main reason for this is that sside recursively depends on the result of this function; it is called multiple times until sside stops changing and only then the real sside is set to it's final value.

Parameters
chessboardA CwChessboard.
ssideThe size of one side of a square.
Returns
The width of the border in pixels.

Default value: cw_chessboard_default_calc_board_border_width

Definition at line 151 of file CwChessboard.h.

void(* CwChessboardClass::cursor_entered_square) (CwChessboard* chessboard, gint prev_col, gint prev_row, gint col, gint row)

Notify the user that the mouse pointer entered a different square.

If non-NULL, this function is called every time the mouse pointer enters a new square, whether from outside the chessboard or from another square.

Default value: NULL.

Parameters
chessboardA CwChessboard.
prev_colThe column of the last square, or -1 if we entered from outside the chessboard.
prev_rowThe row of the last square, or -1 if we entered from outside the chessboard.
colThe column of the entered square.
rowThe row of the entered square.

Definition at line 269 of file CwChessboard.h.

void(* CwChessboardClass::cursor_left_chessboard) (CwChessboard* chessboard, gint prev_col, gint prev_row)

Notify the user that the mouse pointer left the chessboard.

If non-NULL, this function is called every time the mouse pointer leaves the chessboard.

Default value: NULL.

Parameters
chessboardA CwChessboard.
prev_colThe column of the last square.
prev_rowThe row of the last square.

Definition at line 253 of file CwChessboard.h.

void(* CwChessboardClass::draw_border) (CwChessboard* chessboard)

Draw the border around the chessboard. This function is called when the border is first drawn, and every time the chessboard is resized.

The width of the drawn border should be the value returned by calc_board_border_width.

Parameters
chessboardA CwChessboard.

Default value: cw_chessboard_default_draw_border

See also
cw_chessboard_set_draw_border

Definition at line 166 of file CwChessboard.h.

void(* CwChessboardClass::draw_hud_layer) (CwChessboard* chessboard, cairo_t* cr, gint sside, guint hud)

Draw the HUD layer. This is a layer in between the background (existing of the 64 squares with a single color) and the layer with the pieces. It can be used to add some texture to the background.

If the HUD layer is active, then this function is called whenever the widget is resized.

Parameters
chessboardA CwChessboard.
crA cairo drawing context.
ssideThe size of one side of a square, in pixels.
hudThe HUD index number, see the detailed documentation on the main page for more info.

Default value: cw_chessboard_default_draw_hud_layer

See also
cw_chessboard_enable_hud_layer, cw_chessboard_disable_hud_layer, cw_chessboard_default_draw_hud_layer

Definition at line 223 of file CwChessboard.h.

gboolean(* CwChessboardClass::draw_hud_square) (CwChessboard* chessboard, cairo_t* cr, gint col, gint row, gint sside, guint hud)

Draw a single HUD square at col, row. This function is called by cw_chessboard_default_draw_hud_layer for each square. You can use it if you don't override draw_hud_layer.

Parameters
chessboardA CwChessboard.
crA cairo drawing context.
colThe column of the square.
rowThe row of the square.
ssideThe size of one side of the square, in pixels.
hudThe HUD index number, see the detailed documentation of main page for more info.
Returns
TRUE if anything was drawn at all, FALSE if the HUD square is fully transparent.

Definition at line 239 of file CwChessboard.h.

void(* CwChessboardClass::draw_piece[6])(CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white)

An array with function pointers for drawing chess pieces.

The functions draw one of the six chess pieces, both white and black. The index of the array refers to the piece being drawn: pawn = 0, rook = 1, bishop = 2, knight = 3, queen = 4, king = 5.

The default values are given below. They can be overridden by assigning other values to this array.

See also
cw_chessboard_draw_pawn, cw_chessboard_draw_rook, cw_chessboard_draw_bishop, cw_chessboard_draw_knight, cw_chessboard_draw_queen, cw_chessboard_draw_king

Definition at line 201 of file CwChessboard.h.

void(* CwChessboardClass::draw_turn_indicator) (CwChessboard* chessboard, gboolean white, gboolean on)

Draw the indicator that indicates whose turn it is. This function is called every time the border is redrawn, as well as every time cw_chessboard_set_draw_turn_indicators is called.

Parameters
chessboardA CwChessboard.
whiteTrue if the indicator of the white color has to be drawn.
onTrue if the indictor is on, false if it is off.

Default value: cw_chessboard_default_draw_turn_indicator

See also
cw_chessboard_set_draw_border, cw_chessboard_set_draw_turn_indicators

Definition at line 182 of file CwChessboard.h.


The documentation for this struct was generated from the following file:

Copyright © 2006 - 2010 Carlo Wood.  All rights reserved.