diff --git a/include/Mw/Draw.h b/include/Mw/Draw.h
index cc21a3a..0bc267e 100644
--- a/include/Mw/Draw.h
+++ b/include/Mw/Draw.h
@@ -85,9 +85,10 @@ MWDECL void MwDrawTriangle(MwWidget handle, MwRect* rect, MwLLColor color, int i
* @param color Color
* @param invert Invert the 3D border color or not
* @param border Border width
+ * @param diff Difference
* @warning `rect` gets changed to the area of rectangle inside
*/
-MWDECL void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border);
+MWDECL void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff);
/*!
* @brief Creates a pixmap from image
diff --git a/include/Mw/StringDefs.h b/include/Mw/StringDefs.h
index 8725365..c5e87c9 100644
--- a/include/Mw/StringDefs.h
+++ b/include/Mw/StringDefs.h
@@ -28,6 +28,7 @@
#define MwNwaitMS "IwaitMS"
#define MwNhideInput "IhideInput"
#define MwNsingleClickSelectable "IsingleClickSelectable"
+#define MwNflat "Iflat"
#define MwNtitle "Stitle"
#define MwNtext "Stext"
diff --git a/milsko.xml b/milsko.xml
index e8be727..76ad045 100644
--- a/milsko.xml
+++ b/milsko.xml
@@ -64,6 +64,7 @@
+
@@ -438,6 +439,7 @@
+
diff --git a/src/draw.c b/src/draw.c
index a066081..4c4f97e 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -15,7 +15,7 @@ static int get_color_diff(MwWidget handle) {
if(MwGetInteger(handle, MwNmodernLook)) {
return 46;
} else {
- return 96;
+ return 80;
}
}
@@ -128,20 +128,17 @@ void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color) {
void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
if(MwGetInteger(handle, MwNmodernLook)) {
- MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle));
+ MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle), 0);
} else {
- int diff = get_color_diff(handle) / 2;
- MwLLColor col = MwLightenColor(handle, color, diff, diff, diff);
+ int diff = get_color_diff(handle) / 3 * 2;
if(invert) {
- MwDrawFrameEx(handle, rect, col, invert, MwDefaultBorderWidth(handle) / 2);
- MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle) / 2);
+ MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle) / 2, -diff);
+ MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle) / 2, diff);
} else {
- MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle) / 2);
- MwDrawFrameEx(handle, rect, col, invert, MwDefaultBorderWidth(handle) / 2);
+ MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle) / 2, -diff);
+ MwDrawFrameEx(handle, rect, color, invert, MwDefaultBorderWidth(handle) / 2, diff);
}
-
- MwLLFreeColor(col);
}
}
@@ -227,11 +224,11 @@ void MwDrawDiamond(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {
MwLLFreeColor(darker);
}
-void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border) {
+void MwDrawFrameEx(MwWidget handle, MwRect* rect, MwLLColor color, int invert, int border, int diff) {
MwPoint p[6];
int ColorDiff = get_color_diff(handle);
- MwLLColor darker = MwLightenColor(handle, color, -ColorDiff * 3 / 2, -ColorDiff * 3 / 2, -ColorDiff * 3 / 2);
- MwLLColor lighter = MwLightenColor(handle, color, ColorDiff, ColorDiff, ColorDiff);
+ MwLLColor darker = MwLightenColor(handle, color, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff, -ColorDiff * 3 / 2 + diff);
+ MwLLColor lighter = MwLightenColor(handle, color, ColorDiff - diff, ColorDiff - diff, ColorDiff - diff);
p[0].x = rect->x;
p[0].y = rect->y;
diff --git a/src/widget/button.c b/src/widget/button.c
index 805543f..a81ecf8 100644
--- a/src/widget/button.c
+++ b/src/widget/button.c
@@ -4,6 +4,8 @@
static int create(MwWidget handle) {
MwSetDefault(handle);
+ MwSetInteger(handle, MwNflat, 0);
+
return 0;
}
@@ -22,7 +24,13 @@ static void draw(MwWidget handle) {
r.width = MwGetInteger(handle, MwNwidth);
r.height = MwGetInteger(handle, MwNheight);
- MwDrawWidgetBack(handle, &r, base, handle->pressed, MwTRUE);
+ MwDrawWidgetBack(handle, &r, base, handle->pressed, MwGetInteger(handle, MwNflat) ? handle->pressed : 1);
+ if(MwGetInteger(handle, MwNflat) && !handle->pressed) {
+ r.x += MwDefaultBorderWidth(handle);
+ r.y += MwDefaultBorderWidth(handle);
+ r.width -= MwDefaultBorderWidth(handle) * 2;
+ r.height -= MwDefaultBorderWidth(handle) * 2;
+ }
if(px != NULL) {
int ow = r.width;
@@ -61,7 +69,7 @@ static void click(MwWidget handle) {
}
static void prop_change(MwWidget handle, const char* key) {
- if(strcmp(key, MwNtext) == 0 || strcmp(key, MwNpixmap) == 0) MwForceRender(handle);
+ if(strcmp(key, MwNtext) == 0 || strcmp(key, MwNpixmap) == 0 || strcmp(key, MwNflat) == 0) MwForceRender(handle);
}
MwClassRec MwButtonClassRec = {