add disabled widgets
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit

This commit is contained in:
IoIxD 2026-05-22 11:41:08 -07:00
commit 149f99622a
7 changed files with 91 additions and 20 deletions

View file

@ -1,6 +1,6 @@
#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)handle;
@ -51,24 +51,29 @@ void MWAPI resize(MwWidget handle, void* user_data, void* call_data) {
MwVaApply(button,
MwNy, 50 + mh,
MwNwidth, (w - 50 * 2) / 3,
MwNwidth, (w - 50 * 2) / 4,
MwNheight, h - 125 - 50 * 3,
NULL);
MwVaApply(button2,
MwNx, 50 + (w - 50 * 2) / 3,
MwNx, 50 + (w - 50 * 2) / 4,
MwNy, 50 + mh,
MwNwidth, (w - 50 * 2) / 3,
MwNwidth, (w - 50 * 2) / 4,
MwNheight, h - 125 - 50 * 3,
NULL);
MwVaApply(button3,
MwNx, 50 + (w - 50 * 2) / 3 * 2,
MwNx, 50 + (w - 50 * 2) / 4 * 2,
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,
NULL);
MwVaApply(button4,
MwNx, 50 + (w - 50 * 2) / 3 * 0,
MwNy, h - 50 - 125 + mh,
@ -121,6 +126,10 @@ int main() {
MwNbackground, "#66f",
MwNforeground, "#000",
NULL);
button7 = MwVaCreateWidget(MwButtonClass, "button", window, 250, 50, 100, 125,
MwNtext, "disabled",
MwNdisabled, 1,
NULL);
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
MwAddUserHandler(button, MwNactivateHandler, handler_theme, NULL);

View file

@ -202,9 +202,16 @@ int main() {
MwNcolumns, 5,
NULL);
f = frame("Button", -PaddingContent, -PaddingContent, MwButtonClass,
MwNtext, "Press me",
f = frame("Button", -PaddingContent, -PaddingContent, MwBoxClass,
MwNorientation, MwVERTICAL,
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,
MwNbold, 1,
@ -221,11 +228,11 @@ int main() {
MwNorientation, MwVERTICAL,
MwNfixedSize, 16,
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,
MwNorientation, MwVERTICAL,
NULL);
for(j = 0; j < 5; j++) {
for(j = 0; j < 6; j++) {
char buf[32];
sprintf(buf, "%sBox %d", i == 0 ? "Check" : "Radio", j + 1);
MwVaCreateWidget(MwLabelClass, "label", b, 0, 0, 0, 0,