This file contains the declaration of the GTK+ widget CwChessboard. More...
Go to the source code of this file.
Classes | |
struct | CwChessboard |
A GTK+ chessboard widget. More... | |
struct | CwChessboardClass |
The Class structure of CwChessboard. More... | |
Macros | |
#define | CWCHESSBOARD_INLINE |
#define | CWCHESSBOARD_DEFINE_INLINE 0 |
#define | CW_TYPE_CHESSBOARD (cw_chessboard_get_type()) |
#define | CW_CHESSBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CW_TYPE_CHESSBOARD, CwChessboard)) |
#define | CW_CHESSBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CW_TYPE_CHESSBOARD, CwChessboardClass)) |
#define | CW_IS_CHESSBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CW_TYPE_CHESSBOARD)) |
#define | CW_IS_CHESSBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CW_TYPE_CHESSBOARD)) |
#define | CW_CHESSBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CW_TYPE_CHESSBOARD, CwChessboardClass)) |
Typedefs | |
typedef struct _CwChessboard | CwChessboard |
typedef struct _CwChessboardClass | CwChessboardClass |
typedef struct _CwChessboardPrivate | CwChessboardPrivate |
typedef unsigned char | CwChessboardColorHandle |
A color handle used for background markers. More... | |
Functions | |
G_BEGIN_DECLS GType | cw_chessboard_get_type (void) G_GNUC_CONST |
CWCHESSBOARD_INLINE void | cw_chessboard_colrow2xy (CwChessboard* chessboard, gint col, gint row, gint* x, gint* y) |
CWCHESSBOARD_INLINE gint | cw_chessboard_x2col (CwChessboard* chessboard, gdouble x) |
CWCHESSBOARD_INLINE gint | cw_chessboard_y2row (CwChessboard* chessboard, gdouble y) |
Creation | |
GtkWidget* | cw_chessboard_new (void) |
Chess Position | |
void | cw_chessboard_set_square (CwChessboard* chessboard, gint col, gint row, CwChessboardCode code) |
CwChessboardCode | cw_chessboard_get_square (CwChessboard* chessboard, gint col, gint row) |
Border | |
void | cw_chessboard_set_draw_border (CwChessboard* chessboard, gboolean draw) |
void | cw_chessboard_set_draw_turn_indicators (CwChessboard* chessboard, gboolean draw) |
void | cw_chessboard_set_active_turn_indicator (CwChessboard* chessboard, gboolean white) |
void | cw_chessboard_set_flip_board (CwChessboard* chessboard, gboolean flip) |
gboolean | cw_chessboard_get_draw_border (CwChessboard* chessboard) |
gboolean | cw_chessboard_get_draw_turn_indicators (CwChessboard* chessboard) |
gboolean | cw_chessboard_get_active_turn_indicator (CwChessboard* chessboard) |
gboolean | cw_chessboard_get_flip_board (CwChessboard* chessboard) |
gint | cw_chessboard_default_calc_board_border_width (CwChessboard const* chessboard, gint sside) |
Colors | |
void | cw_chessboard_set_dark_square_color (CwChessboard* chessboard, GdkColor const* color) |
void | cw_chessboard_set_light_square_color (CwChessboard* chessboard, GdkColor const* color) |
void | cw_chessboard_set_border_color (CwChessboard* chessboard, GdkColor const* color) |
void | cw_chessboard_set_white_fill_color (CwChessboard* chessboard, GdkColor const* color) |
void | cw_chessboard_set_white_line_color (CwChessboard* chessboard, GdkColor const* color) |
void | cw_chessboard_set_black_fill_color (CwChessboard* chessboard, GdkColor const* color) |
void | cw_chessboard_set_black_line_color (CwChessboard* chessboard, GdkColor const* color) |
void | cw_chessboard_get_dark_square_color (CwChessboard* chessboard, GdkColor* color) |
void | cw_chessboard_get_light_square_color (CwChessboard* chessboard, GdkColor* color) |
void | cw_chessboard_get_border_color (CwChessboard* chessboard, GdkColor* color) |
void | cw_chessboard_get_white_fill_color (CwChessboard* chessboard, GdkColor* color) |
void | cw_chessboard_get_white_line_color (CwChessboard* chessboard, GdkColor* color) |
void | cw_chessboard_get_black_fill_color (CwChessboard* chessboard, GdkColor* color) |
void | cw_chessboard_get_black_line_color (CwChessboard* chessboard, GdkColor* color) |
CwChessboardColorHandle | cw_chessboard_allocate_color_handle_rgb (CwChessboard* chessboard, gdouble red, gdouble green, gdouble blue) |
CWCHESSBOARD_INLINE CwChessboardColorHandle | cw_chessboard_allocate_color_handle (CwChessboard* chessboard, GdkColor const* color) |
void | cw_chessboard_free_color_handle (CwChessboard* chessboard, CwChessboardColorHandle handle) |
void | cw_chessboard_set_background_color (CwChessboard* chessboard, gint col, gint row, CwChessboardColorHandle handle) |
CwChessboardColorHandle | cw_chessboard_get_background_color (CwChessboard* chessboard, gint col, gint row) |
void | cw_chessboard_set_background_colors (CwChessboard* chessboard, CwChessboardColorHandle const* handles) |
void | cw_chessboard_get_background_colors (CwChessboard* chessboard, CwChessboardColorHandle* handles) |
Floating Pieces | |
gint | cw_chessboard_add_floating_piece (CwChessboard* chessboard, CwChessboardCode code, gdouble x, gdouble y, gboolean pointer_device) |
void | cw_chessboard_move_floating_piece (CwChessboard* chessboard, gint handle, gdouble x, gdouble y) |
void | cw_chessboard_remove_floating_piece (CwChessboard* chessboard, gint handle) |
CwChessboardCode | cw_chessboard_get_floating_piece (CwChessboard* chessboard, gint handle) |
Default Drawing Functions | |
void | cw_chessboard_draw_pawn (CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white) |
void | cw_chessboard_draw_rook (CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white) |
void | cw_chessboard_draw_knight (CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white) |
void | cw_chessboard_draw_bishop (CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white) |
void | cw_chessboard_draw_queen (CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white) |
void | cw_chessboard_draw_king (CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white) |
void | cw_chessboard_default_draw_hud_layer (CwChessboard* chessboard, cairo_t* cr, gint sside, guint hud) |
gboolean | cw_chessboard_default_draw_hud_square (CwChessboard* chessboard, cairo_t* cr, gint col, gint row, gint sside, guint hud) |
void | cw_chessboard_default_draw_border (CwChessboard* chessboard) |
void | cw_chessboard_default_draw_turn_indicator (CwChessboard* chessboard, gboolean white, gboolean on) |
HUD Layers | |
void | cw_chessboard_enable_hud_layer (CwChessboard* chessboard, guint hud) |
void | cw_chessboard_disable_hud_layer (CwChessboard* chessboard, guint hud) |
Markers | |
void | cw_chessboard_set_marker_color (CwChessboard* chessboard, gint col, gint row, CwChessboardColorHandle mahandle) |
CwChessboardColorHandle | cw_chessboard_get_marker_color (CwChessboard* chessboard, gint col, gint row) |
void | cw_chessboard_set_marker_thickness (CwChessboard* chessboard, gdouble thickness) |
gdouble | cw_chessboard_get_marker_thickness (CwChessboard* chessboard) |
void | cw_chessboard_set_marker_level (CwChessboard* chessboard, gboolean below) |
Cursor | |
void | cw_chessboard_show_cursor (CwChessboard* chessboard) |
void | cw_chessboard_hide_cursor (CwChessboard* chessboard) |
void | cw_chessboard_set_cursor_thickness (CwChessboard* chessboard, gdouble thickness) |
gdouble | cw_chessboard_get_cursor_thickness (CwChessboard* chessboard) |
void | cw_chessboard_set_cursor_color (CwChessboard* chessboard, GdkColor const* color) |
void | cw_chessboard_get_cursor_color (CwChessboard* chessboard, GdkColor* color) |
Arrows | |
gpointer | cw_chessboard_add_arrow (CwChessboard* chessboard, gint begin_col, gint begin_row, gint end_col, gint end_row, GdkColor const* color) |
void | cw_chessboard_remove_arrow (CwChessboard* chessboard, gpointer ptr) |
This file contains the declaration of the GTK+ widget CwChessboard.
Definition in file CwChessboard.h.
A color handle used for background markers.
The five least significant bits determine the color from a user defined color palet, used by the background squares and markers. A value of zero meaning the default background value for that square, or no marker - respectively.
Definition at line 79 of file CwChessboard.h.
gpointer cw_chessboard_add_arrow | ( | CwChessboard* | chessboard, |
gint | begin_col, | ||
gint | begin_row, | ||
gint | end_col, | ||
gint | end_row, | ||
GdkColor const* | color | ||
) |
Draw an arrow on the board.
chessboard | A CwChessboard. |
begin_col | The column of the starting square. |
begin_row | The row of the starting square. |
end_col | The column of the ending square. |
end_row | The row of the ending square. |
color | The color to draw the arrow in. |
Definition at line 2303 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::add_arrow().
gint cw_chessboard_add_floating_piece | ( | CwChessboard* | chessboard, |
CwChessboardCode | code, | ||
gdouble | x, | ||
gdouble | y, | ||
gboolean | pointer_device | ||
) |
This function displays a chess piece with code code at widget coordinates (x, y). Half the side of a square will be subtracted from the coordinates passed, and the result truncated, in order to determine where to draw the top-left corner of the piece. The result is that (x, y) is more or less the center of the piece.
Setting pointer_device will cause gdk_window_get_pointer to be called after the next redraw has finished. This is needed to receive the next motion notify event with GDK_POINTER_MOTION_HINT_MASK being used.
There may only be one floating piece related the pointer device at a time. If there is already another floating piece related to the pointer device then the value of pointer_device is ignored.
chessboard | A CwChessboard. |
code | The code of the chess piece to be drawn. |
x | The center x-coordinate of the piece. |
y | The center y-coordinate of the piece. |
pointer_device | Whether this piece is under the pointer device or not. |
Definition at line 2098 of file CwChessboard.cc.
References empty_square.
Referenced by cwmm::ChessboardWidget::add_floating_piece().
CWCHESSBOARD_INLINE CwChessboardColorHandle cw_chessboard_allocate_color_handle | ( | CwChessboard* | chessboard, |
GdkColor const* | color | ||
) |
Allocate a new CwChessboardColorHandle. From more information, see cw_chessboard_allocate_color_handle_rgb.
chessboard | A CwChessboard. |
color | The color to allocate. |
Referenced by cwmm::ChessboardWidget::allocate_color_handle().
CwChessboardColorHandle cw_chessboard_allocate_color_handle_rgb | ( | CwChessboard* | chessboard, |
gdouble | red, | ||
gdouble | green, | ||
gdouble | blue | ||
) |
Allocate a new CwChessboardColorHandle. Simultaneous, there can be at most 31 different colors. It is the responsibility of the user to free the colors if they are no longer used.
chessboard | A CwChessboard. |
red | The red component of the color in the range [0...1]. |
green | The green component of the color in the range [0...1]. |
blue | The blue component of the color in the range [0...1]. |
Definition at line 1645 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::allocate_color_handle_rgb().
CWCHESSBOARD_INLINE void cw_chessboard_colrow2xy | ( | CwChessboard* | chessboard, |
gint | col, | ||
gint | row, | ||
gint* | x, | ||
gint* | y | ||
) |
Convert a (col, row) pair to the top-left coordinates of the corresponding square, relative to the top-left of the widget.
chessboard | A CwChessboard. |
col | A column, in the range [0, 7]. |
row | A row, in the range [0, 7]. |
x | A pointer to where the x-coordinate of the result will be written to. |
y | A pointer to where the y-coordinate of the result will be written to. |
Referenced by cwmm::ChessboardWidget::colrow2xy().
gint cw_chessboard_default_calc_board_border_width | ( | CwChessboard const* | chessboard, |
gint | sside | ||
) |
This is the default value of CwChessboardClass::calc_board_border_width. The formula used by this default function is MAX(8.0, round(1.0 + (sside - 12) / 25.0) + sside / 3.0).
chessboard | A CwChessboard. |
sside | The size of one side of a square in pixels. |
Definition at line 1401 of file CwChessboard.cc.
References cw_chessboard_default_draw_hud_square().
void cw_chessboard_default_draw_border | ( | CwChessboard* | chessboard | ) |
This is the default value of CwChessboardClass::draw_border.
chessboard | A CwChessboard. |
Definition at line 750 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::draw_border().
void cw_chessboard_default_draw_hud_layer | ( | CwChessboard* | chessboard, |
cairo_t* | cr, | ||
gint | sside, | ||
guint | hud | ||
) |
The default CwChessboardClass::draw_hud_layer function. You can restore the default behaviour with:
chessboard | A CwChessboard. |
cr | The cairo drawing context. |
sside | The side of one square in pixels. |
hud | The HUD layer (0 or 1). |
This function calls CwChessboardClass::draw_hud_square for every square.
Definition at line 1452 of file CwChessboard.cc.
References cwchess::col_mask, cw_chessboard_default_draw_hud_layer(), and cwchess::row_mask.
Referenced by cw_chessboard_default_draw_hud_layer(), and cwmm::ChessboardWidget::draw_hud_layer().
gboolean cw_chessboard_default_draw_hud_square | ( | CwChessboard* | chessboard, |
cairo_t* | cr, | ||
gint | col, | ||
gint | row, | ||
gint | sside, | ||
guint | hud | ||
) |
The default CwChessboardClass::draw_hud_square function. This function is only used by cw_chessboard_default_draw_hud_layer. You can restore the default behaviour of cw_chessboard_default_draw_hud_layer with:
This function hatches the dark squares with fine, diagonal lines.
chessboard | A CwChessboard. |
cr | The cairo drawing context. |
col | The column of the square. |
row | The row of the square. |
sside | The side of one square in pixels. |
hud | The HUD layer (0 or 1). |
TRUE
if anything was drawn. FALSE
otherwise. Referenced by cw_chessboard_default_calc_board_border_width(), and cwmm::ChessboardWidget::draw_hud_square().
void cw_chessboard_default_draw_turn_indicator | ( | CwChessboard* | chessboard, |
gboolean | white, | ||
gboolean | on | ||
) |
This is the default value of CwChessboardClass::draw_turn_indicator.
chessboard | A CwChessboard. |
white | TRUE if it's whites indicator. |
on | TRUE if the indicator has to be drawn, FALSE if the indicator has to be removed. |
Definition at line 838 of file CwChessboard.cc.
References cw_chessboard_disable_hud_layer(), cw_chessboard_enable_hud_layer(), CwChessboard::sside, CwChessboard::top_left_a1_x, and CwChessboard::top_left_a1_y.
Referenced by cwmm::ChessboardWidget::draw_turn_indicator().
void cw_chessboard_disable_hud_layer | ( | CwChessboard* | chessboard, |
guint | hud | ||
) |
Disable the HUD layer again. Used resources are returned to the system.
chessboard | A CwChessboard. |
hud | The HUD layer (0 or 1). |
Definition at line 2216 of file CwChessboard.cc.
Referenced by cw_chessboard_default_draw_turn_indicator(), and cwmm::ChessboardWidget::disable_hud_layer().
void cw_chessboard_draw_bishop | ( | CwChessboard* | chessboard, |
cairo_t* | cr, | ||
gdouble | x, | ||
gdouble | y, | ||
gdouble | sside, | ||
gboolean | white | ||
) |
This is the default function used by CwChessboard to draw a bishop.
See cw_chessboard_draw_pawn for more details.
Definition at line 3148 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::draw_bishop().
void cw_chessboard_draw_king | ( | CwChessboard* | chessboard, |
cairo_t* | cr, | ||
gdouble | x, | ||
gdouble | y, | ||
gdouble | sside, | ||
gboolean | white | ||
) |
This is the default function used by CwChessboard to draw a king.
See cw_chessboard_draw_pawn for more details.
Definition at line 2475 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::draw_king().
void cw_chessboard_draw_knight | ( | CwChessboard* | chessboard, |
cairo_t* | cr, | ||
gdouble | x, | ||
gdouble | y, | ||
gdouble | sside, | ||
gboolean | white | ||
) |
This is the default function used by CwChessboard to draw a knight.
See cw_chessboard_draw_pawn for more details.
Definition at line 3484 of file CwChessboard.cc.
References cw_chessboard_move_floating_piece(), and CwChessboard::sside.
Referenced by cwmm::ChessboardWidget::draw_knight().
void cw_chessboard_draw_pawn | ( | CwChessboard* | chessboard, |
cairo_t* | cr, | ||
gdouble | x, | ||
gdouble | y, | ||
gdouble | sside, | ||
gboolean | white | ||
) |
This is the default function used by CwChessboard to draw pawns.
If white is set, a white pawn will be drawn. Otherwise a black pawn.
cw_chessboard_draw_pawn
is the default function called via a call to CwChessboardClass::draw_piece. It is called every time the chessboard is resized.
The function uses vector graphics (by doing direct calls to cairo), and is therefore capable of drawing the piece in any arbitrary size and uses anti-aliasing.
chessboard | A CwChessboard. |
cr | The cairo drawing context. |
x | The (widget) x-coordinate of the center of the piece. |
y | The (widget) y-coordinate of the center of the piece. |
sside | The assumed side of a square, in pixels. chessboard->sside is ignored, so that this function can be used to draw pieces elsewhere with a different size than what is used on the chessboard. |
white | A boolean that determines if a black or white piece is drawn. |
Definition at line 2394 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::draw_pawn().
void cw_chessboard_draw_queen | ( | CwChessboard* | chessboard, |
cairo_t* | cr, | ||
gdouble | x, | ||
gdouble | y, | ||
gdouble | sside, | ||
gboolean | white | ||
) |
This is the default function used by CwChessboard to draw a queen.
See cw_chessboard_draw_pawn for more details.
Definition at line 2706 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::draw_queen().
void cw_chessboard_draw_rook | ( | CwChessboard* | chessboard, |
cairo_t* | cr, | ||
gdouble | x, | ||
gdouble | y, | ||
gdouble | sside, | ||
gboolean | white | ||
) |
This is the default function used by CwChessboard to draw a rook.
See cw_chessboard_draw_pawn for more details.
Definition at line 3021 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::draw_rook().
void cw_chessboard_enable_hud_layer | ( | CwChessboard* | chessboard, |
guint | hud | ||
) |
Active a HUD layer. HUD 0 lays between the background and the pieces. HUD 1 lays above the pieces. A custom HUD layer can be created by setting CwChessboardClass::draw_hud_layer.
chessboard | A CwChessboard. |
hud | The HUD layer (0 or 1). |
Definition at line 2209 of file CwChessboard.cc.
Referenced by cw_chessboard_default_draw_turn_indicator(), and cwmm::ChessboardWidget::enable_hud_layer().
void cw_chessboard_free_color_handle | ( | CwChessboard* | chessboard, |
CwChessboardColorHandle | handle | ||
) |
Free up the color handle handle, so it can be reused.
chessboard | A CwChessboard. |
handle | A color handle as returned by cw_chessboard_allocate_color_handle_rgb or cw_chessboard_allocate_color_handle. |
Definition at line 1663 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::free_color_handle().
gboolean cw_chessboard_get_active_turn_indicator | ( | CwChessboard* | chessboard | ) |
Get the boolean that detemines which turn indicator is active (blacks or whites).
chessboard | A CwChessboard. |
TRUE
if whites turn indicator is active (independent on whether or not it is being drawn).Definition at line 1835 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_active_turn_indicator().
CwChessboardColorHandle cw_chessboard_get_background_color | ( | CwChessboard* | chessboard, |
gint | col, | ||
gint | row | ||
) |
Convenience function.
chessboard | A CwChessboard. |
col | The column of the square. |
row | The row of the square. |
Definition at line 1720 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_background_color().
void cw_chessboard_get_background_colors | ( | CwChessboard* | chessboard, |
CwChessboardColorHandle* | handles | ||
) |
Fill the array handles with the current color handles.
chessboard | A CwChessboard. |
handles | The output array. Should be an array of 64 CwChessboardColorHandles. |
Definition at line 1734 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_background_colors().
void cw_chessboard_get_black_fill_color | ( | CwChessboard* | chessboard, |
GdkColor* | color | ||
) |
Retrieve the current fill color of the black chess pieces.
chessboard | A CwChessboard. |
color | Pointer to the output variable. |
Definition at line 1938 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_black_fill_color().
void cw_chessboard_get_black_line_color | ( | CwChessboard* | chessboard, |
GdkColor* | color | ||
) |
Retrieve the current line color of the black chess pieces.
chessboard | A CwChessboard. |
color | Pointer to the output variable. |
Definition at line 1956 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_black_line_color().
void cw_chessboard_get_border_color | ( | CwChessboard* | chessboard, |
GdkColor* | color | ||
) |
Retrieve the current color of the border around the chessboard.
chessboard | A CwChessboard. |
color | Pointer to the output variable. |
Definition at line 1884 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_border_color().
void cw_chessboard_get_cursor_color | ( | CwChessboard* | chessboard, |
GdkColor* | color | ||
) |
Get the current cursor color.
chessboard | A CwChessboard. |
color | Pointer to the output variable. |
Definition at line 1973 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_cursor_color().
gdouble cw_chessboard_get_cursor_thickness | ( | CwChessboard* | chessboard | ) |
Get the current cursor thickness as fraction of sside.
chessboard | A CwChessboard. |
Definition at line 1989 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_cursor_thickness().
void cw_chessboard_get_dark_square_color | ( | CwChessboard* | chessboard, |
GdkColor* | color | ||
) |
Retrieve the current background color of the dark squares.
chessboard | A CwChessboard. |
color | Pointer to the output variable. |
Definition at line 1849 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_dark_square_color().
gboolean cw_chessboard_get_draw_border | ( | CwChessboard* | chessboard | ) |
Get the boolean that determines whether or not the chessboard widget draws a border around the chessboard.
chessboard | A CwChessboard. |
TRUE
if the border is being drawn.Definition at line 1773 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_draw_border().
gboolean cw_chessboard_get_draw_turn_indicators | ( | CwChessboard* | chessboard | ) |
Get the boolean that determines whether or not turn indicators are being drawn.
chessboard | A CwChessboard. |
TRUE
if turn indicators are being drawn.Definition at line 1815 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_draw_turn_indicators().
gboolean cw_chessboard_get_flip_board | ( | CwChessboard* | chessboard | ) |
Get the boolean which determines whether white is playing bottom up or top down.
chessboard | A CwChessboard. |
FALSE
if white plays upwards and TRUE
if white plays downwards.Definition at line 1796 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_flip_board().
CwChessboardCode cw_chessboard_get_floating_piece | ( | CwChessboard* | chessboard, |
gint | handle | ||
) |
Get the CwChessboardCode of the floating piece represented by handle. handle must be a handle as returned by cw_chessboard_add_floating_piece.
chessboard | A CwChessboard. |
handle | The floating piece handle. |
Definition at line 2203 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_floating_piece().
void cw_chessboard_get_light_square_color | ( | CwChessboard* | chessboard, |
GdkColor* | color | ||
) |
Retrieve the current background color of the light squares.
chessboard | A CwChessboard. |
color | Pointer to the output variable. |
Definition at line 1866 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_light_square_color().
CwChessboardColorHandle cw_chessboard_get_marker_color | ( | CwChessboard* | chessboard, |
gint | col, | ||
gint | row | ||
) |
Convenience function.
chessboard | A CwChessboard. |
col | The column of the square. |
row | The row of the square. |
Definition at line 1686 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_marker_color().
gdouble cw_chessboard_get_marker_thickness | ( | CwChessboard* | chessboard | ) |
Get the current marker thickness as fraction of sside.
chessboard | A CwChessboard. |
Definition at line 1699 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_marker_thickness().
CwChessboardCode cw_chessboard_get_square | ( | CwChessboard* | chessboard, |
gint | col, | ||
gint | row | ||
) |
Get the chess piece code for the square at (col, row).
Definition at line 1755 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_square().
void cw_chessboard_get_white_fill_color | ( | CwChessboard* | chessboard, |
GdkColor* | color | ||
) |
Retrieve the current fill color of the white chess pieces.
chessboard | A CwChessboard. |
color | Pointer to the output variable. |
Definition at line 1902 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_white_fill_color().
void cw_chessboard_get_white_line_color | ( | CwChessboard* | chessboard, |
GdkColor* | color | ||
) |
Retrieve the current line color of the white chess pieces.
chessboard | A CwChessboard. |
color | Pointer to the output variable. |
Definition at line 1920 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::get_white_line_color().
void cw_chessboard_hide_cursor | ( | CwChessboard* | chessboard | ) |
Hide the cursor.
chessboard | A CwChessboard. |
Definition at line 2008 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::hide_cursor().
void cw_chessboard_move_floating_piece | ( | CwChessboard* | chessboard, |
gint | handle, | ||
gdouble | x, | ||
gdouble | y | ||
) |
Move a floating piece with handle handle to the new widget coordinates at (x, y). handle must be a handle as returned by cw_chessboard_add_floating_piece.
chessboard | A CwChessboard. |
handle | The floating piece handle. |
x | The new x coordinate. |
y | The new y coordinate. |
Definition at line 2015 of file CwChessboard.cc.
References cw_chessboard_x2col(), and cw_chessboard_y2row().
Referenced by cw_chessboard_draw_knight(), and cwmm::ChessboardWidget::move_floating_piece().
GtkWidget* cw_chessboard_new | ( | void | ) |
Create a new chessboard widget.
Definition at line 1639 of file CwChessboard.cc.
void cw_chessboard_remove_arrow | ( | CwChessboard* | chessboard, |
gpointer | ptr | ||
) |
Remove a previously added arrow.
chessboard | A CwChessboard. |
ptr | The arrow handle as returned by cw_chessboard_add_arrow. |
Definition at line 2328 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::remove_arrow().
void cw_chessboard_remove_floating_piece | ( | CwChessboard* | chessboard, |
gint | handle | ||
) |
Delete the floating piece with handle handle. handle must be a handle as returned by cw_chessboard_add_floating_piece.
chessboard | A CwChessboard. |
handle | The floating piece handle. |
Definition at line 2143 of file CwChessboard.cc.
References cw_chessboard_x2col(), cw_chessboard_y2row(), and empty_square.
Referenced by cwmm::ChessboardWidget::remove_floating_piece().
void cw_chessboard_set_active_turn_indicator | ( | CwChessboard* | chessboard, |
gboolean | white | ||
) |
Set the boolean that detemines which turn indicator is active (blacks or whites). If drawing turn indicators is enabled and the color is changed then the old indicator is erased. If the turn indicators are disabled, nothing happens.
chessboard | A CwChessboard. |
white | TRUE if the white turn indicator should be on (and blacks off). |
Definition at line 1820 of file CwChessboard.cc.
References cwchess::white.
Referenced by cwmm::ChessboardWidget::set_active_turn_indicator().
void cw_chessboard_set_background_color | ( | CwChessboard* | chessboard, |
gint | col, | ||
gint | row, | ||
CwChessboardColorHandle | handle | ||
) |
Set the background color of the square at col, row.
chessboard | A CwChessboard. |
col | The column of the square. |
row | The row of the square. |
handle | A color handle as returned by cw_chessboard_allocate_color_handle_rgb or cw_chessboard_allocate_color_handle. A handle with a value of 0 means the default background color. |
Definition at line 1709 of file CwChessboard.cc.
Referenced by cw_chessboard_set_background_colors(), and cwmm::ChessboardWidget::set_background_color().
void cw_chessboard_set_background_colors | ( | CwChessboard* | chessboard, |
CwChessboardColorHandle const* | handles | ||
) |
Set new background colors of any number of squares.
chessboard | A CwChessboard. |
handles | Array of 64 CwChessboardColorHandles. A handle with a value of 0 means the default background color. |
Definition at line 1725 of file CwChessboard.cc.
References cw_chessboard_set_background_color().
Referenced by cwmm::ChessboardWidget::set_background_colors().
void cw_chessboard_set_black_fill_color | ( | CwChessboard* | chessboard, |
GdkColor const* | color | ||
) |
Set the fill color of the black chess pieces. Default: black
chessboard | A CwChessboard. |
color | The new fill color of the black pieces. |
Definition at line 1928 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::set_black_fill_color().
void cw_chessboard_set_black_line_color | ( | CwChessboard* | chessboard, |
GdkColor const* | color | ||
) |
Set the line color of the black chess pieces. Default: white
chessboard | A CwChessboard. |
color | The new line color of the black pieces. |
Definition at line 1946 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::set_black_line_color().
void cw_chessboard_set_border_color | ( | CwChessboard* | chessboard, |
GdkColor const* | color | ||
) |
Set the color of the border around the chessboard.
chessboard | A CwChessboard. |
color | The new color of the border. |
Definition at line 1874 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::set_border_color().
void cw_chessboard_set_cursor_color | ( | CwChessboard* | chessboard, |
GdkColor const* | color | ||
) |
Set the color of the cursor.
chessboard | A CwChessboard. |
color | The color to be used for the cursor. |
Definition at line 1964 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::set_cursor_color().
void cw_chessboard_set_cursor_thickness | ( | CwChessboard* | chessboard, |
gdouble | thickness | ||
) |
Set the cursor thickness. This is a value between 0 and 0.5.
chessboard | A CwChessboard. |
thickness | The thickness of the cursor as fraction of sside. Range [0...0.5] |
Definition at line 1981 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::set_cursor_thickness().
void cw_chessboard_set_dark_square_color | ( | CwChessboard* | chessboard, |
GdkColor const* | color | ||
) |
Set the background color of the dark squares (a1, c1 etc). Default: light green.
chessboard | A CwChessboard. |
color | The new color of the dark squares. |
Definition at line 1840 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::set_dark_square_color().
void cw_chessboard_set_draw_border | ( | CwChessboard* | chessboard, |
gboolean | draw | ||
) |
Set the boolean which determines whether or not the chessboard widget draws a border around the chessboard. Default: TRUE (draw border).
chessboard | A CwChessboard. |
draw | Boolean, determining if the border should be drawn. |
Definition at line 1763 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::set_draw_border().
void cw_chessboard_set_draw_turn_indicators | ( | CwChessboard* | chessboard, |
gboolean | draw | ||
) |
Set the boolean which determines whether or not to draw turn indicators. Indicators will only be drawn if also the border is drawn. Default: TRUE (draw indicators).
chessboard | A CwChessboard. |
draw | Boolean, determining if the indicators should be drawn. |
Definition at line 1801 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::set_draw_turn_indicators().
void cw_chessboard_set_flip_board | ( | CwChessboard* | chessboard, |
gboolean | flip | ||
) |
Set the boolean which determines whether white is playing bottom up or top down. Default: FALSE (white plays upwards).
chessboard | A CwChessboard. |
flip | Boolean, determining if white plays upwards or not. |
Definition at line 1778 of file CwChessboard.cc.
References CwChessboard::flip_board.
Referenced by cwmm::ChessboardWidget::set_flip_board().
void cw_chessboard_set_light_square_color | ( | CwChessboard* | chessboard, |
GdkColor const* | color | ||
) |
Set the background color of the light squares (b1, d1 etc). Default: yellow/white.
chessboard | A CwChessboard. |
color | The new color of the light squares. |
Definition at line 1857 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::set_light_square_color().
void cw_chessboard_set_marker_color | ( | CwChessboard* | chessboard, |
gint | col, | ||
gint | row, | ||
CwChessboardColorHandle | mahandle | ||
) |
Add (or remove) a marker to the square at col, row.
chessboard | A CwChessboard. |
col | The column of the square. |
row | The row of the square. |
mahandle | A color handle as returned by cw_chessboard_allocate_color_handle_rgb or cw_chessboard_allocate_color_handle. A handle with a value of 0 means the default background color. |
Definition at line 1674 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::set_marker_color().
void cw_chessboard_set_marker_level | ( | CwChessboard* | chessboard, |
gboolean | below | ||
) |
Choose whether markers should be drawn below or above HUD layer 0.
Markers can be drawn directly below or directly above HUD layer 0.
chessboard | A CwChessboard. |
below | TRUE when markers should be drawn below HUD layer 0. |
Definition at line 1704 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::set_marker_level().
void cw_chessboard_set_marker_thickness | ( | CwChessboard* | chessboard, |
gdouble | thickness | ||
) |
Set the marker thickness. This is a value between 0 and 0.5.
chessboard | A CwChessboard. |
thickness | The thickness of the marker as fraction of sside. Range [0...0.5] |
Definition at line 1691 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::set_marker_thickness().
void cw_chessboard_set_square | ( | CwChessboard* | chessboard, |
gint | col, | ||
gint | row, | ||
CwChessboardCode | code | ||
) |
Change or remove the piece on the square (col, row), by replacing the contents of the square with code. This does not change any other attribute of the square, like it's background color or marker.
chessboard | A CwChessboard. |
col | A column [0..7] |
row | A row [0..7] |
code | A CwChessboardCode. |
Definition at line 1741 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::set_square().
void cw_chessboard_set_white_fill_color | ( | CwChessboard* | chessboard, |
GdkColor const* | color | ||
) |
Set the fill color of the white chess pieces. Default: white
chessboard | A CwChessboard. |
color | The new fill color of the white pieces. |
Definition at line 1892 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::set_white_fill_color().
void cw_chessboard_set_white_line_color | ( | CwChessboard* | chessboard, |
GdkColor const* | color | ||
) |
Set the line color of the white chess pieces. Default: black
chessboard | A CwChessboard. |
color | The new line color of the white pieces. |
Definition at line 1910 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::set_white_line_color().
void cw_chessboard_show_cursor | ( | CwChessboard* | chessboard | ) |
Show the cursor.
This high-lights the square under the mouse by drawing a square with a configurable thickness and color.
chessboard | A CwChessboard. |
Definition at line 1994 of file CwChessboard.cc.
Referenced by cwmm::ChessboardWidget::show_cursor().
CWCHESSBOARD_INLINE gint cw_chessboard_x2col | ( | CwChessboard* | chessboard, |
gdouble | x | ||
) |
Convert an x-coordinate to the column number that it matches. If the x coordinate falls outside the board, then the returned value will be outside the range [0, 7].
chessboard | A CwChessboard. |
x | An x coordinate, relative to the left-side of the widget. |
Referenced by cw_chessboard_move_floating_piece(), cw_chessboard_remove_floating_piece(), and cwmm::ChessboardWidget::x2col().
CWCHESSBOARD_INLINE gint cw_chessboard_y2row | ( | CwChessboard* | chessboard, |
gdouble | y | ||
) |
Convert a y-coordinate to the row number that it matches. If the y coordinate falls outside the board, then the returned value will be outside the range [0, 7].
chessboard | A CwChessboard. |
y | A y coordinate, relative to the top-side of the widget. |
Referenced by cw_chessboard_move_floating_piece(), cw_chessboard_remove_floating_piece(), and cwmm::ChessboardWidget::y2row().