add disabled widgets
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit
This commit is contained in:
parent
9e165b71d4
commit
149f99622a
7 changed files with 91 additions and 20 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
MwWidget window, menu, button, button2, button3, button4, button5, button6;
|
MwWidget window, menu, button, button2, button3, button4, button5, button6, button7;
|
||||||
|
|
||||||
void MWAPI handler(MwWidget handle, void* user_data, void* call_data) {
|
void MWAPI handler(MwWidget handle, void* user_data, void* call_data) {
|
||||||
(void)handle;
|
(void)handle;
|
||||||
|
|
@ -51,24 +51,29 @@ void MWAPI resize(MwWidget handle, void* user_data, void* call_data) {
|
||||||
|
|
||||||
MwVaApply(button,
|
MwVaApply(button,
|
||||||
MwNy, 50 + mh,
|
MwNy, 50 + mh,
|
||||||
MwNwidth, (w - 50 * 2) / 3,
|
MwNwidth, (w - 50 * 2) / 4,
|
||||||
MwNheight, h - 125 - 50 * 3,
|
MwNheight, h - 125 - 50 * 3,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MwVaApply(button2,
|
MwVaApply(button2,
|
||||||
MwNx, 50 + (w - 50 * 2) / 3,
|
MwNx, 50 + (w - 50 * 2) / 4,
|
||||||
MwNy, 50 + mh,
|
MwNy, 50 + mh,
|
||||||
MwNwidth, (w - 50 * 2) / 3,
|
MwNwidth, (w - 50 * 2) / 4,
|
||||||
MwNheight, h - 125 - 50 * 3,
|
MwNheight, h - 125 - 50 * 3,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MwVaApply(button3,
|
MwVaApply(button3,
|
||||||
MwNx, 50 + (w - 50 * 2) / 3 * 2,
|
MwNx, 50 + (w - 50 * 2) / 4 * 2,
|
||||||
MwNy, 50 + mh,
|
MwNy, 50 + mh,
|
||||||
MwNwidth, (w - 50 * 2) / 3,
|
MwNwidth, (w - 50 * 2) / 4,
|
||||||
|
MwNheight, h - 125 - 50 * 3,
|
||||||
|
NULL);
|
||||||
|
MwVaApply(button7,
|
||||||
|
MwNx, 50 + (w - 50 * 2) / 4 * 3,
|
||||||
|
MwNy, 50 + mh,
|
||||||
|
MwNwidth, (w - 50 * 2) / 4,
|
||||||
MwNheight, h - 125 - 50 * 3,
|
MwNheight, h - 125 - 50 * 3,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MwVaApply(button4,
|
MwVaApply(button4,
|
||||||
MwNx, 50 + (w - 50 * 2) / 3 * 0,
|
MwNx, 50 + (w - 50 * 2) / 3 * 0,
|
||||||
MwNy, h - 50 - 125 + mh,
|
MwNy, h - 50 - 125 + mh,
|
||||||
|
|
@ -121,6 +126,10 @@ int main() {
|
||||||
MwNbackground, "#66f",
|
MwNbackground, "#66f",
|
||||||
MwNforeground, "#000",
|
MwNforeground, "#000",
|
||||||
NULL);
|
NULL);
|
||||||
|
button7 = MwVaCreateWidget(MwButtonClass, "button", window, 250, 50, 100, 125,
|
||||||
|
MwNtext, "disabled",
|
||||||
|
MwNdisabled, 1,
|
||||||
|
NULL);
|
||||||
|
|
||||||
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
|
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
|
||||||
MwAddUserHandler(button, MwNactivateHandler, handler_theme, NULL);
|
MwAddUserHandler(button, MwNactivateHandler, handler_theme, NULL);
|
||||||
|
|
|
||||||
|
|
@ -202,9 +202,16 @@ int main() {
|
||||||
MwNcolumns, 5,
|
MwNcolumns, 5,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
f = frame("Button", -PaddingContent, -PaddingContent, MwButtonClass,
|
f = frame("Button", -PaddingContent, -PaddingContent, MwBoxClass,
|
||||||
MwNtext, "Press me",
|
MwNorientation, MwVERTICAL,
|
||||||
NULL);
|
NULL);
|
||||||
|
b = MwVaCreateWidget(MwButtonClass, "btn", child(f), 0, 0, 0, 0,
|
||||||
|
MwNtext, "Press me",
|
||||||
|
NULL);
|
||||||
|
b = MwVaCreateWidget(MwButtonClass, "btn_disabled", child(f), 0, 0, 0, 0,
|
||||||
|
MwNtext, "Cannot press me",
|
||||||
|
MwNdisabled, 1,
|
||||||
|
NULL);
|
||||||
|
|
||||||
MwVaCreateWidget(MwLabelClass, "label", table, 0, 0, 0, 0,
|
MwVaCreateWidget(MwLabelClass, "label", table, 0, 0, 0, 0,
|
||||||
MwNbold, 1,
|
MwNbold, 1,
|
||||||
|
|
@ -221,11 +228,11 @@ int main() {
|
||||||
MwNorientation, MwVERTICAL,
|
MwNorientation, MwVERTICAL,
|
||||||
MwNfixedSize, 16,
|
MwNfixedSize, 16,
|
||||||
NULL);
|
NULL);
|
||||||
for(j = 0; j < 5; j++) MwCreateWidget(i == 0 ? MwCheckBoxClass : MwRadioBoxClass, i == 0 ? "cb" : "rb", b, 0, 0, 0, 0);
|
for(j = 0; j < 6; j++) MwVaCreateWidget(i == 0 ? MwCheckBoxClass : MwRadioBoxClass, i == 0 ? "cb" : "rb", b, 0, 0, 0, 0, MwNdisabled, (j == 5) ? 1 : 0, NULL);
|
||||||
b = MwVaCreateWidget(MwBoxClass, "table1", w, 0, 0, 0, 0,
|
b = MwVaCreateWidget(MwBoxClass, "table1", w, 0, 0, 0, 0,
|
||||||
MwNorientation, MwVERTICAL,
|
MwNorientation, MwVERTICAL,
|
||||||
NULL);
|
NULL);
|
||||||
for(j = 0; j < 5; j++) {
|
for(j = 0; j < 6; j++) {
|
||||||
char buf[32];
|
char buf[32];
|
||||||
sprintf(buf, "%sBox %d", i == 0 ? "Check" : "Radio", j + 1);
|
sprintf(buf, "%sBox %d", i == 0 ? "Check" : "Radio", j + 1);
|
||||||
MwVaCreateWidget(MwLabelClass, "label", b, 0, 0, 0, 0,
|
MwVaCreateWidget(MwLabelClass, "label", b, 0, 0, 0, 0,
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@
|
||||||
#define MwNcolumns "Icolumns"
|
#define MwNcolumns "Icolumns"
|
||||||
#define MwNcolumnSpan "IcolumnSpan"
|
#define MwNcolumnSpan "IcolumnSpan"
|
||||||
#define MwNrowSpan "IrowSpan"
|
#define MwNrowSpan "IrowSpan"
|
||||||
|
#define MwNdisabled "Idisabled"
|
||||||
|
|
||||||
#define MwNtitle "Stitle"
|
#define MwNtitle "Stitle"
|
||||||
#define MwNtext "Stext"
|
#define MwNtext "Stext"
|
||||||
|
|
|
||||||
|
|
@ -1652,8 +1652,11 @@ static void MwLLEndStateChangeImpl(MwLL handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MwLLSetDarkThemeImpl(MwLL handle, int toggle) {
|
static void MwLLSetDarkThemeImpl(MwLL handle, int toggle) {
|
||||||
(void)handle;
|
|
||||||
(void)toggle;
|
(void)toggle;
|
||||||
|
|
||||||
|
/* Not Really what's supposed to happen with this function, but take this opprutunity to do the handlers that will force everything to redraw. */
|
||||||
|
MwLLDispatch(handle, resize, NULL);
|
||||||
|
MwLLDispatch(handle, draw, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static MwBool MwLLDoModernImpl(MwLL handle) {
|
static MwBool MwLLDoModernImpl(MwLL handle) {
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ static void lldrawhandler(MwLL handle, void* data) {
|
||||||
static void lluphandler(MwLL handle, void* data) {
|
static void lluphandler(MwLL handle, void* data) {
|
||||||
MwWidget h = (MwWidget)handle->common.user;
|
MwWidget h = (MwWidget)handle->common.user;
|
||||||
MwMouse* p = data;
|
MwMouse* p = data;
|
||||||
|
if(MwGetInteger(h, MwNdisabled) == 1) return;
|
||||||
|
|
||||||
if(p->button == MwMOUSE_LEFT) h->pressed = 0;
|
if(p->button == MwMOUSE_LEFT) h->pressed = 0;
|
||||||
h->mouse_point.x = p->point.x;
|
h->mouse_point.x = p->point.x;
|
||||||
|
|
@ -70,6 +71,7 @@ static void lluphandler(MwLL handle, void* data) {
|
||||||
static void lldownhandler(MwLL handle, void* data) {
|
static void lldownhandler(MwLL handle, void* data) {
|
||||||
MwWidget h = (MwWidget)handle->common.user;
|
MwWidget h = (MwWidget)handle->common.user;
|
||||||
MwMouse* p = data;
|
MwMouse* p = data;
|
||||||
|
if(MwGetInteger(h, MwNdisabled) == 1) return;
|
||||||
|
|
||||||
if(p->button == MwMOUSE_LEFT) h->pressed = 1;
|
if(p->button == MwMOUSE_LEFT) h->pressed = 1;
|
||||||
h->mouse_point.x = p->point.x;
|
h->mouse_point.x = p->point.x;
|
||||||
|
|
@ -124,6 +126,7 @@ static void llmovehandler(MwLL handle, void* data) {
|
||||||
static void llkeyhandler(MwLL handle, void* data) {
|
static void llkeyhandler(MwLL handle, void* data) {
|
||||||
MwWidget h = (MwWidget)handle->common.user;
|
MwWidget h = (MwWidget)handle->common.user;
|
||||||
int key = *(int*)data;
|
int key = *(int*)data;
|
||||||
|
if(MwGetInteger(h, MwNdisabled) == 1) return;
|
||||||
|
|
||||||
MwDispatch3(h, key, key);
|
MwDispatch3(h, key, key);
|
||||||
MwDispatchUserHandler(h, MwNkeyHandler, data);
|
MwDispatchUserHandler(h, MwNkeyHandler, data);
|
||||||
|
|
@ -131,24 +134,28 @@ static void llkeyhandler(MwLL handle, void* data) {
|
||||||
|
|
||||||
static void llkeyrelhandler(MwLL handle, void* data) {
|
static void llkeyrelhandler(MwLL handle, void* data) {
|
||||||
MwWidget h = (MwWidget)handle->common.user;
|
MwWidget h = (MwWidget)handle->common.user;
|
||||||
|
if(MwGetInteger(h, MwNdisabled) == 1) return;
|
||||||
|
|
||||||
MwDispatchUserHandler(h, MwNkeyReleaseHandler, data);
|
MwDispatchUserHandler(h, MwNkeyReleaseHandler, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void llfocusinhandler(MwLL handle, void* data) {
|
static void llfocusinhandler(MwLL handle, void* data) {
|
||||||
MwWidget h = (MwWidget)handle->common.user;
|
MwWidget h = (MwWidget)handle->common.user;
|
||||||
|
if(MwGetInteger(h, MwNdisabled) == 1) return;
|
||||||
|
|
||||||
MwDispatchUserHandler(h, MwNfocusInHandler, data);
|
MwDispatchUserHandler(h, MwNfocusInHandler, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void llfocusouthandler(MwLL handle, void* data) {
|
static void llfocusouthandler(MwLL handle, void* data) {
|
||||||
MwWidget h = (MwWidget)handle->common.user;
|
MwWidget h = (MwWidget)handle->common.user;
|
||||||
|
if(MwGetInteger(h, MwNdisabled) == 1) return;
|
||||||
|
|
||||||
MwDispatchUserHandler(h, MwNfocusOutHandler, data);
|
MwDispatchUserHandler(h, MwNfocusOutHandler, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void llclipboardhandler(MwLL handle, void* data) {
|
static void llclipboardhandler(MwLL handle, void* data) {
|
||||||
MwWidget h = (MwWidget)handle->common.user;
|
MwWidget h = (MwWidget)handle->common.user;
|
||||||
|
if(MwGetInteger(h, MwNdisabled) == 1) return;
|
||||||
|
|
||||||
MwDispatch3(h, clipboard, data);
|
MwDispatch3(h, clipboard, data);
|
||||||
MwDispatchUserHandler(h, MwNclipboardHandler, data);
|
MwDispatchUserHandler(h, MwNclipboardHandler, data);
|
||||||
|
|
@ -691,6 +698,7 @@ int MwGetInteger(MwWidget handle, const char* key) {
|
||||||
#endif
|
#endif
|
||||||
if(strcmp(key, MwNdarkTheme) == 0) return inherit_integer(handle, key, 0);
|
if(strcmp(key, MwNdarkTheme) == 0) return inherit_integer(handle, key, 0);
|
||||||
if(strcmp(key, MwNuseMonospace) == 0) return inherit_integer(handle, key, 0);
|
if(strcmp(key, MwNuseMonospace) == 0) return inherit_integer(handle, key, 0);
|
||||||
|
if(strcmp(key, MwNdisabled) == 0) return inherit_integer(handle, key, 0);
|
||||||
}
|
}
|
||||||
return shget(handle->integer, key);
|
return shget(handle->integer, key);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
31
src/draw.c
31
src/draw.c
|
|
@ -38,6 +38,18 @@ static int hex(const char* txt, int len) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void color_set_disabled_if_disabled(MwWidget handle, MwLLColor rgb) {
|
||||||
|
if(MwGetInteger(handle, MwNdisabled) == 1) {
|
||||||
|
MwLLColor c = handle->parent == NULL ? NULL : MwParseColor(handle->parent, MwGetText(handle->parent, MwNbackground));
|
||||||
|
|
||||||
|
if(c != NULL) {
|
||||||
|
rgb->common.red = rgb->common.red + (c->common.red - rgb->common.red) * 0.5;
|
||||||
|
rgb->common.green = rgb->common.green + (c->common.green - rgb->common.green) * 0.5;
|
||||||
|
rgb->common.blue = rgb->common.blue + (c->common.blue - rgb->common.blue) * 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void MwParseColorNoAllocate(const char* text, MwRGB* rgb) {
|
void MwParseColorNoAllocate(const char* text, MwRGB* rgb) {
|
||||||
if(text[0] == '#' && strlen(text) == 4) {
|
if(text[0] == '#' && strlen(text) == 4) {
|
||||||
rgb->red = hex(text + 1, 1);
|
rgb->red = hex(text + 1, 1);
|
||||||
|
|
@ -125,6 +137,7 @@ void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color) {
|
||||||
for(y = 0; y < rect->height; y++) {
|
for(y = 0; y < rect->height; y++) {
|
||||||
MwLLColor col = MwLightenColor(handle, color, -darken, -darken, -darken);
|
MwLLColor col = MwLightenColor(handle, color, -darken, -darken, -darken);
|
||||||
int idx = y * 4;
|
int idx = y * 4;
|
||||||
|
color_set_disabled_if_disabled(handle, col);
|
||||||
data[idx] = col->common.red;
|
data[idx] = col->common.red;
|
||||||
data[idx + 1] = col->common.green;
|
data[idx + 1] = col->common.green;
|
||||||
data[idx + 2] = col->common.blue;
|
data[idx + 2] = col->common.blue;
|
||||||
|
|
@ -204,6 +217,8 @@ void MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int invert
|
||||||
if(rect->width <= 0 || rect->height <= 0) return;
|
if(rect->width <= 0 || rect->height <= 0) return;
|
||||||
|
|
||||||
col = invert ? MwLightenColor(handle, color, -8, -8, -8) : color;
|
col = invert ? MwLightenColor(handle, color, -8, -8, -8) : color;
|
||||||
|
color_set_disabled_if_disabled(handle, col);
|
||||||
|
|
||||||
if(MwGetInteger(handle, MwNmodernLook)) {
|
if(MwGetInteger(handle, MwNmodernLook)) {
|
||||||
MwDrawRectFading(handle, rect, col);
|
MwDrawRectFading(handle, rect, col);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -219,6 +234,9 @@ void MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
|
||||||
MwLLColor darker = MwLightenColor(handle, color, -ColorDiff, -ColorDiff, -ColorDiff);
|
MwLLColor darker = MwLightenColor(handle, color, -ColorDiff, -ColorDiff, -ColorDiff);
|
||||||
MwLLColor lighter = MwLightenColor(handle, color, ColorDiff, ColorDiff, ColorDiff);
|
MwLLColor lighter = MwLightenColor(handle, color, ColorDiff, ColorDiff, ColorDiff);
|
||||||
MwLLColor col = invert ? MwLightenColor(handle, color, -8, -8, -8) : color;
|
MwLLColor col = invert ? MwLightenColor(handle, color, -8, -8, -8) : color;
|
||||||
|
color_set_disabled_if_disabled(handle, col);
|
||||||
|
color_set_disabled_if_disabled(handle, darker);
|
||||||
|
color_set_disabled_if_disabled(handle, lighter);
|
||||||
|
|
||||||
p[0].x = rect->x;
|
p[0].x = rect->x;
|
||||||
p[0].y = rect->y + rect->height / 2;
|
p[0].y = rect->y + rect->height / 2;
|
||||||
|
|
@ -284,8 +302,11 @@ static void MwDrawFrameEx_simple(MwWidget handle, MwRect* rect, MwLLColor color,
|
||||||
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);
|
||||||
p[0].x = rect->x;
|
color_set_disabled_if_disabled(handle, darker);
|
||||||
p[0].y = rect->y;
|
color_set_disabled_if_disabled(handle, lighter);
|
||||||
|
|
||||||
|
p[0].x = rect->x;
|
||||||
|
p[0].y = rect->y;
|
||||||
|
|
||||||
p[1].x = rect->x + rect->width;
|
p[1].x = rect->x + rect->width;
|
||||||
p[1].y = rect->y;
|
p[1].y = rect->y;
|
||||||
|
|
@ -380,6 +401,9 @@ static void MwDrawFrameEx_complex(MwWidget handle, MwRect* rect, MwLLColor color
|
||||||
MwLLColor lighter = same ? MwLightenColor(handle, darker, 0, 0, 0) : MwLightenColor(handle, color, (ColorDiff / 2) - diff, (ColorDiff / 2) - diff, (ColorDiff / 2) - diff);
|
MwLLColor lighter = same ? MwLightenColor(handle, darker, 0, 0, 0) : MwLightenColor(handle, color, (ColorDiff / 2) - diff, (ColorDiff / 2) - diff, (ColorDiff / 2) - diff);
|
||||||
MwRect r = *rect;
|
MwRect r = *rect;
|
||||||
|
|
||||||
|
color_set_disabled_if_disabled(handle, darker);
|
||||||
|
color_set_disabled_if_disabled(handle, lighter);
|
||||||
|
|
||||||
frame_border_complex(handle, rect, lighter, darker, invert, border == 1 ? 1 : (border / 2), diff, same);
|
frame_border_complex(handle, rect, lighter, darker, invert, border == 1 ? 1 : (border / 2), diff, same);
|
||||||
|
|
||||||
if(border > 1) {
|
if(border > 1) {
|
||||||
|
|
@ -416,6 +440,9 @@ void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int invert,
|
||||||
MwLLColor darker = MwLightenColor(handle, color, -ColorDiff, -ColorDiff, -ColorDiff);
|
MwLLColor darker = MwLightenColor(handle, color, -ColorDiff, -ColorDiff, -ColorDiff);
|
||||||
MwLLColor lighter = MwLightenColor(handle, color, ColorDiff, ColorDiff, ColorDiff);
|
MwLLColor lighter = MwLightenColor(handle, color, ColorDiff, ColorDiff, ColorDiff);
|
||||||
MwLLColor col = invert ? MwLightenColor(handle, color, -8, -8, -8) : color;
|
MwLLColor col = invert ? MwLightenColor(handle, color, -8, -8, -8) : color;
|
||||||
|
color_set_disabled_if_disabled(handle, col);
|
||||||
|
color_set_disabled_if_disabled(handle, darker);
|
||||||
|
color_set_disabled_if_disabled(handle, lighter);
|
||||||
|
|
||||||
double deg = 30 * ((direction == MwEAST || direction == MwWEST) ? 2 : 1);
|
double deg = 30 * ((direction == MwEAST || direction == MwWEST) ? 2 : 1);
|
||||||
double c = cos(deg / 180 * M_PI);
|
double c = cos(deg / 180 * M_PI);
|
||||||
|
|
|
||||||
|
|
@ -76,10 +76,22 @@ static MwFLFont assume_ttf(MwWidget handle, MwFLFont ttf) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, int align, MwLLColor color) {
|
void MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text, int align, MwLLColor color) {
|
||||||
MwPoint p = *point;
|
MwPoint p = *point;
|
||||||
char* input = (char*)text;
|
char* input = (char*)text;
|
||||||
char* last = input;
|
char* last = input;
|
||||||
int cp;
|
int cp;
|
||||||
|
MwLLColor fadedColor = NULL;
|
||||||
|
|
||||||
|
if(MwGetInteger(handle, MwNdisabled) == 1) {
|
||||||
|
MwLLColor c = handle->parent == NULL ? NULL : MwParseColor(handle->parent, MwGetText(handle->parent, MwNbackground));
|
||||||
|
|
||||||
|
if(c != NULL) {
|
||||||
|
fadedColor = MwLLAllocColor(handle->lowlevel, color->common.red, color->common.blue, color->common.green);
|
||||||
|
fadedColor->common.red = fadedColor->common.red + (c->common.red - fadedColor->common.red) * 0.5;
|
||||||
|
fadedColor->common.green = fadedColor->common.green + (c->common.green - fadedColor->common.green) * 0.5;
|
||||||
|
fadedColor->common.blue = fadedColor->common.blue + (c->common.blue - fadedColor->common.blue) * 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef TTF
|
#ifdef TTF
|
||||||
if(ttf <= MwFLBuildFont(0xff) && !is_bitmap(handle, ttf)) ttf = assume_ttf(handle, ttf);
|
if(ttf <= MwFLBuildFont(0xff) && !is_bitmap(handle, ttf)) ttf = assume_ttf(handle, ttf);
|
||||||
|
|
@ -122,9 +134,9 @@ void MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text,
|
||||||
|
|
||||||
#ifdef TTF
|
#ifdef TTF
|
||||||
if(MwFLDrawText)
|
if(MwFLDrawText)
|
||||||
if(is_bitmap(handle, ttf) || ttf == NULL || MwFLDrawText(handle, ttf, &p, line, color))
|
if(is_bitmap(handle, ttf) || ttf == NULL || MwFLDrawText(handle, ttf, &p, line, fadedColor ? fadedColor : color))
|
||||||
#endif
|
#endif
|
||||||
bitmap_MwDrawText(handle, &p, line, is_bold(handle, ttf), color);
|
bitmap_MwDrawText(handle, &p, line, is_bold(handle, ttf), fadedColor ? fadedColor : color);
|
||||||
|
|
||||||
p.y += MwTextHeight(handle, ttf, line);
|
p.y += MwTextHeight(handle, ttf, line);
|
||||||
|
|
||||||
|
|
@ -133,6 +145,10 @@ void MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text,
|
||||||
last = input;
|
last = input;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(fadedColor) {
|
||||||
|
MwLLFreeColor(fadedColor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int MwTextWidth(MwWidget handle, MwFLFont ttf, const char* text) {
|
int MwTextWidth(MwWidget handle, MwFLFont ttf, const char* text) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue