This commit is contained in:
parent
4dc670850d
commit
6db3d83945
3 changed files with 20 additions and 4 deletions
|
|
@ -36,6 +36,7 @@ int main() {
|
||||||
|
|
||||||
sw = MwVaCreateWidget(MwSubWindowClass, "swnd", w, i * Shift, i * Shift, 128, 128,
|
sw = MwVaCreateWidget(MwSubWindowClass, "swnd", w, i * Shift, i * Shift, 128, 128,
|
||||||
MwNtitle, buf,
|
MwNtitle, buf,
|
||||||
|
MwNiconPixmap, px[rand() % 6],
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
f = MwSubWindowGetFrame(sw);
|
f = MwSubWindowGetFrame(sw);
|
||||||
|
|
|
||||||
|
|
@ -622,7 +622,7 @@ void MwSetText(MwWidget handle, const char* key, const char* value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MwSetVoid(MwWidget handle, const char* key, void* value) {
|
void MwSetVoid(MwWidget handle, const char* key, void* value) {
|
||||||
if(strcmp(key, MwNiconPixmap) == 0) {
|
if(IsFirstVisible(handle) && strcmp(key, MwNiconPixmap) == 0) {
|
||||||
MwLLSetIcon(handle->lowlevel, value);
|
MwLLSetIcon(handle->lowlevel, value);
|
||||||
} else if(strcmp(key, MwNsizeHints) == 0) {
|
} else if(strcmp(key, MwNsizeHints) == 0) {
|
||||||
MwSizeHints* sz = value;
|
MwSizeHints* sz = value;
|
||||||
|
|
|
||||||
|
|
@ -290,8 +290,10 @@ static void draw(MwWidget handle) {
|
||||||
MwLLColor c = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
MwLLColor c = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||||
MwLLColor tb = MwParseColor(handle, MwGetText(handle, MwNtitleBackground));
|
MwLLColor tb = MwParseColor(handle, MwGetText(handle, MwNtitleBackground));
|
||||||
MwLLColor tf = MwParseColor(handle, MwGetText(handle, MwNtitleForeground));
|
MwLLColor tf = MwParseColor(handle, MwGetText(handle, MwNtitleForeground));
|
||||||
MwRect r, r2;
|
MwRect r, r2, r3;
|
||||||
const char* title = MwGetText(handle, MwNtitle);
|
const char* title = MwGetText(handle, MwNtitle);
|
||||||
|
int incr = 0;
|
||||||
|
MwLLPixmap px = MwGetVoid(handle, MwNiconPixmap);
|
||||||
|
|
||||||
r.x = 0;
|
r.x = 0;
|
||||||
r.y = 0;
|
r.y = 0;
|
||||||
|
|
@ -305,9 +307,22 @@ static void draw(MwWidget handle) {
|
||||||
r2.height = TitleHeight;
|
r2.height = TitleHeight;
|
||||||
MwDrawRect(handle, &r2, tb);
|
MwDrawRect(handle, &r2, tb);
|
||||||
|
|
||||||
|
if(px != NULL) {
|
||||||
|
r3 = r2;
|
||||||
|
incr = (TitleHeight - ButtonSize) / 2;
|
||||||
|
|
||||||
|
r3.x += incr;
|
||||||
|
r3.y += incr;
|
||||||
|
r3.width = ButtonSize;
|
||||||
|
r3.height = ButtonSize;
|
||||||
|
MwLLDrawPixmap(handle->lowlevel, &r3, px);
|
||||||
|
|
||||||
|
incr += ButtonSize;
|
||||||
|
}
|
||||||
|
|
||||||
if(title != NULL) {
|
if(title != NULL) {
|
||||||
MwPoint p;
|
MwPoint p;
|
||||||
p.x = r2.x + (TitleHeight - ButtonSize) / 2;
|
p.x = r2.x + (TitleHeight - ButtonSize) / 2 + incr;
|
||||||
p.y = r2.y + TitleHeight / 2;
|
p.y = r2.y + TitleHeight / 2;
|
||||||
handle->bgcolor = tb;
|
handle->bgcolor = tb;
|
||||||
MwDrawText(handle, NULL, &p, title, MwALIGNMENT_BEGINNING, tf);
|
MwDrawText(handle, NULL, &p, title, MwALIGNMENT_BEGINNING, tf);
|
||||||
|
|
@ -343,7 +358,7 @@ static void parent_resize(MwWidget handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void prop_change(MwWidget handle, const char* key) {
|
static void prop_change(MwWidget handle, const char* key) {
|
||||||
if(strcmp(key, MwNtitle) == 0) MwForceRender(handle);
|
if(strcmp(key, MwNtitle) == 0 || strcmp(key, MwNiconPixmap) == 0) MwForceRender(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static MwWidget mwSubWindowGetFrameImpl(MwWidget handle) {
|
static MwWidget mwSubWindowGetFrameImpl(MwWidget handle) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue