Skip to content

Commit

Permalink
fix: 修复 ege/button.h 中调用 setfillstyle 时参数位置错误的问题 (#241)
Browse files Browse the repository at this point in the history
* fix: 修复 ege/button.h 中, 调用 setfillstyle 调用时参数位置错误的问题
* refactor: 使用 color_t 颜色类型代替 COLORREF
  • Loading branch information
yixy-only authored Nov 23, 2024
1 parent c0462b7 commit 2c481a9
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions include/ege/button.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class button : public egeControlBase
setcolor(RED);
cleardevice();
setbkmode(TRANSPARENT);
setfillstyle(_bg_color, SOLID_FILL);
setfillstyle(SOLID_FILL, _bg_color);
bar(0, 0, getw() - 1, geth() - 1);
setfont(_font_height, 0, _face);
setcolor(_text_color);
Expand All @@ -156,7 +156,7 @@ class button : public egeControlBase
setbkcolor(_line_color);
rectangle(0, 0, getw(), geth());
rectangle(_side_width, _side_width, getw() - _side_width, geth() - _side_width);
setfillstyle(_shadow_color, SOLID_FILL);
setfillstyle(SOLID_FILL, _shadow_color);

if (_pushed) {
int points[12] = {
Expand Down Expand Up @@ -218,13 +218,13 @@ class button : public egeControlBase

int alpha() const { return _alpha; }

void bgcolor(COLORREF color)
void bgcolor(color_t color)
{
_bg_color = color;
redraw();
}

COLORREF bgcolor() const { return _bg_color; }
color_t bgcolor() const { return _bg_color; }


void callback(int (*fun)(void*), void* param)
Expand Down Expand Up @@ -268,36 +268,36 @@ class button : public egeControlBase

int fontsize() const { return _font_height; }

void linecolor(COLORREF color)
void linecolor(color_t color)
{
_line_color = color;
redraw();
}

COLORREF linecolor() const { return _line_color; }
color_t linecolor() const { return _line_color; }
#ifdef DEBUG

void logger(label* logger) { _logger = logger; }

label* logger() const { return _logger; }
#endif

void shadowcolor(COLORREF color)
void shadowcolor(color_t color)
{
_shadow_color = color;
redraw();
}


COLORREF shadowcolor() const { return _shadow_color; }
color_t shadowcolor() const { return _shadow_color; }

void textcolor(COLORREF color)
void textcolor(color_t color)
{
_text_color = color;
redraw();
}

COLORREF textcolor() const { return _text_color; }
color_t textcolor() const { return _text_color; }

protected:
void updatesidewidth()
Expand All @@ -313,20 +313,20 @@ class button : public egeControlBase
}
}
#endif
bool _pushed;
int (*_on_click)(void*);
char _caption[1024];
char _face[32];
COLORREF _line_color;
COLORREF _bg_color;
COLORREF _text_color;
COLORREF _shadow_color;
int _side_width;
int _font_height;
int _alpha;
void* callback_param;
bool _pushed;
int (*_on_click)(void*);
char _caption[1024];
char _face[32];
color_t _line_color;
color_t _bg_color;
color_t _text_color;
color_t _shadow_color;
int _side_width;
int _font_height;
int _alpha;
void* callback_param;
#ifdef DEBUG
label* _logger;
label* _logger;
#endif
};

Expand Down

0 comments on commit 2c481a9

Please sign in to comment.