Permalink
Browse files

initial import of luamotif

  • Loading branch information...
mbalmer committed Apr 5, 2012
0 parents commit 137ddc6f0d16df37c87422266a946107bd8dc528
Showing with 2,569 additions and 0 deletions.
  1. +17 −0 GNUmakefile
  2. +27 −0 Makefile
  3. +7 −0 README
  4. +89 −0 buttons.lua
  5. +1,108 −0 constants.c
  6. +14 −0 hello.lua
  7. +39 −0 hello_dialog.lua
  8. +1,054 −0 luamotif.c
  9. +52 −0 luamotif.h
  10. +2 −0 shlib_version
  11. +160 −0 widgets.c
@@ -0,0 +1,17 @@
+SRCS= luamotif.c widgets.c constants.c
+LIB= motif
+
+CFLAGS+= -fPIC -I/usr/include -I${PKGDIR}/include -I/usr/include/lua5.1
+LDADD+= -L${XDIR}/lib -L${PKGDIR}/lib -lXm -lXt -lX11 -lm -lbsd
+
+LIBDIR= ${PKGDIR}/lib/lua/5.1
+
+${LIB}.so: ${SRCS:.c=.o}
+ cc -shared -o ${LIB}.so ${CFLAGS} ${SRCS:.c=.o} ${LDADD}
+ ln -s ${LIB}.so lib${LIB}.so
+
+clean:
+ rm -f *.o *.so
+install:
+ cp motif.so libmotif.so /usr/lib/
+
@@ -0,0 +1,27 @@
+SRCS= luamotif.c widgets.c constants.c
+LIB= motif
+
+OS!= uname
+
+.if ${OS} == "NetBSD"
+XDIR= ${X11ROOTDIR}
+LOCALBASE= /usr/pkg
+LDADD+= -R/usr/lib -R${XDIR}/lib -R${LOCALBASE}/lib
+.else
+XDIR= /usr/X11R6
+LOCALBASE= /usr/local
+.endif
+
+NOLINT= 1
+CFLAGS+= -I${XDIR}/include -I${LOCALBASE}/include
+LDADD+= -L${XDIR}/lib -L${LOCALBASE}/lib -lXm -lXext -lXt -lX11
+
+LIBDIR= ${LOCALBASE}/lib/lua/5.1
+
+libinstall:
+
+install:
+ ${INSTALL} -d ${DESTDIR}${LIBDIR}
+ ${INSTALL} lib${LIB}.so ${DESTDIR}${LIBDIR}/${LIB}.so
+
+.include <bsd.lib.mk>
7 README
@@ -0,0 +1,7 @@
+A Lua Binding for OpenMotif
+
+Copyright (C) Micro Systems Marc Balmer.
+You can reach the author at marc@msys.ch
+
+Makefile is for BSD systems
+GNUmakefile is for Linux systems
@@ -0,0 +1,89 @@
+require "motif"
+
+gui = Form {
+ fractionBase = 3,
+ Frame {
+ topAttachment = ATTACH_FORM,
+ rightAttachment = ATTACH_FORM,
+ bottomAttachment = ATTACH_POSITION,
+ leftAttachment = ATTACH_FORM,
+
+ bottomPosition = 1,
+
+ LabelGadget {
+ labelString = "Motif Buttons in Lua",
+ childType = FRAME_TITLE_CHILD
+ },
+ RowColumn {
+ PushButton {
+ labelString = "Button one",
+ activateCallback = function()
+ print("Button one was pressed")
+ end
+ },
+ PushButton {
+ labelString = "Button two",
+ activateCallback = function()
+ print("Button two was pressed")
+ end
+ },
+ }
+ },
+ TabStack {
+ topAttachment = ATTACH_POSITION,
+ rightAttachment = ATTACH_FORM,
+ bottomAttachment = ATTACH_FORM,
+ leftAttachment = ATTACH_FORM,
+
+ topPosition = 2,
+
+ tabSide = TABS_ON_BOTTOM,
+ tabStyle = TABS_ROUNDED,
+
+ tabCornerPercent = 100,
+ tabMarginHeight = 64,
+ tabMarginWidth = 64,
+
+ products = LabelGadget {
+ labelString = "frame title",
+ },
+ groups = Frame {
+ LabelGadget {
+ labelString = "frame title",
+ childType = FRAME_TITLE_CHILD,
+ },
+ rc = RowColumn {
+ PushButton {
+ labelString = "pushme",
+ activateCallback = function (w)
+ print(tf:GetString())
+ tfield = w:Parent().t
+ print(tfield:GetString())
+ end
+ },
+ t = TextField {
+ activateCallback = function (w)
+ print(w:GetString())
+ end,
+ valueChangedCallback = function (w)
+ print(w:GetString())
+ end,
+ focusCallback = function (w)
+ print("Button down " ..
+ w:GetString())
+ end
+ }
+ }
+ },
+ }
+
+}
+
+tf = gui[2].groups.rc.t
+
+SetLanguageProc(nil, nil, nil)
+toplevel, app = Initialize("XPoS")
+
+Realize(toplevel, gui)
+
+MainLoop(app)
Oops, something went wrong.

0 comments on commit 137ddc6

Please sign in to comment.