summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlejandro Sior <aho@sior.be>2022-08-07 11:53:38 +0200
committerAlejandro Sior <aho@sior.be>2022-08-07 11:53:38 +0200
commit5a11f2675177074db05965e366196166943ed725 (patch)
tree0c36cf32089242863b5257eaf6443b09a76e14f2 /test
parent13c7009df18a4c86086bf270d125d23ee9b849e2 (diff)
cook: add a basic C modules system
Diffstat (limited to 'test')
-rw-r--r--test/.build7
-rw-r--r--test/hai.c1
-rw-r--r--test/hai.h2
-rw-r--r--test/main.c77
4 files changed, 77 insertions, 10 deletions
diff --git a/test/.build b/test/.build
index 8dfcf25..1faa6e9 100644
--- a/test/.build
+++ b/test/.build
@@ -1,5 +1,2 @@
-maino = cc("main.c")
-haio = cc("hai.c")
-hailib = lib("hai", haio)
-
-aout = exe("vol", maino, hailib) \ No newline at end of file
+mod.src("main.c", "hai.c")
+mod.mkdep(libs = ["Mrm", "Uil", "Xm", "Xt"]) \ No newline at end of file
diff --git a/test/hai.c b/test/hai.c
index 263a8de..25c25ae 100644
--- a/test/hai.c
+++ b/test/hai.c
@@ -2,7 +2,6 @@
#include <stdio.h>
-__declspec(dllexport)
void hai() {
printf("lol\n");
} \ No newline at end of file
diff --git a/test/hai.h b/test/hai.h
index 02201d9..da27064 100644
--- a/test/hai.h
+++ b/test/hai.h
@@ -1,4 +1,4 @@
-__declspec(dllexport)
void hai();
+
// test \ No newline at end of file
diff --git a/test/main.c b/test/main.c
index 3763706..f33d282 100644
--- a/test/main.c
+++ b/test/main.c
@@ -1,9 +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) {
- printf("Hello world\n");
- hai();
+ 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);
+
+ 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);
+
+ XtRealizeWidget(toplevel);
+ XtAppMainLoop(app);
return 0;
}