rounded corners on select widgets #12

Merged
IoI_xD merged 15 commits from rounded into master 2026-03-27 11:08:43 +09:00
16 changed files with 224 additions and 63 deletions
Showing only changes of commit 8d7016367e - Show all commits

experimental rounded corners idea

IoI_xD 2026-03-26 14:40:21 -07:00 committed by Nishi

View file

@ -53,7 +53,7 @@ MWDECL void MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color);
* @param rect Rectangle area * @param rect Rectangle area
* @param color Color * @param color Color
*/ */
MWDECL void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color); MWDECL void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color, int rounded);
/*! /*!
* @brief Draws a frame * @brief Draws a frame
@ -63,7 +63,7 @@ MWDECL void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color);
* @param invert Invert the 3D border color or not * @param invert Invert the 3D border color or not
* @warning `rect` gets changed to the area of rectangle inside * @warning `rect` gets changed to the area of rectangle inside
*/ */
MWDECL void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert); MWDECL void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int rounded);
/*! /*!
* @brief Does the DrawFrame/DrawRect combo used for drawing widget. * @brief Does the DrawFrame/DrawRect combo used for drawing widget.
@ -95,7 +95,7 @@ MWDECL void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int i
* @param same Same as dark color * @param same Same as dark color
* @warning `rect` gets changed to the area of rectangle inside * @warning `rect` gets changed to the area of rectangle inside
*/ */
MWDECL void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same); MWDECL void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same, int rounded);
/*! /*!
* @brief Creates a pixmap from image * @brief Creates a pixmap from image

View file

@ -34,10 +34,11 @@ enum MwLLBackends {
}; };
struct _MwLLCommon { struct _MwLLCommon {
void* user; void* user;
int copy_buffer; int copy_buffer;
int type; int type;
int coordinate_type; int coordinate_type;
MwBool supports_transparency;
MwLLHandler handler; MwLLHandler handler;
}; };

View file

@ -123,6 +123,7 @@ typedef struct wayland_call_table {
void (*cairo_fill)(cairo_t* cr); void (*cairo_fill)(cairo_t* cr);
void (*cairo_pattern_set_filter)(cairo_pattern_t* pattern, void (*cairo_pattern_set_filter)(cairo_pattern_t* pattern,
cairo_filter_t filter); cairo_filter_t filter);
void (*cairo_set_antialias)(cairo_t*, cairo_antialias_t);
} wayland_call_table_t; } wayland_call_table_t;
@ -201,6 +202,7 @@ MwInline int wayland_load_funcs() {
CAIRO_FUNC(cairo_rectangle); CAIRO_FUNC(cairo_rectangle);
CAIRO_FUNC(cairo_new_path); CAIRO_FUNC(cairo_new_path);
CAIRO_FUNC(cairo_set_line_cap); CAIRO_FUNC(cairo_set_line_cap);
CAIRO_FUNC(cairo_set_antialias);
CAIRO_FUNC(cairo_set_source_rgba); CAIRO_FUNC(cairo_set_source_rgba);
CAIRO_FUNC(cairo_set_source_rgb); CAIRO_FUNC(cairo_set_source_rgb);
CAIRO_FUNC(cairo_reset_clip); CAIRO_FUNC(cairo_reset_clip);
@ -257,6 +259,7 @@ MwInline int wayland_load_funcs() {
#define cairo_rectangle wl_call_tbl.cairo_rectangle #define cairo_rectangle wl_call_tbl.cairo_rectangle
#define cairo_new_path wl_call_tbl.cairo_new_path #define cairo_new_path wl_call_tbl.cairo_new_path
#define cairo_set_line_cap wl_call_tbl.cairo_set_line_cap #define cairo_set_line_cap wl_call_tbl.cairo_set_line_cap
#define cairo_set_antialias wl_call_tbl.cairo_set_antialias
#define cairo_set_source_rgba wl_call_tbl.cairo_set_source_rgba #define cairo_set_source_rgba wl_call_tbl.cairo_set_source_rgba
#define cairo_set_source_rgb wl_call_tbl.cairo_set_source_rgb #define cairo_set_source_rgb wl_call_tbl.cairo_set_source_rgb
#define cairo_reset_clip wl_call_tbl.cairo_reset_clip #define cairo_reset_clip wl_call_tbl.cairo_reset_clip

View file

@ -1972,6 +1972,9 @@ static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLL
static void MwLLLineImpl(MwLL handle, MwPoint* points, MwLLColor color) { static void MwLLLineImpl(MwLL handle, MwPoint* points, MwLLColor color) {
int i; int i;
clip(handle);
cairo_set_antialias(handle->wayland.front_cairo, CAIRO_ANTIALIAS_NONE);
cairo_set_line_cap(handle->wayland.front_cairo, CAIRO_LINE_CAP_SQUARE); cairo_set_line_cap(handle->wayland.front_cairo, CAIRO_LINE_CAP_SQUARE);
cairo_set_source_rgb(handle->wayland.front_cairo, color->common.red / 255.0, color->common.green / 255.0, color->common.blue / 255.0); cairo_set_source_rgb(handle->wayland.front_cairo, color->common.red / 255.0, color->common.green / 255.0, color->common.blue / 255.0);
cairo_new_path(handle->wayland.front_cairo); cairo_new_path(handle->wayland.front_cairo);

View file

@ -11,9 +11,12 @@
#include "../external/stb_ds.h" #include "../external/stb_ds.h"
#define BORDER_ROUNDNESS 10
#define BORDER_SMOOTHNESS 50
static int get_color_diff(MwWidget handle) { static int get_color_diff(MwWidget handle) {
if(MwGetInteger(handle, MwNmodernLook)) { if(MwGetInteger(handle, MwNmodernLook)) {
return 46; return 23;
} else { } else {
return 80; return 80;
} }
@ -29,7 +32,7 @@ static int hex(const char* txt, int len) {
n = c - 'a' + 10; n = c - 'a' + 10;
} else if('A' <= c && c <= 'F') { } else if('A' <= c && c <= 'F') {
n = c - 'A' + 10; n = c - 'A' + 10;
} else if('0' <= c && c <= '9') { } else if('0' <= c && c <= 'g') {
n = c - '0'; n = c - '0';
} }
r = r << 4; r = r << 4;
@ -102,14 +105,15 @@ void MwDrawRect(MwWidget handle, MwRect* rect, MwLLColor color) {
MwLLPolygon(handle->lowlevel, p, 4, color); MwLLPolygon(handle->lowlevel, p, 4, color);
} }
void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color) { void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color, int rounded) {
MwLLPixmap pixmap; MwLLPixmap pixmap;
int y; int y, i;
double darken = 0.; double darken = 0.;
int ColorDiff = get_color_diff(handle); int ColorDiff = get_color_diff(handle);
double darkenStep = (ColorDiff / 4.) / rect->height; double darkenStep = (ColorDiff / 4.) / rect->height;
unsigned long sz = 1 * rect->height * 4; unsigned long sz = 1 * rect->height * 4;
unsigned char* data = malloc(sz); unsigned char* data = malloc(sz);
MwRect r = *rect;
memset(data, 0, sz); memset(data, 0, sz);
for(y = 0; y < rect->height; y++) { for(y = 0; y < rect->height; y++) {
@ -124,18 +128,64 @@ void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color) {
} }
pixmap = MwLLCreatePixmap(handle->lowlevel, data, 1, rect->height); pixmap = MwLLCreatePixmap(handle->lowlevel, data, 1, rect->height);
MwLLDrawPixmap(handle->lowlevel, rect, pixmap); if(rounded && rect->height >= (BORDER_ROUNDNESS * 2) && rect->width >= (BORDER_ROUNDNESS * 2)) {
int xt;
int x = rect->x + (BORDER_ROUNDNESS + 1);
int y = rect->y + (BORDER_ROUNDNESS + 1);
for(i = 0; i < BORDER_ROUNDNESS; i++) {
double point = ((i + (M_PI * 4)) / 7.);
double point2 = (((i + 1) + (M_PI * 4)) / 7.);
int x2 = x - (sin(point2) * BORDER_ROUNDNESS);
r.x = x - (sin(point) * BORDER_ROUNDNESS);
r.y = y + (cos(point) * BORDER_ROUNDNESS);
r.width = (x - (sin(point + 1) * BORDER_ROUNDNESS)) - r.x;
r.height = (rect->height - ((r.y - rect->y) * 2) - 1);
MwLLDrawPixmap(handle->lowlevel, &r, pixmap);
for(xt = x; xt < x2; xt++) {
r.x = xt;
r.y = y + (cos(point2) * BORDER_ROUNDNESS);
r.height = (rect->height - ((r.y - rect->y)) - 1);
MwLLDrawPixmap(handle->lowlevel, &r, pixmap);
}
}
r = *rect;
r.x += BORDER_ROUNDNESS;
r.width -= (BORDER_ROUNDNESS * 2);
r.height -= 1;
MwLLDrawPixmap(handle->lowlevel, &r, pixmap);
r = *rect;
x = (rect->x + rect->width) - (BORDER_ROUNDNESS + 2);
y = rect->y + (BORDER_ROUNDNESS + 1);
for(i = 0; i < BORDER_ROUNDNESS; i++) {
double point = ((i + (M_PI * 4)) / 7.);
double point2 = (((i + 1) + (M_PI * 4)) / 7.);
int x2 = x + (sin(point2) * BORDER_ROUNDNESS);
r.x = x + (sin(point) * BORDER_ROUNDNESS);
r.y = y + (cos(point) * BORDER_ROUNDNESS);
r.width = 1;
r.height = (rect->height - ((r.y - rect->y) * 2) - 1);
MwLLDrawPixmap(handle->lowlevel, &r, pixmap);
for(xt = x; xt < x2; xt++) {
r.x = xt;
r.y = y + (cos(point2) * BORDER_ROUNDNESS);
r.height = (rect->height - ((r.y - rect->y) * 2) - 2);
MwLLDrawPixmap(handle->lowlevel, &r, pixmap);
}
}
} else {
MwLLDrawPixmap(handle->lowlevel, &r, pixmap);
}
MwLLDestroyPixmap(pixmap); MwLLDestroyPixmap(pixmap);
free(data); free(data);
} }
void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert) { void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int rounded) {
int inv; int inv;
if((inv = MwGetInteger(handle, MwNforceInverted)) != MwDEFAULT && inv) invert = 1; if((inv = MwGetInteger(handle, MwNforceInverted)) != MwDEFAULT && inv) invert = 1;
if(MwGetInteger(handle, MwNmodernLook)) { if(MwGetInteger(handle, MwNmodernLook)) {
MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle), 0, 0); MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle), 0, 0, rounded);
} else { } else {
int diff = get_color_diff(handle) / 3 * 2; int diff = get_color_diff(handle) / 3 * 2;
@ -143,11 +193,11 @@ void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
int i; int i;
int st = invert ? 1 : 0; int st = invert ? 1 : 0;
for(i = st; i < st + 2; i++) { for(i = st; i < st + 2; i++) {
if((i % 2) == 0) MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle) - 1, -diff, (handle->parent == NULL || handle->parent->lowlevel == NULL) ? 1 : 0); if((i % 2) == 0) MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle) - 1, -diff, (handle->parent == NULL || handle->parent->lowlevel == NULL) ? 1 : 0, 0);
if((i % 2) == 1) MwDrawFrameEx(handle, rect, color, invert, 1, diff, 0); if((i % 2) == 1) MwDrawFrameEx(handle, rect, color, invert, 1, diff, 0, 0);
} }
} else { } else {
MwDrawFrameEx(handle, rect, color, invert, 1, 0, 0); MwDrawFrameEx(handle, rect, color, invert, 1, 0, 0, 0);
} }
} }
} }
@ -156,11 +206,11 @@ void MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int invert
MwLLColor col; MwLLColor col;
if(border) { if(border) {
MwDrawFrame(handle, rect, color, invert); MwDrawFrame(handle, rect, color, invert, handle->lowlevel->common.supports_transparency);
} }
col = invert ? MwLightenColor(handle, color, -8, -8, -8) : color; col = invert ? MwLightenColor(handle, color, -8, -8, -8) : color;
if(MwGetInteger(handle, MwNmodernLook)) { if(MwGetInteger(handle, MwNmodernLook)) {
MwDrawRectFading(handle, rect, col); MwDrawRectFading(handle, rect, col, handle->lowlevel->common.supports_transparency);
} else { } else {
MwDrawRect(handle, rect, col); MwDrawRect(handle, rect, col);
} }
@ -234,54 +284,158 @@ void MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
MwLLFreeColor(darker); MwLLFreeColor(darker);
} }
void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same) { void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff, int same, int rounded) {
MwPoint p[6]; MwPoint p[7];
int ColorDiff = get_color_diff(handle); int ColorDiff = get_color_diff(handle);
MwLLColor darker = MwLightenColor(handle, color, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff); MwLLColor darker = MwLightenColor(handle, color, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff);
MwLLColor lighter = same ? MwLightenColor(handle, darker, 0, 0, 0) : MwLightenColor(handle, color, ColorDiff - diff, ColorDiff - diff, ColorDiff - diff); MwLLColor lighter = same ? MwLightenColor(handle, darker, 0, 0, 0) : MwLightenColor(handle, color, ColorDiff - diff, ColorDiff - diff, ColorDiff - diff);
int i;
MwLLColor middle = MwLLAllocColor(handle->lowlevel,
(lighter->common.red * darker->common.red) / 255,
(lighter->common.green * darker->common.green) / 255,
(lighter->common.blue * darker->common.blue) / 255);
p[0].x = rect->x; if(rounded) {
p[0].y = rect->y; /* top left edge */
for(i = 0; i < BORDER_SMOOTHNESS; i += 2) {
MwPoint line[2];
double point = ((i + (M_PI * (BORDER_SMOOTHNESS / 2.))) / (BORDER_SMOOTHNESS));
int x = rect->x + (BORDER_ROUNDNESS + 2);
int y = rect->y + (BORDER_ROUNDNESS + 2);
p[1].x = rect->x + rect->width; line[0].x = x - (sin(point) * BORDER_ROUNDNESS);
p[1].y = rect->y; line[0].y = y + (cos(point) * BORDER_ROUNDNESS);
line[1].x = x - (sin(point + 1) * BORDER_ROUNDNESS);
line[1].y = y + (cos(point + 1) * BORDER_ROUNDNESS);
MwLLLine(handle->lowlevel, line, invert ? darker : lighter);
}
p[2].x = rect->x + rect->width - border; p[0].x = rect->x + BORDER_ROUNDNESS;
p[2].y = rect->y + border; p[0].y = rect->y;
p[3].x = rect->x + border; p[1].x = rect->x + rect->width - BORDER_ROUNDNESS;
p[3].y = rect->y + border; p[1].y = rect->y;
p[4].x = rect->x + border; p[2].x = rect->x + rect->width - border - BORDER_ROUNDNESS;
p[4].y = rect->y + rect->height - border; p[2].y = rect->y + border;
p[5].x = rect->x; p[3].x = rect->x + border - BORDER_ROUNDNESS;
p[5].y = rect->y + rect->height; p[3].y = rect->y + border + BORDER_ROUNDNESS;
p[4].x = rect->x + border - BORDER_ROUNDNESS;
p[4].y = rect->y + rect->height - border - BORDER_ROUNDNESS;
p[5].x = rect->x + BORDER_ROUNDNESS;
p[5].y = rect->y + rect->height - BORDER_ROUNDNESS;
MwLLPolygon(handle->lowlevel, p, 6, invert ? darker : lighter);
/* top right edge */
for(i = 0; i < BORDER_SMOOTHNESS; i += 2) {
MwPoint line[2];
double point = ((i + (M_PI * (BORDER_SMOOTHNESS / 2.))) / (BORDER_SMOOTHNESS));
int x = (rect->x + rect->width) - (BORDER_ROUNDNESS + 2);
int y = rect->y + (BORDER_ROUNDNESS + 2);
double placeholder = (sin(point) * BORDER_ROUNDNESS);
line[0].x = x + placeholder;
line[0].y = y + (cos(point) * BORDER_ROUNDNESS);
line[1].x = x + (sin(point + 1) * BORDER_ROUNDNESS);
line[1].y = y + (cos(point + 1) * BORDER_ROUNDNESS);
MwLLLine(handle->lowlevel, line, middle);
}
} else {
p[0].x = rect->x;
p[0].y = rect->y;
p[1].x = rect->x + rect->width;
p[1].y = rect->y;
p[2].x = rect->x + rect->width - border;
p[2].y = rect->y + border;
p[3].x = rect->x + border;
p[3].y = rect->y + border;
p[4].x = rect->x + border;
p[4].y = rect->y + rect->height - border;
p[5].x = rect->x;
p[5].y = rect->y + rect->height;
}
MwLLPolygon(handle->lowlevel, p, 6, invert ? darker : lighter); MwLLPolygon(handle->lowlevel, p, 6, invert ? darker : lighter);
p[0].x = rect->x + rect->width; if(rounded && rect->height >= (BORDER_ROUNDNESS * 2) && rect->width >= (BORDER_ROUNDNESS * 2)) {
p[0].y = rect->y; /* bottom left edge */
for(i = 0; i < BORDER_SMOOTHNESS; i += 2) {
MwPoint line[2];
double point = ((i + (M_PI * (BORDER_SMOOTHNESS / 2.))) / (BORDER_SMOOTHNESS));
int x = rect->x + (BORDER_ROUNDNESS + 2);
int y = (rect->y + rect->height) - (BORDER_ROUNDNESS + 2);
p[1].x = rect->x + rect->width - border; line[0].x = x - (sin(point) * BORDER_ROUNDNESS);
p[1].y = rect->y + border; line[0].y = y - (cos(point) * BORDER_ROUNDNESS);
line[1].x = x - (sin(point + 1) * BORDER_ROUNDNESS);
line[1].y = y - (cos(point + 1) * BORDER_ROUNDNESS);
MwLLLine(handle->lowlevel, line, middle);
}
p[0].x = rect->x + BORDER_ROUNDNESS;
p[0].y = rect->y + 1;
p[2].x = rect->x + rect->width - border; p[1].x = rect->x + rect->width - border;
p[2].y = rect->y + rect->height - border; p[1].y = rect->y + border + BORDER_ROUNDNESS;
p[3].x = rect->x + border; p[2].x = rect->x + rect->width - border;
p[3].y = rect->y + rect->height - border; p[2].y = rect->y + rect->height - border - BORDER_ROUNDNESS;
p[4].x = rect->x; p[3].x = rect->x + rect->width - border - BORDER_ROUNDNESS;
p[4].y = rect->y + rect->height; p[3].y = rect->y + rect->height - border;
p[5].x = rect->x + rect->width; p[4].x = rect->x + border + BORDER_ROUNDNESS;
p[5].y = rect->y + rect->height; p[4].y = rect->y + rect->height - border;
MwLLPolygon(handle->lowlevel, p, 6, invert ? lighter : darker); p[5].x = rect->x + BORDER_ROUNDNESS;
p[5].y = rect->y + rect->height - BORDER_ROUNDNESS;
p[6].x = rect->x + rect->width - BORDER_ROUNDNESS;
p[6].y = rect->y + rect->height - BORDER_ROUNDNESS;
MwLLPolygon(handle->lowlevel, p, 7, invert ? lighter : darker);
/* bottom right edge */
for(i = 0; i < BORDER_SMOOTHNESS; i += 2) {
MwPoint line[2];
double point = ((i + (M_PI * (BORDER_SMOOTHNESS / 2.))) / (BORDER_SMOOTHNESS));
int x = (rect->x + rect->width) - (BORDER_ROUNDNESS + 2);
int y = (rect->y + rect->height) - (BORDER_ROUNDNESS + 2);
line[0].x = x + (sin(point) * BORDER_ROUNDNESS);
line[0].y = y - (cos(point) * BORDER_ROUNDNESS);
line[1].x = x + (sin(point + 1) * BORDER_ROUNDNESS);
line[1].y = y - (cos(point + 1) * BORDER_ROUNDNESS);
MwLLLine(handle->lowlevel, line, middle);
}
} else {
p[0].x = rect->x + rect->width;
p[0].y = rect->y;
p[1].x = rect->x + rect->width - border;
p[1].y = rect->y + border;
p[2].x = rect->x + rect->width - border;
p[2].y = rect->y + rect->height - border;
p[3].x = rect->x + border;
p[3].y = rect->y + rect->height - border;
p[4].x = rect->x;
p[4].y = rect->y + rect->height;
p[5].x = rect->x + rect->width;
p[5].y = rect->y + rect->height;
MwLLPolygon(handle->lowlevel, p, 6, invert ? lighter : darker);
}
MwLLFreeColor(lighter); MwLLFreeColor(lighter);
MwLLFreeColor(darker); MwLLFreeColor(darker);
MwLLFreeColor(middle);
rect->x += border; rect->x += border;
rect->y += border; rect->y += border;

View file

@ -24,7 +24,7 @@ static void draw(MwWidget handle) {
r.height = MwGetInteger(handle, MwNheight); r.height = MwGetInteger(handle, MwNheight);
if(MwGetInteger(handle, MwNhasBorder)) { if(MwGetInteger(handle, MwNhasBorder)) {
MwDrawFrame(handle, &r, base, MwGetInteger(handle, MwNinverted)); MwDrawFrame(handle, &r, base, MwGetInteger(handle, MwNinverted), 0);
} }
MwDrawRect(handle, &r, base); MwDrawRect(handle, &r, base);

View file

@ -72,7 +72,7 @@ static void draw(MwWidget handle) {
r.y += r.height; r.y += r.height;
r.height = MwDefaultBorderWidth(handle) * 2; r.height = MwDefaultBorderWidth(handle) * 2;
MwDrawFrame(handle, &r, base, 0); MwDrawFrame(handle, &r, base, 0, 0);
MwLLFreeColor(text); MwLLFreeColor(text);
MwLLFreeColor(base); MwLLFreeColor(base);

View file

@ -22,7 +22,7 @@ static void draw(MwWidget handle) {
fr.y = 0; fr.y = 0;
fr.width = MwGetInteger(handle, MwNwidth); fr.width = MwGetInteger(handle, MwNwidth);
fr.height = MwGetInteger(handle, MwNheight); fr.height = MwGetInteger(handle, MwNheight);
MwDrawFrame(handle, &fr, base, inverted); MwDrawFrame(handle, &fr, base, inverted, 0);
rr.x = MwDefaultBorderWidth(handle); rr.x = MwDefaultBorderWidth(handle);
rr.y = MwDefaultBorderWidth(handle); rr.y = MwDefaultBorderWidth(handle);

View file

@ -20,7 +20,7 @@ static void draw(MwWidget handle) {
r.width = MwGetInteger(handle, MwNwidth); r.width = MwGetInteger(handle, MwNwidth);
r.height = MwGetInteger(handle, MwNheight); r.height = MwGetInteger(handle, MwNheight);
if(MwGetInteger(handle, MwNhasBorder)) MwDrawFrame(handle, &r, base, MwGetInteger(handle, MwNinverted)); if(MwGetInteger(handle, MwNhasBorder)) MwDrawFrame(handle, &r, base, MwGetInteger(handle, MwNinverted), 0);
MwDrawRect(handle, &r, base); MwDrawRect(handle, &r, base);
if(px != NULL) { if(px != NULL) {

View file

@ -208,7 +208,7 @@ static void frame_draw(MwWidget handle) {
p.x = MwDefaultBorderWidth(handle); p.x = MwDefaultBorderWidth(handle);
p.y = MwDefaultBorderWidth(handle); p.y = MwDefaultBorderWidth(handle);
MwDrawFrame(handle, &r, base, 1); MwDrawFrame(handle, &r, base, 1, 0);
MwDrawRect(handle, &r, base2); MwDrawRect(handle, &r, base2);
r = r2; r = r2;
@ -282,7 +282,7 @@ static void frame_draw(MwWidget handle) {
handle->bgcolor = NULL; handle->bgcolor = NULL;
} }
MwDrawFrame(handle, &r, base, 1); MwDrawFrame(handle, &r, base, 1, 0);
MwLLFreeColor(text2); MwLLFreeColor(text2);
MwLLFreeColor(text); MwLLFreeColor(text);
@ -401,7 +401,7 @@ static void draw(MwWidget handle) {
r.y = 0; r.y = 0;
r.width = get_col_width(lb, i); r.width = get_col_width(lb, i);
r.height = MwDefaultBorderWidth(handle) * 2 + MwTextHeight(handle, "M"); r.height = MwDefaultBorderWidth(handle) * 2 + MwTextHeight(handle, "M");
MwDrawFrame(handle, &r, base, 0); MwDrawFrame(handle, &r, base, 0, 0);
x += MwDefaultBorderWidth(handle); x += MwDefaultBorderWidth(handle);

View file

@ -100,7 +100,7 @@ static void draw(MwWidget handle) {
BEGIN_MENU_LOOP; BEGIN_MENU_LOOP;
if(m->sub[i]->wsub != NULL || (in_area && handle->pressed)) { if(m->sub[i]->wsub != NULL || (in_area && handle->pressed)) {
MwDrawFrame(handle, &r, base, MwFALSE); MwDrawFrame(handle, &r, base, MwFALSE, 0);
MwDrawWidgetBack(handle, &r, base, 0, MwFALSE); MwDrawWidgetBack(handle, &r, base, 0, MwFALSE);
} }

View file

@ -23,7 +23,7 @@ static void draw(MwWidget handle) {
r.width = MwGetInteger(handle, MwNwidth); r.width = MwGetInteger(handle, MwNwidth);
r.height = MwGetInteger(handle, MwNheight); r.height = MwGetInteger(handle, MwNheight);
MwDrawFrame(handle, &r, base, 1); MwDrawFrame(handle, &r, base, 1, 0);
MwDrawRect(handle, &r, base); MwDrawRect(handle, &r, base);
w = MwGetInteger(handle, MwNvalue) - MwGetInteger(handle, MwNminValue); w = MwGetInteger(handle, MwNvalue) - MwGetInteger(handle, MwNminValue);
w = w / (MwGetInteger(handle, MwNmaxValue) - MwGetInteger(handle, MwNminValue)); w = w / (MwGetInteger(handle, MwNmaxValue) - MwGetInteger(handle, MwNminValue));

View file

@ -25,7 +25,7 @@ static void draw(MwWidget handle) {
r.y = (r.height - 2) / 2; r.y = (r.height - 2) / 2;
r.height = 2; r.height = 2;
} }
MwDrawFrameEx(handle, &r, base, 1, 1, 0, 0); MwDrawFrameEx(handle, &r, base, 1, 1, 0, 0, MwGetInteger(handle, MwNmodernLook));
MwLLFreeColor(base); MwLLFreeColor(base);
} }

View file

@ -59,7 +59,7 @@ static void draw(MwWidget handle) {
rc.x += MwGetInteger(handle, MwNleftPadding); rc.x += MwGetInteger(handle, MwNleftPadding);
MwDrawFrameEx(handle, &rc, base, 1, 1, 0, 0); MwDrawFrameEx(handle, &rc, base, 1, 1, 0, 0, 0);
p.y += 2 + 1; p.y += 2 + 1;
} else { } else {

View file

@ -64,7 +64,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
const int len = 4; const int len = 4;
MwDrawRect(handle, &r, col); MwDrawRect(handle, &r, col);
MwDrawFrame(handle, &r, base, tree->opened); MwDrawFrame(handle, &r, base, tree->opened, 0);
if(tree->opened) { if(tree->opened) {
l[0].x = r.x + (r.width - len) / 2; l[0].x = r.x + (r.width - len) / 2;
l[0].y = r.y + r.height / 2; l[0].y = r.y + r.height / 2;
@ -91,7 +91,7 @@ static void recursion(MwWidget handle, MwTreeViewEntry* tree, MwTreeViewEntry**
MwLLLine(handle->lowlevel, &l[0], text); MwLLLine(handle->lowlevel, &l[0], text);
} }
r = r2; r = r2;
MwDrawFrame(handle, &r, base, tree->opened); MwDrawFrame(handle, &r, base, tree->opened, 0);
if(col != base) MwLLFreeColor(col); if(col != base) MwLLFreeColor(col);
} else { } else {
@ -183,7 +183,7 @@ static void frame_draw(MwWidget handle) {
p.x = MwDefaultBorderWidth(handle); p.x = MwDefaultBorderWidth(handle);
p.y = MwDefaultBorderWidth(handle); p.y = MwDefaultBorderWidth(handle);
MwDrawFrame(handle, &r, base, 1); MwDrawFrame(handle, &r, base, 1, 0);
MwDrawRect(handle, &r, base2); MwDrawRect(handle, &r, base2);
r = r2; r = r2;
@ -193,7 +193,7 @@ static void frame_draw(MwWidget handle) {
recursion(handle, tv->tree[i], tv->tree, base, text, base2, text2, &p, 0, LineSpace, &skip, &shared, 1, NULL); recursion(handle, tv->tree[i], tv->tree, base, text, base2, text2, &p, 0, LineSpace, &skip, &shared, 1, NULL);
} }
MwDrawFrame(handle, &r, base, 1); MwDrawFrame(handle, &r, base, 1, 0);
MwLLFreeColor(text2); MwLLFreeColor(text2);
MwLLFreeColor(text); MwLLFreeColor(text);

View file

@ -18,7 +18,7 @@ static void draw(MwWidget handle) {
r.width = MwGetInteger(handle, MwNwidth); r.width = MwGetInteger(handle, MwNwidth);
r.height = MwGetInteger(handle, MwNheight); r.height = MwGetInteger(handle, MwNheight);
if(MwGetInteger(handle, MwNhasBorder)) MwDrawFrame(handle, &r, c, MwGetInteger(handle, MwNinverted)); if(MwGetInteger(handle, MwNhasBorder)) MwDrawFrame(handle, &r, c, MwGetInteger(handle, MwNinverted), 0);
MwDrawRect(handle, &r, c); MwDrawRect(handle, &r, c);