forked from pyrite-dev/milsko
wip
This commit is contained in:
parent
251fc41020
commit
f6abf02486
3 changed files with 55 additions and 31 deletions
|
|
@ -142,6 +142,8 @@ static MwWidget child(MwWidget w) {
|
||||||
int main() {
|
int main() {
|
||||||
int i;
|
int i;
|
||||||
MwWidget f, w;
|
MwWidget f, w;
|
||||||
|
MwListBoxPacket* pkt;
|
||||||
|
int index;
|
||||||
|
|
||||||
MwLibraryInit();
|
MwLibraryInit();
|
||||||
|
|
||||||
|
|
@ -173,6 +175,27 @@ int main() {
|
||||||
MwComboBoxAdd(w, -1, "Hello!");
|
MwComboBoxAdd(w, -1, "Hello!");
|
||||||
add(f);
|
add(f);
|
||||||
|
|
||||||
|
f = frame("Entry", -PaddingContent, 24, MwEntryClass, NULL);
|
||||||
|
add(f);
|
||||||
|
|
||||||
|
f = frame("Label", -PaddingContent, -PaddingContent, MwLabelClass,
|
||||||
|
MwNtext, "Epic text",
|
||||||
|
NULL);
|
||||||
|
add(f);
|
||||||
|
|
||||||
|
f = frame("ListBox", -PaddingContent, -PaddingContent, MwListBoxClass,
|
||||||
|
MwNhasHeading, 1,
|
||||||
|
NULL);
|
||||||
|
w = child(f);
|
||||||
|
pkt = MwListBoxCreatePacket();
|
||||||
|
index = MwListBoxPacketInsert(pkt, -1);
|
||||||
|
MwListBoxPacketSet(pkt, index, 0, "Epic title...");
|
||||||
|
index = MwListBoxPacketInsert(pkt, -1);
|
||||||
|
MwListBoxPacketSet(pkt, index, 0, "Hello");
|
||||||
|
MwListBoxInsert(w, -1, pkt);
|
||||||
|
MwListBoxDestroyPacket(pkt);
|
||||||
|
add(f);
|
||||||
|
|
||||||
f = frame("Separator", -PaddingContent, -PaddingContent, MwSeparatorClass, NULL);
|
f = frame("Separator", -PaddingContent, -PaddingContent, MwSeparatorClass, NULL);
|
||||||
add(f);
|
add(f);
|
||||||
|
|
||||||
|
|
|
||||||
11
src/draw.c
11
src/draw.c
|
|
@ -117,6 +117,7 @@ void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color, int rounde
|
||||||
MwRect r = *rect;
|
MwRect r = *rect;
|
||||||
int roundness = MwGetInteger(handle, MwNroundness);
|
int roundness = MwGetInteger(handle, MwNroundness);
|
||||||
double div;
|
double div;
|
||||||
|
if(rect->width < 0 || rect->height < 0) return;
|
||||||
if(roundness == MwDEFAULT) roundness = DEFAULT_ROUNDNESS;
|
if(roundness == MwDEFAULT) roundness = DEFAULT_ROUNDNESS;
|
||||||
if(roundness >= MAX_ROUNDNESS) roundness = MAX_ROUNDNESS;
|
if(roundness >= MAX_ROUNDNESS) roundness = MAX_ROUNDNESS;
|
||||||
div = (roundness <= 10) ? 7. : 10.;
|
div = (roundness <= 10) ? 7. : 10.;
|
||||||
|
|
@ -190,6 +191,8 @@ void MwDrawWidgetBack(MwWidget handle, MwRect* rect, MwLLColor color, int invert
|
||||||
MwLLColor col;
|
MwLLColor col;
|
||||||
MwBool rounded = MwGetInteger(handle, MwNroundness) != MwDEFAULT && MwGetInteger(handle, MwNisRounded) != 0;
|
MwBool rounded = MwGetInteger(handle, MwNroundness) != MwDEFAULT && MwGetInteger(handle, MwNisRounded) != 0;
|
||||||
|
|
||||||
|
if(rect->width < 0 || rect->height < 0) return;
|
||||||
|
|
||||||
if(border) {
|
if(border) {
|
||||||
if(!handle->lowlevel->common.supports_transparency) {
|
if(!handle->lowlevel->common.supports_transparency) {
|
||||||
MwLLColor c = handle->parent == NULL ? NULL : MwParseColor(handle->parent, MwGetText(handle->parent, MwNbackground));
|
MwLLColor c = handle->parent == NULL ? NULL : MwParseColor(handle->parent, MwGetText(handle->parent, MwNbackground));
|
||||||
|
|
@ -287,9 +290,7 @@ static void MwDrawFrameEx_simple(MwWidget handle, MwRect* rect, MwLLColor color,
|
||||||
|
|
||||||
if(roundness == MwDEFAULT) roundness = DEFAULT_ROUNDNESS;
|
if(roundness == MwDEFAULT) roundness = DEFAULT_ROUNDNESS;
|
||||||
if(roundness >= MAX_ROUNDNESS) roundness = MAX_ROUNDNESS;
|
if(roundness >= MAX_ROUNDNESS) roundness = MAX_ROUNDNESS;
|
||||||
if(rounded && rect->height >= (roundness * 2) && rect->width >= (roundness * 2) && roundness > 0) {
|
if(!(rounded && rect->height >= (roundness * 2) && rect->width >= (roundness * 2) && roundness > 0)) {
|
||||||
|
|
||||||
} else {
|
|
||||||
p[0].x = rect->x;
|
p[0].x = rect->x;
|
||||||
p[0].y = rect->y;
|
p[0].y = rect->y;
|
||||||
|
|
||||||
|
|
@ -309,9 +310,7 @@ static void MwDrawFrameEx_simple(MwWidget handle, MwRect* rect, MwLLColor color,
|
||||||
}
|
}
|
||||||
MwLLPolygon(handle->lowlevel, p, 6, invert ? darker : lighter);
|
MwLLPolygon(handle->lowlevel, p, 6, invert ? darker : lighter);
|
||||||
|
|
||||||
if(rounded && rect->height >= (roundness * 2) && rect->width >= (roundness * 2) && roundness > 0) {
|
if(!(rounded && rect->height >= (roundness * 2) && rect->width >= (roundness * 2) && roundness > 0)) {
|
||||||
|
|
||||||
} else {
|
|
||||||
p[0].x = rect->x + rect->width;
|
p[0].x = rect->x + rect->width;
|
||||||
p[0].y = rect->y;
|
p[0].y = rect->y;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ static void draw(MwWidget handle) {
|
||||||
|
|
||||||
len = (r.width - p.x * 2) / w;
|
len = (r.width - p.x * 2) / w;
|
||||||
|
|
||||||
|
if(len >= 0) {
|
||||||
show = malloc(len * 4 + 1);
|
show = malloc(len * 4 + 1);
|
||||||
memset(show, 0, len * 4 + 1);
|
memset(show, 0, len * 4 + 1);
|
||||||
|
|
||||||
|
|
@ -78,6 +79,7 @@ static void draw(MwWidget handle) {
|
||||||
|
|
||||||
free(show);
|
free(show);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MwLLFreeColor(text);
|
MwLLFreeColor(text);
|
||||||
MwLLFreeColor(base);
|
MwLLFreeColor(base);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue