Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
initial import of luamotif
Browse files Browse the repository at this point in the history
  • Loading branch information
mbalmer committed Apr 5, 2012
0 parents commit 137ddc6
Show file tree
Hide file tree
Showing 11 changed files with 2,569 additions and 0 deletions.
17 changes: 17 additions & 0 deletions GNUmakefile
@@ -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/

27 changes: 27 additions & 0 deletions Makefile
@@ -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 changes: 7 additions & 0 deletions 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
89 changes: 89 additions & 0 deletions buttons.lua
@@ -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)

0 comments on commit 137ddc6

Please sign in to comment.