diff options
| author | Alejandro Sior <aho@sior.be> | 2022-08-06 10:50:56 +0200 |
|---|---|---|
| committer | Alejandro Sior <aho@sior.be> | 2022-08-06 10:50:56 +0200 |
| commit | 83e7d98e5ac459d5d40b142dbd66ce63ef1aa983 (patch) | |
| tree | a8476aa37ce511c5f98ad8d502bea5597baa0bba /test | |
| parent | 88d707bd8043b2257d2fc6498dc76defa0164793 (diff) | |
cook: rudimentary handling of libraries
Diffstat (limited to 'test')
| -rw-r--r-- | test/.build | 4 | ||||
| -rw-r--r-- | test/hai.h | 3 | ||||
| -rw-r--r-- | test/main.c | 82 | ||||
| -rw-r--r-- | test/test.S | 6 |
4 files changed, 78 insertions, 17 deletions
diff --git a/test/.build b/test/.build index 06f704a..2f4b0c1 100644 --- a/test/.build +++ b/test/.build @@ -1,2 +1,2 @@ -obj = cc("main.c", "test.S") -aout = ld("a.out", obj)
\ No newline at end of file +obj = cc("main.c") +aout = ld("a.out", obj, libs=["Xm", "Xt"])
\ No newline at end of file diff --git a/test/hai.h b/test/hai.h deleted file mode 100644 index 12e75bc..0000000 --- a/test/hai.h +++ /dev/null @@ -1,3 +0,0 @@ -int varchanged = 4; - -// header changed!
\ No newline at end of file diff --git a/test/main.c b/test/main.c index fd0dc26..f33d282 100644 --- a/test/main.c +++ b/test/main.c @@ -1,10 +1,80 @@ + #include <stdio.h> -#include "hai.h" +#include <Xm/Xm.h> +#include <Xm/MainW.h> +#include <Xm/PushB.h> +#include <Xm/ArrowB.h> +#include <Xm/RowColumn.h> +#include <Xm/Form.h> + +int lol() { + printf("yes!\n"); +} + +int main(int argc, char **argv) { + XtAppContext app; + Widget toplevel = XtVaAppInitialize(&app, "Demo", NULL, 0, &argc, argv, NULL, NULL); + + /*Widget mainw = XtVaCreateManagedWidget("main_window", + xmMainWindowWidgetClass, toplevel, + XmNscrollBarDisplayPolicy, XmAS_NEEDED, + XmNscrollingPolicy, XmAUTOMATIC, + NULL); + + XmString file = XmStringCreateLocalized("File"); + XmString edit = XmStringCreateLocalized("Edit"); + Widget menu = XmVaCreateSimpleMenuBar(mainw, "menubar", + XmVaCASCADEBUTTON, file, 'F', + XmVaCASCADEBUTTON, edit, 'E', + NULL); + XmStringFree(edit); + XmStringFree(file); + + XtManageChild(menu); */ + + Widget form = XmVaCreateForm(toplevel, "form", + XmNfractionBase, 90, + NULL); + XtManageChild(form); + + Widget left = XmVaCreateArrowButton(form, "voldown", + XmNarrowDirection, XmARROW_LEFT, + XmNtopAttachment, XmATTACH_FORM, + XmNleftAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_POSITION, + XmNrightPosition, 30, + NULL); + XtAddCallback(left, XmNactivateCallback, (XtCallbackProc)lol, NULL); + XtAddCallback(left, XmNdisarmCallback, (XtCallbackProc)lol, NULL); + XtManageChild(left); + + + Widget pb = XmVaCreatePushButton(form, "Volume", + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, left, + XmNtopAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_POSITION, + XmNrightPosition, 60, + NULL); + XtAddCallback(pb, XmNactivateCallback, (XtCallbackProc)lol, NULL); + XtManageChild(pb); -int test(); + Widget right = XmVaCreateArrowButton(form, "volup", + XmNarrowDirection, XmARROW_RIGHT, + XmNleftAttachment, XmATTACH_WIDGET, + XmNleftWidget, pb, + XmNrightAttachment, XmATTACH_FORM, + XmNtopAttachment, XmATTACH_FORM, + XmNbottomAttachment, XmATTACH_FORM, + NULL); + XtAddCallback(right, XmNactivateCallback, (XtCallbackProc)lol, NULL); + XtAddCallback(right, XmNdisarmCallback, (XtCallbackProc)lol, NULL); + XtManageChild(right); -int main() { - printf("test returned: %d\n", test()); - return 0; -}
\ No newline at end of file + XtRealizeWidget(toplevel); + XtAppMainLoop(app); + return 0; +} diff --git a/test/test.S b/test/test.S deleted file mode 100644 index 875ab58..0000000 --- a/test/test.S +++ /dev/null @@ -1,6 +0,0 @@ -.code64 - -.global test -test: - mov $69, %rax - ret
\ No newline at end of file |
