// ============================================================
// vqt6/_bridge_gui.h — QtGui C 桥接函数声明
// ============================================================

#ifndef VQT6_BRIDGE_GUI_H
#define VQT6_BRIDGE_GUI_H

#include "_bridge.h"

#ifdef __cplusplus
extern "C" {
#endif

// ============================================================
// QColor
// ============================================================
VQT6_API void* vqt6_qcolor_create_rgb(int r, int g, int b);
VQT6_API void* vqt6_qcolor_create_rgba(int r, int g, int b, int a);
VQT6_API void* vqt6_qcolor_create_name(void* name);
VQT6_API void* vqt6_qcolor_create_hex(void* hex_str);
VQT6_API int   vqt6_qcolor_red(void* c);
VQT6_API int   vqt6_qcolor_green(void* c);
VQT6_API int   vqt6_qcolor_blue(void* c);
VQT6_API int   vqt6_qcolor_alpha(void* c);
VQT6_API void  vqt6_qcolor_set_red(void* c, int r);
VQT6_API void  vqt6_qcolor_set_green(void* c, int g);
VQT6_API void  vqt6_qcolor_set_blue(void* c, int b);
VQT6_API void  vqt6_qcolor_set_alpha(void* c, int a);
VQT6_API void  vqt6_qcolor_set_rgb(void* c, int r, int g, int b);
VQT6_API void  vqt6_qcolor_set_rgba(void* c, int r, int g, int b, int a);
VQT6_API void* vqt6_qcolor_name(void* c);
VQT6_API int   vqt6_qcolor_is_valid(void* c);
VQT6_API void  vqt6_qcolor_free(void* c);

// ============================================================
// QFont
// ============================================================
VQT6_API void* vqt6_qfont_create(void);
VQT6_API void* vqt6_qfont_create_with_family(void* family);
VQT6_API void* vqt6_qfont_create_with_family_size(void* family, int point_size);
VQT6_API void  vqt6_qfont_set_family(void* font, void* family);
VQT6_API void* vqt6_qfont_family(void* font);
VQT6_API void  vqt6_qfont_set_point_size(void* font, int point_size);
VQT6_API int   vqt6_qfont_point_size(void* font);
VQT6_API void  vqt6_qfont_set_pixel_size(void* font, int pixel_size);
VQT6_API int   vqt6_qfont_pixel_size(void* font);
VQT6_API void  vqt6_qfont_set_bold(void* font, int bold);
VQT6_API int   vqt6_qfont_bold(void* font);
VQT6_API void  vqt6_qfont_set_italic(void* font, int italic);
VQT6_API int   vqt6_qfont_italic(void* font);
VQT6_API void  vqt6_qfont_set_underline(void* font, int underline);
VQT6_API int   vqt6_qfont_underline(void* font);
VQT6_API void  vqt6_qfont_set_strike_out(void* font, int strike_out);
VQT6_API int   vqt6_qfont_strike_out(void* font);
VQT6_API void  vqt6_qfont_set_weight(void* font, int weight);
VQT6_API int   vqt6_qfont_weight(void* font);
VQT6_API void  vqt6_qfont_free(void* font);

// ============================================================
// QFontMetrics
// ============================================================
VQT6_API void* vqt6_qfontmetrics_create(void* font);
VQT6_API int   vqt6_qfontmetrics_width(void* fm, void* text);
VQT6_API int   vqt6_qfontmetrics_height(void* fm);
VQT6_API int   vqt6_qfontmetrics_ascent(void* fm);
VQT6_API int   vqt6_qfontmetrics_descent(void* fm);
VQT6_API void  vqt6_qfontmetrics_free(void* fm);

// ============================================================
// QPixmap
// ============================================================
VQT6_API void* vqt6_qpixmap_create(void);
VQT6_API void* vqt6_qpixmap_create_with_size(int w, int h);
VQT6_API int   vqt6_qpixmap_load(void* pm, void* file_name);
VQT6_API int   vqt6_qpixmap_load_from_data(void* pm, const void* data, size_t size);
VQT6_API int   vqt6_qpixmap_save(void* pm, void* file_name);
VQT6_API int   vqt6_qpixmap_width(void* pm);
VQT6_API int   vqt6_qpixmap_height(void* pm);
VQT6_API int   vqt6_qpixmap_is_null(void* pm);
VQT6_API void* vqt6_qpixmap_scaled(void* pm, int w, int h);
VQT6_API void  vqt6_qpixmap_fill(void* pm, void* color);
VQT6_API void  vqt6_qpixmap_free(void* pm);

// ============================================================
// QImage
// ============================================================
VQT6_API void* vqt6_qimage_create(void);
VQT6_API void* vqt6_qimage_create_with_size(int w, int h, int format);
VQT6_API int   vqt6_qimage_load(void* img, void* file_name);
VQT6_API int   vqt6_qimage_save(void* img, void* file_name);
VQT6_API int   vqt6_qimage_width(void* img);
VQT6_API int   vqt6_qimage_height(void* img);
VQT6_API int   vqt6_qimage_format(void* img);
VQT6_API int   vqt6_qimage_is_null(void* img);
VQT6_API void  vqt6_qimage_fill(void* img, void* color);
VQT6_API void* vqt6_qimage_scaled(void* img, int w, int h);
VQT6_API void  vqt6_qimage_free(void* img);

// ============================================================
// QPainter
// ============================================================
VQT6_API void* vqt6_qpainter_create(void);
VQT6_API int   vqt6_qpainter_begin(void* p, void* device);
VQT6_API int   vqt6_qpainter_end(void* p);
VQT6_API int   vqt6_qpainter_is_active(void* p);
VQT6_API void  vqt6_qpainter_set_pen(void* p, void* pen);
VQT6_API void  vqt6_qpainter_set_brush(void* p, void* brush);
VQT6_API void  vqt6_qpainter_set_font(void* p, void* font);
VQT6_API void* vqt6_qpainter_pen(void* p);
VQT6_API void* vqt6_qpainter_brush(void* p);
VQT6_API void* vqt6_qpainter_font(void* p);
VQT6_API void  vqt6_qpainter_set_opacity(void* p, double opacity);
VQT6_API double vqt6_qpainter_opacity(void* p);
VQT6_API void  vqt6_qpainter_draw_line(void* p, int x1, int y1, int x2, int y2);
VQT6_API void  vqt6_qpainter_draw_rect(void* p, int x, int y, int w, int h);
VQT6_API void  vqt6_qpainter_fill_rect(void* p, int x, int y, int w, int h, void* color);
VQT6_API void  vqt6_qpainter_draw_ellipse(void* p, int x, int y, int w, int h);
VQT6_API void  vqt6_qpainter_draw_arc(void* p, int x, int y, int w, int h, int start_angle, int span_angle);
VQT6_API void  vqt6_qpainter_draw_chord(void* p, int x, int y, int w, int h, int start_angle, int span_angle);
VQT6_API void  vqt6_qpainter_draw_pie(void* p, int x, int y, int w, int h, int start_angle, int span_angle);
VQT6_API void  vqt6_qpainter_draw_polygon(void* p, int* points, int point_count);
VQT6_API void  vqt6_qpainter_draw_polyline(void* p, int* points, int point_count);
VQT6_API void  vqt6_qpainter_draw_point(void* p, int x, int y);
VQT6_API void  vqt6_qpainter_draw_points(void* p, int* points, int point_count);
VQT6_API void  vqt6_qpainter_draw_text(void* p, int x, int y, void* text);
VQT6_API void  vqt6_qpainter_draw_text_in_rect(void* p, int x, int y, int w, int h, int flags, void* text);
VQT6_API void  vqt6_qpainter_draw_pixmap(void* p, int x, int y, void* pixmap);
VQT6_API void  vqt6_qpainter_draw_image(void* p, int x, int y, void* image);
VQT6_API void  vqt6_qpainter_draw_tiled_pixmap(void* p, int x, int y, int w, int h, void* pixmap);
VQT6_API void  vqt6_qpainter_translate(void* p, int dx, int dy);
VQT6_API void  vqt6_qpainter_rotate(void* p, double angle);
VQT6_API void  vqt6_qpainter_scale(void* p, double sx, double sy);
VQT6_API void  vqt6_qpainter_reset_transform(void* p);
VQT6_API void  vqt6_qpainter_save(void* p);
VQT6_API void  vqt6_qpainter_restore(void* p);
VQT6_API void  vqt6_qpainter_free(void* p);

// ============================================================
// QPen
// ============================================================
VQT6_API void* vqt6_qpen_create(void);
VQT6_API void* vqt6_qpen_create_with_color(void* color);
VQT6_API void* vqt6_qpen_create_with_color_width(void* color, int width);
VQT6_API void  vqt6_qpen_set_color(void* pen, void* color);
VQT6_API void* vqt6_qpen_color(void* pen);
VQT6_API void  vqt6_qpen_set_width(void* pen, int width);
VQT6_API int   vqt6_qpen_width(void* pen);
VQT6_API void  vqt6_qpen_set_style(void* pen, int style);
VQT6_API int   vqt6_qpen_style(void* pen);
VQT6_API void  vqt6_qpen_free(void* pen);

// ============================================================
// QBrush
// ============================================================
VQT6_API void* vqt6_qbrush_create(void);
VQT6_API void* vqt6_qbrush_create_with_color(void* color);
VQT6_API void* vqt6_qbrush_create_with_style(int style);
VQT6_API void  vqt6_qbrush_set_color(void* brush, void* color);
VQT6_API void* vqt6_qbrush_color(void* brush);
VQT6_API void  vqt6_qbrush_set_style(void* brush, int style);
VQT6_API int   vqt6_qbrush_style(void* brush);
VQT6_API void  vqt6_qbrush_free(void* brush);

// ============================================================
// QIcon
// ============================================================
VQT6_API void* vqt6_qicon_create(void);
VQT6_API void* vqt6_qicon_create_with_file(void* file_name);
VQT6_API void  vqt6_qicon_add_file(void* icon, void* file_name);
VQT6_API void  vqt6_qicon_add_pixmap(void* icon, void* pixmap);
VQT6_API int   vqt6_qicon_is_null(void* icon);
VQT6_API void* vqt6_qicon_pixmap(void* icon, int w, int h);
VQT6_API void  vqt6_qicon_free(void* icon);

// ============================================================
// QCursor
// ============================================================
VQT6_API void* vqt6_qcursor_create(void);
VQT6_API void* vqt6_qcursor_create_with_shape(int shape);
VQT6_API void  vqt6_qcursor_pos(int* x, int* y);
VQT6_API void  vqt6_qcursor_set_pos(int x, int y);
VQT6_API void  vqt6_qcursor_set_shape(void* cursor, int shape);
VQT6_API int   vqt6_qcursor_shape(void* cursor);
VQT6_API void  vqt6_qcursor_free(void* cursor);

// ============================================================
// QKeyEvent
// ============================================================
VQT6_API void* vqt6_qkeyevent_create(int type, int key, int modifiers, void* text);
VQT6_API int   vqt6_qkeyevent_key(void* event);
VQT6_API void* vqt6_qkeyevent_text(void* event);
VQT6_API int   vqt6_qkeyevent_modifiers(void* event);
VQT6_API int   vqt6_qkeyevent_is_auto_repeat(void* event);
VQT6_API void  vqt6_qkeyevent_free(void* event);

// ============================================================
// QMouseEvent
// ============================================================
VQT6_API void* vqt6_qmouseevent_create(int type, void* local_pos, int button, int buttons, int modifiers);
VQT6_API int   vqt6_qmouseevent_button(void* event);
VQT6_API int   vqt6_qmouseevent_buttons(void* event);
VQT6_API int   vqt6_qmouseevent_x(void* event);
VQT6_API int   vqt6_qmouseevent_y(void* event);
VQT6_API int   vqt6_qmouseevent_global_x(void* event);
VQT6_API int   vqt6_qmouseevent_global_y(void* event);
VQT6_API int   vqt6_qmouseevent_modifiers(void* event);
VQT6_API void  vqt6_qmouseevent_free(void* event);

// ============================================================
// QResizeEvent / QPaintEvent / QCloseEvent
// ============================================================
VQT6_API void* vqt6_qresizeevent_create(int width, int height, int old_width, int old_height);
VQT6_API void  vqt6_qresizeevent_size(void* event, int* w, int* h);
VQT6_API void  vqt6_qresizeevent_old_size(void* event, int* w, int* h);
VQT6_API void  vqt6_qresizeevent_free(void* event);

VQT6_API void* vqt6_qpaintevent_create(int rect_x, int rect_y, int rect_w, int rect_h);
VQT6_API void  vqt6_qpaintevent_rect(void* event, int* x, int* y, int* w, int* h);
VQT6_API void  vqt6_qpaintevent_free(void* event);

VQT6_API void* vqt6_qcloseevent_create(void);
VQT6_API int   vqt6_qcloseevent_is_accepted(void* event);
VQT6_API void  vqt6_qcloseevent_accept(void* event);
VQT6_API void  vqt6_qcloseevent_ignore(void* event);
VQT6_API void  vqt6_qcloseevent_free(void* event);

#ifdef __cplusplus
}
#endif

#endif // VQT6_BRIDGE_GUI_H
