background pixmap

This commit is contained in:
NishiOwO
2025-12-11 01:37:13 +09:00
parent e57f3fd910
commit 363897df74
8 changed files with 29 additions and 17 deletions

View File

@@ -35,9 +35,7 @@ static void draw(MwWidget handle) {
} else { } else {
MwDrawWidgetBack(handle, &r, base, handle->pressed, 1); MwDrawWidgetBack(handle, &r, base, handle->pressed, 1);
} }
if(bgpx != NULL) { if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
}
if(MwGetInteger(handle, MwNflat) && !handle->pressed) { if(MwGetInteger(handle, MwNflat) && !handle->pressed) {
r.x += MwDefaultBorderWidth(handle); r.x += MwDefaultBorderWidth(handle);
r.y += MwDefaultBorderWidth(handle); r.y += MwDefaultBorderWidth(handle);

View File

@@ -9,8 +9,9 @@ static int create(MwWidget handle) {
} }
static void draw(MwWidget handle) { static void draw(MwWidget handle) {
MwRect r; MwRect r;
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
r.x = 0; r.x = 0;
r.y = 0; r.y = 0;
@@ -18,6 +19,7 @@ static void draw(MwWidget handle) {
r.height = MwGetInteger(handle, MwNheight); r.height = MwGetInteger(handle, MwNheight);
MwDrawWidgetBack(handle, &r, base, (handle->pressed || MwGetInteger(handle, MwNchecked)) ? 1 : 0, MwTRUE); MwDrawWidgetBack(handle, &r, base, (handle->pressed || MwGetInteger(handle, MwNchecked)) ? 1 : 0, MwTRUE);
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
if(handle->pressed || MwGetInteger(handle, MwNchecked)) { if(handle->pressed || MwGetInteger(handle, MwNchecked)) {
/* TODO: write check mark */ /* TODO: write check mark */
} }

View File

@@ -25,6 +25,7 @@ static void draw(MwWidget handle) {
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground)); MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
const char* str = MwGetText(handle, MwNtext); const char* str = MwGetText(handle, MwNtext);
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
if(str == NULL) str = ""; if(str == NULL) str = "";
r.x = 0; r.x = 0;
@@ -33,6 +34,7 @@ static void draw(MwWidget handle) {
r.height = MwGetInteger(handle, MwNheight); r.height = MwGetInteger(handle, MwNheight);
MwDrawWidgetBack(handle, &r, base, 1, 1); MwDrawWidgetBack(handle, &r, base, 1, 1);
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
if(str != NULL) { if(str != NULL) {
int w = MwTextWidth(handle, "M"); int w = MwTextWidth(handle, "M");
int h = MwTextHeight(handle, "M"); int h = MwTextHeight(handle, "M");

View File

@@ -10,10 +10,11 @@ static int create(MwWidget handle) {
} }
static void draw(MwWidget handle) { static void draw(MwWidget handle) {
MwRect fr; MwRect fr;
MwRect rr; MwRect rr;
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
int inverted; int inverted;
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
if(MwGetInteger(handle, MwNhasBorder)) { if(MwGetInteger(handle, MwNhasBorder)) {
inverted = MwGetInteger(handle, MwNinverted); inverted = MwGetInteger(handle, MwNinverted);
@@ -36,6 +37,7 @@ static void draw(MwWidget handle) {
} }
MwDrawRect(handle, &rr, base); MwDrawRect(handle, &rr, base);
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &rr, bgpx);
MwLLFreeColor(base); MwLLFreeColor(base);
} }

View File

@@ -14,7 +14,8 @@ static void draw(MwWidget handle) {
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground)); MwLLColor text = MwParseColor(handle, MwGetText(handle, MwNforeground));
int align; int align;
const char* str = MwGetText(handle, MwNtext); const char* str = MwGetText(handle, MwNtext);
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
if(str == NULL) str = ""; if(str == NULL) str = "";
@@ -24,6 +25,7 @@ static void draw(MwWidget handle) {
r.height = MwGetInteger(handle, MwNheight); r.height = MwGetInteger(handle, MwNheight);
MwDrawRect(handle, &r, base); MwDrawRect(handle, &r, base);
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
align = MwGetInteger(handle, MwNalignment); align = MwGetInteger(handle, MwNalignment);
if(align == MwALIGNMENT_CENTER) { if(align == MwALIGNMENT_CENTER) {

View File

@@ -12,10 +12,11 @@ static int create(MwWidget handle) {
} }
static void draw(MwWidget handle) { static void draw(MwWidget handle) {
MwRect r; MwRect r;
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwLLColor fill = MwParseColor(handle, MwGetText(handle, MwNforeground)); MwLLColor fill = MwParseColor(handle, MwGetText(handle, MwNforeground));
double w; double w;
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
r.x = 0; r.x = 0;
r.y = 0; r.y = 0;
@@ -26,6 +27,7 @@ static void draw(MwWidget handle) {
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));
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
r.x += MwDefaultBorderWidth(handle); r.x += MwDefaultBorderWidth(handle);
r.y += MwDefaultBorderWidth(handle); r.y += MwDefaultBorderWidth(handle);

View File

@@ -11,8 +11,9 @@ static int create(MwWidget handle) {
} }
static void draw(MwWidget handle) { static void draw(MwWidget handle) {
MwRect r; MwRect r;
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
r.x = 0; r.x = 0;
r.y = 0; r.y = 0;
@@ -20,6 +21,7 @@ static void draw(MwWidget handle) {
r.height = MwGetInteger(handle, MwNheight); r.height = MwGetInteger(handle, MwNheight);
MwDrawRect(handle, &r, base); MwDrawRect(handle, &r, base);
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
MwDrawDiamond(handle, &r, base, (handle->pressed || MwGetInteger(handle, MwNchecked)) ? 1 : 0); MwDrawDiamond(handle, &r, base, (handle->pressed || MwGetInteger(handle, MwNchecked)) ? 1 : 0);
MwLLFreeColor(base); MwLLFreeColor(base);

View File

@@ -65,7 +65,8 @@ static void draw(MwWidget handle) {
MwLLColor dark = MwLightenColor(handle, base, -64, -64, -64); MwLLColor dark = MwLightenColor(handle, base, -64, -64, -64);
scrollbar_t* scr = handle->internal; scrollbar_t* scr = handle->internal;
int or ; int or ;
int uy, dy, ux, dx; int uy, dy, ux, dx;
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
r.x = 0; r.x = 0;
r.y = 0; r.y = 0;
@@ -79,6 +80,7 @@ static void draw(MwWidget handle) {
dx = r.width - r.height; dx = r.width - r.height;
MwDrawWidgetBack(handle, &r, dark, 1, MwTRUE); MwDrawWidgetBack(handle, &r, dark, 1, MwTRUE);
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
rt = r; rt = r;