27 #ifndef CWCHESSBOARD_H 28 #define CWCHESSBOARD_H 32 #include <gtk/gtkdrawingarea.h> 35 #define CWCHESSBOARD_INLINE inline 36 #define CWCHESSBOARD_DEFINE_INLINE 1 38 #define CWCHESSBOARD_INLINE 39 #ifndef CWCHESSBOARD_DEFINE_INLINE 40 #define CWCHESSBOARD_DEFINE_INLINE 0 53 GType cw_chessboard_get_type(
void) G_GNUC_CONST;
55 #define CW_TYPE_CHESSBOARD (cw_chessboard_get_type()) 56 #define CW_CHESSBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CW_TYPE_CHESSBOARD, CwChessboard)) 57 #define CW_CHESSBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CW_TYPE_CHESSBOARD, CwChessboardClass)) 58 #define CW_IS_CHESSBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CW_TYPE_CHESSBOARD)) 59 #define CW_IS_CHESSBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CW_TYPE_CHESSBOARD)) 60 #define CW_CHESSBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CW_TYPE_CHESSBOARD, CwChessboardClass)) 106 GtkDrawingArea parent;
127 struct _CwChessboardClass
130 GtkDrawingAreaClass parent_class;
239 gboolean (*draw_hud_square)(
CwChessboard* chessboard, cairo_t* cr, gint col, gint row, gint
sside, guint hud);
253 void (*cursor_left_chessboard)(
CwChessboard* chessboard, gint prev_col, gint prev_row);
269 void (*cursor_entered_square)(
CwChessboard* chessboard, gint prev_col, gint prev_row, gint col, gint row);
287 #if CWCHESSBOARD_DEFINE_INLINE 308 #if CWCHESSBOARD_DEFINE_INLINE 311 return (chessboard->
flip_board ? 7 - xcol : xcol);
329 #if CWCHESSBOARD_DEFINE_INLINE 332 return (chessboard->
flip_board ? 7 - yrow : yrow);
619 gdouble red, gdouble green, gdouble blue);
634 #if CWCHESSBOARD_DEFINE_INLINE 637 color->green / 65535.0, color->blue / 65535.0);
873 cairo_t* cr, gint col, gint row, gint sside, guint hud);
935 gint col, gint row, CwChessboardColorHandle mahandle);
1059 gint begin_col, gint begin_row, gint end_col, gint end_row, GdkColor
const* color);
1073 #endif // CWCHESSBOARD_H void cw_chessboard_enable_hud_layer(CwChessboard* chessboard, guint hud)
void cw_chessboard_move_floating_piece(CwChessboard* chessboard, gint handle, gdouble x, gdouble y)
gboolean cw_chessboard_get_active_turn_indicator(CwChessboard* chessboard)
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 sside, gboolean white)
void cw_chessboard_default_draw_turn_indicator(CwChessboard* chessboard, gboolean white, gboolean on)
void cw_chessboard_draw_rook(CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white)
gint const sside
Square side in pixels (read only).
uint16_t CwChessboardCode
A code to specify a chess piece.
void cw_chessboard_set_cursor_color(CwChessboard* chessboard, GdkColor const* color)
void cw_chessboard_remove_floating_piece(CwChessboard* chessboard, gint handle)
CwChessboardColorHandle cw_chessboard_get_background_color(CwChessboard* chessboard, gint col, gint row)
void cw_chessboard_set_marker_level(CwChessboard* chessboard, gboolean below)
ColorData const white
A constant representing the color white.
CWCHESSBOARD_INLINE gint cw_chessboard_x2col(CwChessboard* chessboard, gdouble x)
void cw_chessboard_draw_queen(CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white)
void cw_chessboard_set_flip_board(CwChessboard* chessboard, gboolean flip)
void cw_chessboard_remove_arrow(CwChessboard* chessboard, gpointer ptr)
void cw_chessboard_get_cursor_color(CwChessboard* chessboard, GdkColor* color)
void cw_chessboard_default_draw_hud_layer(CwChessboard* chessboard, cairo_t* cr, gint sside, guint hud)
void cw_chessboard_default_draw_border(CwChessboard* chessboard)
void cw_chessboard_set_black_fill_color(CwChessboard* chessboard, GdkColor const* color)
CWCHESSBOARD_INLINE gint cw_chessboard_y2row(CwChessboard* chessboard, gdouble y)
void cw_chessboard_set_background_color(CwChessboard* chessboard, gint col, gint row, CwChessboardColorHandle handle)
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_set_black_line_color(CwChessboard* chessboard, GdkColor const* color)
GtkWidget * cw_chessboard_new(void)
void cw_chessboard_get_dark_square_color(CwChessboard* chessboard, GdkColor* color)
void cw_chessboard_set_draw_border(CwChessboard* chessboard, gboolean draw)
void cw_chessboard_disable_hud_layer(CwChessboard* chessboard, guint hud)
A GTK+ chessboard widget.
void cw_chessboard_get_background_colors(CwChessboard* chessboard, CwChessboardColorHandle* handles)
void cw_chessboard_set_border_color(CwChessboard* chessboard, GdkColor const* color)
CwChessboardCode cw_chessboard_get_floating_piece(CwChessboard* chessboard, gint handle)
void cw_chessboard_get_white_fill_color(CwChessboard* chessboard, GdkColor* color)
gdouble cw_chessboard_get_cursor_thickness(CwChessboard* chessboard)
unsigned char CwChessboardColorHandle
A color handle used for background markers.
CWCHESSBOARD_INLINE void cw_chessboard_colrow2xy(CwChessboard* chessboard, gint col, gint row, gint* x, gint* y)
The Class structure of CwChessboard.
void cw_chessboard_get_black_line_color(CwChessboard* chessboard, GdkColor* color)
gint cw_chessboard_default_calc_board_border_width(CwChessboard const* chessboard, gint sside)
gint const top_left_a1_y
The y coordinate of the top-left pixel of square a1 (read-only). Despite the name, if the board is flipped then it's square h8.
void cw_chessboard_set_active_turn_indicator(CwChessboard* chessboard, gboolean white)
void cw_chessboard_draw_pawn(CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white)
gint cw_chessboard_add_floating_piece(CwChessboard* chessboard, CwChessboardCode code, gdouble x, gdouble y, gboolean pointer_device)
void cw_chessboard_set_draw_turn_indicators(CwChessboard* chessboard, gboolean draw)
void cw_chessboard_show_cursor(CwChessboard* chessboard)
gboolean cw_chessboard_get_flip_board(CwChessboard* chessboard)
void cw_chessboard_set_light_square_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_set_marker_thickness(CwChessboard* chessboard, gdouble thickness)
void cw_chessboard_set_background_colors(CwChessboard* chessboard, CwChessboardColorHandle const* handles)
void cw_chessboard_set_dark_square_color(CwChessboard* chessboard, GdkColor const* color)
void cw_chessboard_set_marker_color(CwChessboard* chessboard, gint col, gint row, CwChessboardColorHandle mahandle)
void cw_chessboard_get_border_color(CwChessboard* chessboard, GdkColor* color)
void cw_chessboard_draw_knight(CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white)
void cw_chessboard_get_black_fill_color(CwChessboard* chessboard, GdkColor* color)
CwChessboardColorHandle cw_chessboard_allocate_color_handle_rgb(CwChessboard* chessboard, gdouble red, gdouble green, gdouble blue)
void cw_chessboard_set_square(CwChessboard* chessboard, gint col, gint row, CwChessboardCode code)
void cw_chessboard_set_cursor_thickness(CwChessboard* chessboard, gdouble thickness)
gboolean cw_chessboard_get_draw_turn_indicators(CwChessboard* chessboard)
This file contains the definitions of the CwChessboardCode constants.
gint const top_left_a1_x
The x coordinate of the top-left pixel of square a1 (read-only). Despite the name, if the board is flipped then it's square h8.
CwChessboardCode cw_chessboard_get_square(CwChessboard* chessboard, gint col, gint row)
void cw_chessboard_draw_king(CwChessboard* chessboard, cairo_t* cr, gdouble x, gdouble y, gdouble sside, gboolean white)
void cw_chessboard_get_white_line_color(CwChessboard* chessboard, GdkColor* color)
gboolean const flip_board
TRUE if the board is flipped (read-only).
void cw_chessboard_get_light_square_color(CwChessboard* chessboard, GdkColor* color)
CwChessboardColorHandle cw_chessboard_get_marker_color(CwChessboard* chessboard, gint col, gint row)
CWCHESSBOARD_INLINE CwChessboardColorHandle cw_chessboard_allocate_color_handle(CwChessboard* chessboard, GdkColor const* color)
void cw_chessboard_set_white_fill_color(CwChessboard* chessboard, GdkColor const* color)
void cw_chessboard_free_color_handle(CwChessboard* chessboard, CwChessboardColorHandle handle)
gdouble cw_chessboard_get_marker_thickness(CwChessboard* chessboard)
gboolean cw_chessboard_get_draw_border(CwChessboard* chessboard)
void cw_chessboard_hide_cursor(CwChessboard* chessboard)