A gtkmm chessboard widget. More...
#include <ChessboardWidget.h>
Public Types | |
typedef CwChessboardColorHandle | ColorHandle |
A color handle used for background markers. More... | |
typedef CwChessboardCode | code_t |
A code to specify a chess piece. More... | |
Public Member Functions | |
Construction/Destruction | |
ChessboardWidget (void) | |
Create a ChessboardWidget object. | |
virtual | ~ChessboardWidget () |
Destructor. | |
Accessors | |
gint | sside (void) const |
The side of a square in pixels. | |
gint | top_left_a1_x (void) const |
The x coordinate of the top-left pixel of square a1. More... | |
gint | top_left_a1_y (void) const |
The y coordinate of the top-left pixel of square a1. More... | |
Chess Position | |
void | set_square (gint col, gint row, code_t code) |
Change the piece on a square. More... | |
code_t | get_square (gint col, gint row) const |
Get what is currently on a square. More... | |
Border | |
void | set_draw_border (gboolean draw) |
Set the boolean which determines whether or not the chessboard widget draws a border around the chessboard. More... | |
gboolean | get_draw_border (void) const |
Get the boolean that determines whether or not the chessboard widget draws a border around the chessboard. More... | |
void | set_draw_turn_indicators (gboolean draw) |
Set the boolean which determines whether or not to draw turn indicators. More... | |
gboolean | get_draw_turn_indicators (void) const |
Get the boolean which determines whether or not to draw turn indicators. More... | |
void | set_active_turn_indicator (gboolean white) |
Set the color of the active turn indicator. More... | |
gboolean | get_active_turn_indicator (void) const |
Get the boolean which determines whether whites or black turn indicator is active. More... | |
void | set_flip_board (gboolean flip) |
Set the boolean which determines whether white is playing bottom up or top down. More... | |
gboolean | get_flip_board (void) const |
Get the boolean which determines whether white is playing bottom up or top down. More... | |
void | set_calc_board_border_width (gint(*new_calc_board_border_width)(CwChessboard const* , gint)) |
Set the calc_board_border_width function. More... | |
Colors | |
void | set_dark_square_color (GdkColor const& color) |
Set the color of the dark squares. More... | |
void | set_light_square_color (GdkColor const& color) |
Set the color of the light squares. More... | |
void | set_border_color (GdkColor const& color) |
Set the color of the border around the chessboard. More... | |
void | set_white_fill_color (GdkColor const& color) |
Set the fill color of the white chess pieces. More... | |
void | set_white_line_color (GdkColor const& color) |
Set the line color of the white chess pieces. More... | |
void | set_black_fill_color (GdkColor const& color) |
Set the fill color of the black chess pieces. More... | |
void | set_black_line_color (GdkColor const& color) |
Set the line color of the black chess pieces. More... | |
void | get_dark_square_color (GdkColor& color) const |
Retrieve the current background color of the dark squares. More... | |
void | get_light_square_color (GdkColor& color) const |
Retrieve the current background color of the light squares. More... | |
void | get_border_color (GdkColor& color) const |
Retrieve the current color of the border around the chessboard. More... | |
void | get_white_fill_color (GdkColor& color) const |
Retrieve the current fill color of the white chess pieces. More... | |
void | get_white_line_color (GdkColor& color) const |
Retrieve the current line color of the white chess pieces. More... | |
void | get_black_fill_color (GdkColor& color) const |
Retrieve the current fill color of the black chess pieces. More... | |
void | get_black_line_color (GdkColor& color) const |
Retrieve the current line color of the black chess pieces. More... | |
ColorHandle | allocate_color_handle_rgb (gdouble red, gdouble green, gdouble blue) |
Allocate a new ColorHandle. More... | |
ColorHandle | allocate_color_handle (GdkColor const& color) |
Allocate a new CwChessboardColorHandle. More... | |
void | free_color_handle (ColorHandle handle) |
Free up the color handle handle, so it can be reused. More... | |
void | set_background_color (gint col, gint row, ColorHandle handle) |
Set the background color of the square at col, row. More... | |
ColorHandle | get_background_color (gint col, gint row) const |
Get the current background color handle. More... | |
void | set_background_colors (ColorHandle const* handles) |
Set new background colors of any number of squares. More... | |
void | get_background_colors (ColorHandle* handles) const |
Get all background colors handles. More... | |
Floating Pieces | |
gint | add_floating_piece (code_t code, gdouble x, gdouble y, gboolean pointer_device) |
Add a new floating chess piece. More... | |
void | move_floating_piece (gint handle, gdouble x, gdouble y) |
Move a floating chess piece to a new position. More... | |
void | remove_floating_piece (gint handle) |
Remove a floating piece. More... | |
code_t | get_floating_piece (gint handle) const |
Determine what piece a given floating piece is. More... | |
HUD Layers | |
void | enable_hud_layer (guint hud) |
Active a HUD layer. More... | |
void | disable_hud_layer (guint hud) |
Disable the HUD layer again. More... | |
Markers | |
void | set_marker_color (gint col, gint row, ColorHandle mahandle) |
Change the color of the marker. More... | |
ColorHandle | get_marker_color (gint col, gint row) const |
Get marker color. More... | |
void | set_marker_thickness (gdouble thickness) |
Set the marker thickness. More... | |
gdouble | get_marker_thickness (void) const |
Get the current marker thickness as fraction of sside. More... | |
void | set_marker_level (gboolean below) |
Choose whether markers should be drawn below or above HUD layer 0. More... | |
Cursor | |
void | show_cursor (void) |
Show the cursor. More... | |
void | hide_cursor (void) |
Hide the cursor. More... | |
void | set_cursor_thickness (gdouble thickness) |
Set the thickness of the cursor. More... | |
gdouble | get_cursor_thickness (void) const |
Get the current cursor thickness as fraction of sside. More... | |
void | set_cursor_color (GdkColor const& color) |
Set the color of the cursor. More... | |
void | get_cursor_color (GdkColor& color) const |
Get the current cursor color. More... | |
Arrows | |
gpointer | add_arrow (gint begin_col, gint begin_row, gint end_col, gint end_row, GdkColor const& color) |
Draw an arrow on the board. More... | |
void | remove_arrow (gpointer ptr) |
Remove a previously added arrow. More... | |
Protected Member Functions | |
Events | |
virtual bool | on_button_press_event (GdkEventButton* event) |
Called when the mouse button is pressed while on the chessboard widget. More... | |
virtual bool | on_button_release_event (GdkEventButton* event) |
Called when the mouse button is released again. More... | |
virtual void | on_cursor_left_chessboard (gint prev_col, gint prev_row) |
Called when the mouse pointer left the chessboard. More... | |
virtual void | on_cursor_entered_square (gint prev_col, gint prev_row, gint col, gint row) |
Called when the mouse pointer entered a new square. More... | |
Drawing primitives | |
virtual void | draw_pawn (cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white) |
Called to draw a pawn. More... | |
virtual void | draw_rook (cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white) |
Called to draw a rook. More... | |
virtual void | draw_knight (cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white) |
Called to draw a knight. More... | |
virtual void | draw_bishop (cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white) |
Called to draw a bishop. More... | |
virtual void | draw_queen (cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white) |
Called to draw a queen. More... | |
virtual void | draw_king (cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white) |
Called to draw a king. More... | |
virtual void | draw_hud_layer (cairo_t* cr, gint sside, guint hud) |
Draw the HUD layer. More... | |
virtual gboolean | draw_hud_square (cairo_t* cr, gint col, gint row, gint sside, guint hud) |
Draw a single HUD square at col, row. More... | |
virtual void | draw_border (void) |
Draw the border around the chessboard. More... | |
virtual void | draw_turn_indicator (gboolean white, gboolean on) |
Draw the indicator that indicates whose turn it is. More... | |
Public Conversion Functions | |
void | colrow2xy (gint col, gint row, gint& x, gint& y) const |
Convert a (col, row) pair to the top-left coordinates of the corresponding square, relative to the top-left of the widget. More... | |
gint | x2col (gdouble x) const |
Convert an x-coordinate to the column number that it matches. More... | |
gint | y2row (gdouble y) const |
Convert a y-coordinate to the row number that it matches. More... | |
static gboolean | is_inside_board (gint col, gint row) |
Test if a given column and row are on the chessboard. More... | |
Additional Inherited Members | |
Protected Attributes inherited from cwmm::CwChessboardPtr | |
CwChessboard* | M_chessboard |
A gtkmm chessboard widget.
This is a chessboard widget for use with gtkmm.
A detailed overview can be found on the Main Page.
Definition at line 58 of file ChessboardWidget.h.
A code to specify a chess piece.
One of the following constants: empty_square, black_pawn, white_pawn, black_rook, white_rook, black_knight, white_knight, black_bishop, white_bishop, black_queen, white_queen, black_king or white_king.
Definition at line 259 of file ChessboardWidget.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 248 of file ChessboardWidget.h.
|
inline |
Draw an arrow on the board.
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 881 of file ChessboardWidget.h.
References cw_chessboard_add_arrow().
Referenced by MyChessboardWidget::on_button_release(), and cwmm::ChessPositionWidget::place().
|
inline |
Add a new floating chess piece.
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.
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 686 of file ChessboardWidget.h.
References cw_chessboard_add_floating_piece().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Allocate a new CwChessboardColorHandle.
From more information, see allocate_color_handle_rgb.
color | : The color to allocate. |
Definition at line 603 of file ChessboardWidget.h.
References cw_chessboard_allocate_color_handle().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Allocate a new ColorHandle.
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.
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 590 of file ChessboardWidget.h.
References cw_chessboard_allocate_color_handle_rgb().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Convert a (col, row) pair to the top-left coordinates of the corresponding square, relative to the top-left of the widget.
col | : A column, in the range [0, 7]. |
row | : A row, in the range [0, 7]. |
x | : A reference to where the x-coordinate of the result will be written to. |
y | : A reference to where the y-coordinate of the result will be written to. |
Definition at line 291 of file ChessboardWidget.h.
References cw_chessboard_colrow2xy().
Referenced by cwmm::ChessPositionWidget::ChessPositionWidget().
|
inline |
Disable the HUD layer again.
Used resources are returned to the system.
hud | : The HUD layer (0 or 1). |
Definition at line 750 of file ChessboardWidget.h.
References cw_chessboard_disable_hud_layer().
Referenced by cwmm::ChessPositionWidget::place().
|
inlineprotectedvirtual |
Called to draw a bishop.
The default calls cw_chessboard_draw_bishop.
Definition at line 148 of file ChessboardWidget.h.
References cw_chessboard_draw_bishop().
|
inlineprotectedvirtual |
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 CwChessboardClass::calc_board_border_width.
The default calls cw_chessboard_default_draw_border.
Definition at line 212 of file ChessboardWidget.h.
References cw_chessboard_default_draw_border().
|
inlineprotectedvirtual |
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.
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. |
The default calls cw_chessboard_default_draw_hud_layer.
Reimplemented in MyChessboardWidget.
Definition at line 182 of file ChessboardWidget.h.
References cw_chessboard_default_draw_hud_layer().
|
inlineprotectedvirtual |
Draw a single HUD square at col, row.
This function is called by ChessboardWidget::draw_hud_layer for each square. You can use it if you don't override draw_hud_layer.
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. |
The default calls cw_chessboard_default_draw_hud_square.
Definition at line 200 of file ChessboardWidget.h.
References cw_chessboard_default_draw_hud_square().
|
inlineprotectedvirtual |
Called to draw a king.
The default calls cw_chessboard_draw_king.
Definition at line 162 of file ChessboardWidget.h.
References cw_chessboard_draw_king().
|
inlineprotectedvirtual |
Called to draw a knight.
The default calls cw_chessboard_draw_knight.
Definition at line 141 of file ChessboardWidget.h.
References cw_chessboard_draw_knight().
|
inlineprotectedvirtual |
Called to draw a pawn.
The default calls cw_chessboard_draw_pawn.
Definition at line 127 of file ChessboardWidget.h.
References cw_chessboard_draw_pawn().
|
inlineprotectedvirtual |
Called to draw a queen.
The default calls cw_chessboard_draw_queen.
Definition at line 155 of file ChessboardWidget.h.
References cw_chessboard_draw_queen().
|
inlineprotectedvirtual |
Called to draw a rook.
The default calls cw_chessboard_draw_rook.
Definition at line 134 of file ChessboardWidget.h.
References cw_chessboard_draw_rook().
|
inlineprotectedvirtual |
Draw the indicator that indicates whose turn it is.
This function is called every time the border is redrawn, as well as every time set_draw_turn_indicators is called.
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. |
The default calls cw_chessboard_default_draw_turn_indicator.
Definition at line 227 of file ChessboardWidget.h.
References cw_chessboard_default_draw_turn_indicator().
|
inline |
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.
hud | : The HUD layer (0 or 1). |
Definition at line 739 of file ChessboardWidget.h.
References cw_chessboard_enable_hud_layer().
Referenced by MyChessboardWidget::on_button_press(), and cwmm::ChessPositionWidget::place().
|
inline |
Free up the color handle handle, so it can be reused.
handle | : A color handle as returned by allocate_color_handle_rgb or allocate_color_handle. |
Definition at line 612 of file ChessboardWidget.h.
References cw_chessboard_free_color_handle().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Get the boolean which determines whether whites or black turn indicator is active.
Definition at line 413 of file ChessboardWidget.h.
References cw_chessboard_get_active_turn_indicator().
Referenced by cwmm::ChessPositionWidget::ChessPositionWidget().
|
inline |
Get the current background color handle.
Convenience function.
col | : The column of the square. |
row | : The row of the square. |
Definition at line 637 of file ChessboardWidget.h.
References cw_chessboard_get_background_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Get all background colors handles.
Fill the array handles with the current color handles.
handles | : The output array. Should be an array of 64 ColorHandles. |
Definition at line 654 of file ChessboardWidget.h.
References cw_chessboard_get_background_colors().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Retrieve the current fill color of the black chess pieces.
color | : Pointer to the output variable. |
Definition at line 565 of file ChessboardWidget.h.
References cw_chessboard_get_black_fill_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Retrieve the current line color of the black chess pieces.
color | : Pointer to the output variable. |
Definition at line 574 of file ChessboardWidget.h.
References cw_chessboard_get_black_line_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Retrieve the current color of the border around the chessboard.
color | : Pointer to the output variable. |
Definition at line 538 of file ChessboardWidget.h.
References cw_chessboard_get_border_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Get the current cursor color.
color | : Pointer to the output variable. |
Definition at line 861 of file ChessboardWidget.h.
References cw_chessboard_get_cursor_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Get the current cursor thickness as fraction of sside.
Definition at line 847 of file ChessboardWidget.h.
References cw_chessboard_get_cursor_thickness().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Retrieve the current background color of the dark squares.
color | : Pointer to the output variable. |
Definition at line 520 of file ChessboardWidget.h.
References cw_chessboard_get_dark_square_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Get the boolean that determines whether or not the chessboard widget draws a border around the chessboard.
TRUE
if the border is being drawn.Definition at line 376 of file ChessboardWidget.h.
References cw_chessboard_get_draw_border().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Get the boolean which determines whether or not to draw turn indicators.
Definition at line 395 of file ChessboardWidget.h.
References cw_chessboard_get_draw_turn_indicators().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Get the boolean which determines whether white is playing bottom up or top down.
Definition at line 429 of file ChessboardWidget.h.
References cw_chessboard_get_flip_board().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Determine what piece a given floating piece is.
Get the code_t of the floating piece represented by handle. handle must be a handle as returned by add_floating_piece.
handle | : The floating piece handle. |
Definition at line 721 of file ChessboardWidget.h.
References cw_chessboard_get_floating_piece().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Retrieve the current background color of the light squares.
color | : Pointer to the output variable. |
Definition at line 529 of file ChessboardWidget.h.
References cw_chessboard_get_light_square_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Get marker color.
Convenience function.
col | : The column of the square. |
row | : The row of the square. |
Definition at line 780 of file ChessboardWidget.h.
References cw_chessboard_get_marker_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Get the current marker thickness as fraction of sside.
Definition at line 798 of file ChessboardWidget.h.
References cw_chessboard_get_marker_thickness().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Get what is currently on a square.
Get the chess piece code for the square at (col, row).
Definition at line 351 of file ChessboardWidget.h.
References cw_chessboard_get_square().
Referenced by cwmm::ChessPositionWidget::ChessPositionWidget().
|
inline |
Retrieve the current fill color of the white chess pieces.
color | : Pointer to the output variable. |
Definition at line 547 of file ChessboardWidget.h.
References cw_chessboard_get_white_fill_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Retrieve the current line color of the white chess pieces.
color | : Pointer to the output variable. |
Definition at line 556 of file ChessboardWidget.h.
References cw_chessboard_get_white_line_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Hide the cursor.
Definition at line 829 of file ChessboardWidget.h.
References cw_chessboard_hide_cursor().
Referenced by MyChessboardWidget::on_button_release(), and cwmm::ChessPositionWidget::place().
|
inlinestatic |
Test if a given column and row are on the chessboard.
col | : A column, in the range [0, 7]. |
row | : A row, in the range [0, 7]. |
Definition at line 325 of file ChessboardWidget.h.
Referenced by cwmm::ChessPositionWidget::ChessPositionWidget(), and MyChessboardWidget::on_button_release().
|
inline |
Move a floating chess piece to a new position.
Move a floating piece with handle handle to the new widget coordinates at (x, y). handle must be a handle as returned by add_floating_piece.
handle | : The floating piece handle. |
x | : The new x coordinate. |
y | : The new y coordinate. |
Definition at line 701 of file ChessboardWidget.h.
References cw_chessboard_move_floating_piece().
Referenced by cwmm::ChessPositionWidget::place().
|
inlineprotectedvirtual |
Called when the mouse button is pressed while on the chessboard widget.
This function should be overridden. See the example tstcpp.cc in the source code for an example.
Definition at line 92 of file ChessboardWidget.h.
Referenced by ChessboardWidget().
|
inlineprotectedvirtual |
Called when the mouse button is released again.
This function should be overridden. See the example tstcpp.cc in the source code for an example.
Definition at line 98 of file ChessboardWidget.h.
Referenced by ChessboardWidget().
|
inlineprotectedvirtual |
Called when the mouse pointer entered a new square.
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. |
Reimplemented in cwmm::ChessPositionWidget.
Definition at line 115 of file ChessboardWidget.h.
|
inlineprotectedvirtual |
Called when the mouse pointer left the chessboard.
prev_col | : The column of the last square. |
prev_row | : The row of the last square. |
Reimplemented in cwmm::ChessPositionWidget.
Definition at line 105 of file ChessboardWidget.h.
|
inline |
Remove a previously added arrow.
ptr | : The arrow handle as returned by add_arrow. |
Definition at line 888 of file ChessboardWidget.h.
References cw_chessboard_remove_arrow().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Remove a floating piece.
Delete the floating piece with handle handle. handle must be a handle as returned by add_floating_piece.
handle | : The floating piece handle. |
Definition at line 711 of file ChessboardWidget.h.
References cw_chessboard_remove_floating_piece().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Set the color of the active turn indicator.
Default: TRUE
white | TRUE if whites turn indicator should be active. |
Definition at line 406 of file ChessboardWidget.h.
References cw_chessboard_set_active_turn_indicator().
Referenced by cwmm::ChessPositionWidget::ChessPositionWidget(), cwmm::ChessPositionWidget::set_en_passant(), cwmm::ChessPositionWidget::skip_move(), and cwmm::ChessPositionWidget::to_move().
|
inline |
Set the background color of the square at col, row.
col | : The column of the square. |
row | : The row of the square. |
handle | : A color handle as returned by allocate_color_handle_rgb or allocate_color_handle. A handle with a value of 0 means the default background color. |
Definition at line 623 of file ChessboardWidget.h.
References cw_chessboard_set_background_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Set new background colors of any number of squares.
handles | : Array of 64 ColorHandles. A handle with a value of 0 means the default background color. |
Definition at line 645 of file ChessboardWidget.h.
References cw_chessboard_set_background_colors().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Set the fill color of the black chess pieces.
Default: black
color | : The new fill color of the black pieces. |
Definition at line 502 of file ChessboardWidget.h.
References cw_chessboard_set_black_fill_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Set the line color of the black chess pieces.
Default: white
color | : The new line color of the black pieces. |
Definition at line 511 of file ChessboardWidget.h.
References cw_chessboard_set_black_line_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Set the color of the border around the chessboard.
color | : The new color of the border. |
Definition at line 475 of file ChessboardWidget.h.
References cw_chessboard_set_border_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Set the calc_board_border_width function.
Change the function that calculates the border width as function of the size of the squares.
new_calc_board_border_width | : The new function. |
Definition at line 440 of file ChessboardWidget.h.
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Set the color of the cursor.
color | : The color to be used for the cursor. |
Definition at line 854 of file ChessboardWidget.h.
References cw_chessboard_set_cursor_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Set the thickness of the cursor.
This is a value between 0 and 0.5.
thickness | : The thickness of the cursor as fraction of sside. Range [0...0.5] |
Definition at line 840 of file ChessboardWidget.h.
References cw_chessboard_set_cursor_thickness().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Set the color of the dark squares.
Set the background color of the dark squares (a1, c1 etc). Default: light green.
color | : The new color of the dark squares. |
Definition at line 456 of file ChessboardWidget.h.
References cw_chessboard_set_dark_square_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Set the boolean which determines whether or not the chessboard widget draws a border around the chessboard.
Default: TRUE (draw border).
draw | : Boolean, determining if the border should be drawn. |
Definition at line 367 of file ChessboardWidget.h.
References cw_chessboard_set_draw_border().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
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).
draw | Boolean, determining if the indicators should be drawn. |
Definition at line 388 of file ChessboardWidget.h.
References cw_chessboard_set_draw_turn_indicators().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Set the boolean which determines whether white is playing bottom up or top down.
Default: FALSE (white plays upwards).
flip | Boolean, determining if white plays upwards or not. |
Definition at line 422 of file ChessboardWidget.h.
References cw_chessboard_set_flip_board().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Set the color of the light squares.
Set the background color of the light squares (b1, d1 etc). Default: yellow/white.
color | : The new color of the light squares. |
Definition at line 466 of file ChessboardWidget.h.
References cw_chessboard_set_light_square_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Change the color of the marker.
Add a marker to, or remove a marker from the square at col, row.
col | : The column of the square. |
row | : The row of the square. |
mahandle | : A color handle as returned by allocate_color_handle_rgb or allocate_color_handle. A handle with a value of 0 removes the marker (if any was there). |
Definition at line 767 of file ChessboardWidget.h.
References cw_chessboard_set_marker_color().
Referenced by MyChessboardWidget::on_button_press(), MyChessboardWidget::on_button_release(), and cwmm::ChessPositionWidget::place().
|
inline |
Choose whether markers should be drawn below or above HUD layer 0.
Markers can be drawn directly below or directly above HUD layer 0.
below | : TRUE when markers should be drawn below HUD layer 0. |
Definition at line 807 of file ChessboardWidget.h.
References cw_chessboard_set_marker_level().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Set the marker thickness.
This is a value between 0 and 0.5.
thickness | : The thickness of the marker as fraction of sside. Range [0...0.5] |
Definition at line 791 of file ChessboardWidget.h.
References cw_chessboard_set_marker_thickness().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Change the piece on a square.
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.
col | : A column [0..7] |
row | : A row [0..7] |
code | : A code_t. |
Definition at line 344 of file ChessboardWidget.h.
References cw_chessboard_set_square().
Referenced by cwmm::ChessPositionWidget::ChessPositionWidget(), and cwmm::ChessPositionWidget::place().
|
inline |
Set the fill color of the white chess pieces.
Default: white
color | : The new fill color of the white pieces. |
Definition at line 484 of file ChessboardWidget.h.
References cw_chessboard_set_white_fill_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Set the line color of the white chess pieces.
Default: black
color | : The new line color of the white pieces. |
Definition at line 493 of file ChessboardWidget.h.
References cw_chessboard_set_white_line_color().
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
Show the cursor.
This high-lights the square under the mouse by drawing a square with a configurable thickness and color.
Definition at line 822 of file ChessboardWidget.h.
References cw_chessboard_show_cursor().
Referenced by MyChessboardWidget::on_button_press(), MyChessboardWidget::on_button_release(), and cwmm::ChessPositionWidget::place().
|
inline |
The x coordinate of the top-left pixel of square a1.
If the board is flipped, then the x coordinate of the top-left pixel of square h8 is returned. In other words, this value is not depending on whether or not the board is flipped.
Definition at line 271 of file ChessboardWidget.h.
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
The y coordinate of the top-left pixel of square a1.
If the board is flipped, then the y coordinate of the top-left pixel of square h8 is returned. In other words, this value is not depending on whether or not the board is flipped.
Definition at line 277 of file ChessboardWidget.h.
Referenced by cwmm::ChessPositionWidget::place().
|
inline |
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].
x | : An x coordinate, relative to the left-side of the widget. |
Definition at line 303 of file ChessboardWidget.h.
References cw_chessboard_x2col().
Referenced by cwmm::ChessPositionWidget::ChessPositionWidget().
|
inline |
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].
y | : A y coordinate, relative to the top-side of the widget. |
Definition at line 315 of file ChessboardWidget.h.
References cw_chessboard_y2row().
Referenced by cwmm::ChessPositionWidget::ChessPositionWidget().