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 {
MwDrawWidgetBack(handle, &r, base, handle->pressed, 1);
}
if(bgpx != NULL) {
MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
}
if(bgpx != NULL) MwLLDrawPixmap(handle->lowlevel, &r, bgpx);
if(MwGetInteger(handle, MwNflat) && !handle->pressed) {
r.x += MwDefaultBorderWidth(handle);
r.y += MwDefaultBorderWidth(handle);

View File

@@ -9,8 +9,9 @@ static int create(MwWidget handle) {
}
static void draw(MwWidget handle) {
MwRect r;
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwRect r;
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
r.x = 0;
r.y = 0;
@@ -18,6 +19,7 @@ static void draw(MwWidget handle) {
r.height = MwGetInteger(handle, MwNheight);
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)) {
/* TODO: write check mark */
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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