31 #include <gtkmm/drawingarea.h> 71 static void S_draw_pawn_hook(
CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean
white);
72 static void S_draw_rook_hook(
CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white);
73 static void S_draw_knight_hook(
CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white);
74 static void S_draw_bishop_hook(
CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white);
75 static void S_draw_queen_hook(
CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white);
76 static void S_draw_king_hook(
CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white);
77 static void S_draw_hud_layer_hook(
CwChessboard* chessboard, cairo_t* cr, gint sside, guint hud);
78 static gboolean S_draw_hud_square_hook(
CwChessboard* chessboard, cairo_t* cr, gint col, gint row, gint sside, guint hud);
79 static void S_draw_border_hook(
CwChessboard* chessboard);
80 static void S_draw_turn_indicator_hook(
CwChessboard* chessboard, gboolean white, gboolean on);
81 static void S_on_cursor_left_chessboard_hook(
CwChessboard* chessboard, gint prev_col, gint prev_row);
82 static void S_on_cursor_entered_square_hook(
CwChessboard* chessboard, gint prev_col, gint prev_row, gint col, gint row);
92 virtual bool on_button_press_event(GdkEventButton* event) {
return Gtk::DrawingArea::on_button_press_event(event); }
106 { Dout(dc::notice,
"Calling on_cursor_left_chessboard(" << prev_col <<
", " << prev_row <<
")"); }
116 { Dout(dc::notice,
"Calling on_cursor_entered_square(" << prev_col <<
", " << prev_row <<
", " << col <<
", " << row <<
")"); }
127 virtual void draw_pawn(cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white)
134 virtual void draw_rook(cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white)
141 virtual void draw_knight(cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white)
148 virtual void draw_bishop(cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white)
155 virtual void draw_queen(cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white)
162 virtual void draw_king(cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white)
200 virtual gboolean
draw_hud_square(cairo_t* cr, gint col, gint row, gint sside, guint hud)
265 gint
sside(
void)
const {
return M_chessboard->sside; }
291 void colrow2xy(gint col, gint row, gint& x, gint& y)
const 326 {
return !((col | row) & ~0x7); }
442 CW_CHESSBOARD_GET_CLASS(M_chessboard)->calc_board_border_width = new_calc_board_border_width;
881 gpointer
add_arrow(gint begin_col, gint begin_row, gint end_col, gint end_row, GdkColor
const& color)
896 #endif // CHESSBOARD_H
void cw_chessboard_set_square(CwChessboard* chessboard, gint col, gint row, CwChessboardCode code)
void cw_chessboard_set_cursor_thickness(CwChessboard* chessboard, gdouble thickness)
void cw_chessboard_get_border_color(CwChessboard* chessboard, GdkColor* color)
uint16_t CwChessboardCode
A code to specify a chess piece.
gboolean cw_chessboard_get_active_turn_indicator(CwChessboard* chessboard)
void cw_chessboard_free_color_handle(CwChessboard* chessboard, CwChessboardColorHandle handle)
void cw_chessboard_draw_knight(CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble scale, gboolean white)
ColorData const white
A constant representing the color white.
CWCHESSBOARD_INLINE gint cw_chessboard_x2col(CwChessboard* chessboard, gdouble x)
void cw_chessboard_set_white_line_color(CwChessboard* chessboard, GdkColor const* color)
void cw_chessboard_draw_bishop(CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble scale, gboolean white)
void cw_chessboard_draw_pawn(CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble scale, gboolean white)
void cw_chessboard_set_background_colors(CwChessboard* chessboard, CwChessboardColorHandle const* handles)
CWCHESSBOARD_INLINE gint cw_chessboard_y2row(CwChessboard* chessboard, gdouble y)
gboolean cw_chessboard_get_draw_border(CwChessboard* chessboard)
void cw_chessboard_get_white_line_color(CwChessboard* chessboard, GdkColor* color)
void cw_chessboard_default_draw_turn_indicator(CwChessboard* chessboard, gboolean white, gboolean on)
This file contains the declaration of the GTK+ widget CwChessboard.
CwChessboardColorHandle cw_chessboard_allocate_color_handle_rgb(CwChessboard* chessboard, gdouble red, gdouble green, gdouble blue)
void cw_chessboard_draw_king(CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble scale, gboolean white)
A GTK+ chessboard widget.
CwChessboardCode cw_chessboard_get_floating_piece(CwChessboard* chessboard, gint handle)
void cw_chessboard_default_draw_hud_layer(CwChessboard* chessboard, cairo_t* cr, gint sside, guint hud)
void cw_chessboard_set_marker_level(CwChessboard* chessboard, gboolean below)
void cw_chessboard_set_marker_thickness(CwChessboard* chessboard, gdouble thickness)
void cw_chessboard_default_draw_border(CwChessboard* chessboard)
gboolean cw_chessboard_get_draw_turn_indicators(CwChessboard* chessboard)
CwChessboardCode cw_chessboard_get_square(CwChessboard* chessboard, gint col, gint row)
gdouble cw_chessboard_get_cursor_thickness(CwChessboard* chessboard)
void cw_chessboard_draw_queen(CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble scale, gboolean white)
void cw_chessboard_draw_rook(CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble scale, gboolean white)
void cw_chessboard_hide_cursor(CwChessboard* chessboard)
void cw_chessboard_set_flip_board(CwChessboard* chessboard, gboolean flip)
void cw_chessboard_get_black_line_color(CwChessboard* chessboard, GdkColor* color)
unsigned char CwChessboardColorHandle
A color handle used for background markers.
void cw_chessboard_get_cursor_color(CwChessboard* chessboard, GdkColor* color)
CWCHESSBOARD_INLINE void cw_chessboard_colrow2xy(CwChessboard* chessboard, gint col, gint row, gint* x, gint* y)
void cw_chessboard_disable_hud_layer(CwChessboard* chessboard, guint hud)
void cw_chessboard_set_draw_border(CwChessboard* chessboard, gboolean draw)
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_get_light_square_color(CwChessboard* chessboard, GdkColor* color)
CwChessboardColorHandle cw_chessboard_get_marker_color(CwChessboard* chessboard, gint col, gint row)
void cw_chessboard_set_black_line_color(CwChessboard* chessboard, GdkColor const* color)
void cw_chessboard_set_white_fill_color(CwChessboard* chessboard, GdkColor const* color)
A namespace for all gtkmm related objects.
gint cw_chessboard_add_floating_piece(CwChessboard* chessboard, CwChessboardCode code, gdouble x, gdouble y, gboolean pointer_device)
void cw_chessboard_get_dark_square_color(CwChessboard* chessboard, GdkColor* color)
void cw_chessboard_set_border_color(CwChessboard* chessboard, GdkColor const* color)
void cw_chessboard_set_draw_turn_indicators(CwChessboard* chessboard, gboolean draw)
void cw_chessboard_set_dark_square_color(CwChessboard* chessboard, GdkColor const* color)
void cw_chessboard_set_cursor_color(CwChessboard* chessboard, GdkColor const* color)
void cw_chessboard_set_black_fill_color(CwChessboard* chessboard, GdkColor const* color)
gboolean cw_chessboard_default_draw_hud_square(CwChessboard* chessboard, cairo_t* cr, gint col, gint row, gint sside, guint hud)
void cw_chessboard_get_white_fill_color(CwChessboard* chessboard, GdkColor* color)
void cw_chessboard_set_marker_color(CwChessboard* chessboard, gint col, gint row, CwChessboardColorHandle mahandle)
void cw_chessboard_move_floating_piece(CwChessboard* chessboard, gint handle, gdouble x, gdouble y)
GtkWidget * cw_chessboard_new(void)
void cw_chessboard_enable_hud_layer(CwChessboard* chessboard, guint hud)
void cw_chessboard_set_active_turn_indicator(CwChessboard* chessboard, gboolean white)
gboolean cw_chessboard_get_flip_board(CwChessboard* chessboard)
void cw_chessboard_show_cursor(CwChessboard* chessboard)
gdouble cw_chessboard_get_marker_thickness(CwChessboard* chessboard)
void cw_chessboard_remove_arrow(CwChessboard* chessboard, gpointer ptr)
CwChessboardColorHandle cw_chessboard_get_background_color(CwChessboard* chessboard, gint col, gint row)
void cw_chessboard_get_background_colors(CwChessboard* chessboard, CwChessboardColorHandle* handles)
void cw_chessboard_set_background_color(CwChessboard* chessboard, gint col, gint row, CwChessboardColorHandle bghandle)
CWCHESSBOARD_INLINE CwChessboardColorHandle cw_chessboard_allocate_color_handle(CwChessboard* chessboard, GdkColor const* color)
void cw_chessboard_set_light_square_color(CwChessboard* chessboard, GdkColor const* color)
void cw_chessboard_remove_floating_piece(CwChessboard* chessboard, gint handle)
void cw_chessboard_get_black_fill_color(CwChessboard* chessboard, GdkColor* color)