mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-05 00:50:53 +00:00
add MwNfillArea
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
#define MwNshowArrows "IshowArrows"
|
#define MwNshowArrows "IshowArrows"
|
||||||
#define MwNpadding "Ipadding"
|
#define MwNpadding "Ipadding"
|
||||||
#define MwNborderWidth "IborderWidth"
|
#define MwNborderWidth "IborderWidth"
|
||||||
|
#define MwNfillArea "IfillArea"
|
||||||
|
|
||||||
#define MwNtitle "Stitle"
|
#define MwNtitle "Stitle"
|
||||||
#define MwNtext "Stext"
|
#define MwNtext "Stext"
|
||||||
|
|||||||
@@ -488,6 +488,7 @@
|
|||||||
<property name="text" />
|
<property name="text" />
|
||||||
<property name="flat" />
|
<property name="flat" />
|
||||||
<property name="padding" />
|
<property name="padding" />
|
||||||
|
<property name="fillArea" />
|
||||||
</properties>
|
</properties>
|
||||||
</widget>
|
</widget>
|
||||||
<widget name="CheckBox">
|
<widget name="CheckBox">
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ static int create(MwWidget handle) {
|
|||||||
|
|
||||||
MwSetInteger(handle, MwNflat, 0);
|
MwSetInteger(handle, MwNflat, 0);
|
||||||
MwSetInteger(handle, MwNpadding, 0);
|
MwSetInteger(handle, MwNpadding, 0);
|
||||||
|
MwSetInteger(handle, MwNfillArea, 1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -44,18 +45,23 @@ static void draw(MwWidget handle) {
|
|||||||
int ow = r.width;
|
int ow = r.width;
|
||||||
int oh = r.height;
|
int oh = r.height;
|
||||||
|
|
||||||
double sw = (double)ow / px->common.width;
|
if(MwGetInteger(handle, MwNfillArea)) {
|
||||||
double sh = (double)oh / px->common.height;
|
double sw = (double)ow / px->common.width;
|
||||||
|
double sh = (double)oh / px->common.height;
|
||||||
|
|
||||||
if(sw < sh) {
|
if(sw < sh) {
|
||||||
r.width = px->common.width * sw;
|
r.width = px->common.width * sw;
|
||||||
r.height = px->common.height * sw;
|
r.height = px->common.height * sw;
|
||||||
|
} else {
|
||||||
|
r.width = px->common.width * sh;
|
||||||
|
r.height = px->common.height * sh;
|
||||||
|
}
|
||||||
|
r.width -= MwGetInteger(handle, MwNpadding) * 2;
|
||||||
|
r.height -= MwGetInteger(handle, MwNpadding) * 2;
|
||||||
} else {
|
} else {
|
||||||
r.width = px->common.width * sh;
|
r.width = px->common.width;
|
||||||
r.height = px->common.height * sh;
|
r.height = px->common.height;
|
||||||
}
|
}
|
||||||
r.width -= MwGetInteger(handle, MwNpadding) * 2;
|
|
||||||
r.height -= MwGetInteger(handle, MwNpadding) * 2;
|
|
||||||
|
|
||||||
r.x += (double)(ow - r.width) / 2;
|
r.x += (double)(ow - r.width) / 2;
|
||||||
r.y += (double)(oh - r.height) / 2;
|
r.y += (double)(oh - r.height) / 2;
|
||||||
@@ -77,7 +83,7 @@ static void click(MwWidget handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void prop_change(MwWidget handle, const char* key) {
|
static void prop_change(MwWidget handle, const char* key) {
|
||||||
if(strcmp(key, MwNtext) == 0 || strcmp(key, MwNpixmap) == 0 || strcmp(key, MwNflat) == 0 || strcmp(key, MwNpadding) == 0) MwForceRender(handle);
|
if(strcmp(key, MwNtext) == 0 || strcmp(key, MwNpixmap) == 0 || strcmp(key, MwNflat) == 0 || strcmp(key, MwNpadding) == 0 || strcmp(key, MwNfillArea) == 0) MwForceRender(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwButtonClassRec = {
|
MwClassRec MwButtonClassRec = {
|
||||||
|
|||||||
Reference in New Issue
Block a user