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) |
The Class structure of CwChessboard.
Definition at line 125 of file CwChessboard.h.
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.
chessboard | A CwChessboard. |
sside | The size of one side of a square. |
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.
chessboard | A CwChessboard. |
prev_col | The column of the last square, or -1 if we entered from outside the chessboard. |
prev_row | The row of the last square, or -1 if we entered from outside the chessboard. |
col | The column of the entered square. |
row | The 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.
chessboard | A CwChessboard. |
prev_col | The column of the last square. |
prev_row | The 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.
chessboard | A CwChessboard. |
Default value: cw_chessboard_default_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.
chessboard | A CwChessboard. |
cr | A cairo drawing context. |
sside | The size of one side of a square, in pixels. |
hud | The HUD index number, see the detailed documentation on the main page for more info. |
Default value: 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.
chessboard | A CwChessboard. |
cr | A cairo drawing context. |
col | The column of the square. |
row | The row of the square. |
sside | The size of one side of the square, in pixels. |
hud | The HUD index number, see the detailed documentation of main page for more info. |
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.
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.
chessboard | A CwChessboard. |
white | True if the indicator of the white color has to be drawn. |
on | True if the indictor is on, false if it is off. |
Default value: cw_chessboard_default_draw_turn_indicator
Definition at line 182 of file CwChessboard.h.