diff options
-rw-r--r-- | objectio/.gitignore | 8 | ||||
-rw-r--r-- | objectio/Makefile | 30 | ||||
-rw-r--r-- | objectio/hello.icl | 17 | ||||
-rw-r--r-- | objectio/support_button.icl | 33 | ||||
-rw-r--r-- | objectio/support_check.icl | 23 | ||||
-rw-r--r-- | objectio/support_edit.icl | 37 | ||||
-rw-r--r-- | objectio/support_popup.icl | 30 | ||||
-rw-r--r-- | objectio/tut2_4.icl | 25 | ||||
-rw-r--r-- | objectio/tut6_4_4.icl | 34 | ||||
-rw-r--r-- | objectio/tut7_2_2.icl | 18 |
10 files changed, 255 insertions, 0 deletions
diff --git a/objectio/.gitignore b/objectio/.gitignore new file mode 100644 index 0000000..76cf637 --- /dev/null +++ b/objectio/.gitignore @@ -0,0 +1,8 @@ +* + +!.gitignore +!*.icl +!Makefile + +!*/ + diff --git a/objectio/Makefile b/objectio/Makefile new file mode 100644 index 0000000..13b445c --- /dev/null +++ b/objectio/Makefile @@ -0,0 +1,30 @@ +SHELL=/bin/bash + +CLEANHOME=/opt/clean +CLEANLIB=/opt/clean/lib + +OBJECTIO=/home/camilstaps/Sources/libraries/ObjectIO/ObjectIO +OBJECTIOLINUX=$(OBJECTIO)/OS\ Linux +OBJECTIOCDIR=$(OBJECTIOLINUX)/Linux_C_12 + +CLM=clm +CLM_LIBS=$$(for l in $$(pkg-config --libs gtk+-2.0); do echo -n "-l $$l "; done)-l -lpthread +CLM_INC=-I $(OBJECTIO) -I $(OBJECTIOLINUX) -I $(CLEANLIB)/StdLib +CLM_OPTS=-tst + +ICL=$(wildcard *.icl) +EXE=$(patsubst %.icl,%,$(ICL)) + +all: $(EXE) + +$(EXE): % : %.icl | copy + $(CLM) $(CLM_LIBS) $(CLM_INC) $(CLM_OPTS) $@ -o $@ + +rebuild: clean all + +clean: + rm -rf "Clean System Files" $(EXE) + +copy: + mkdir -p "Clean System Files" + cp $(OBJECTIOCDIR)/*.o "Clean System Files" diff --git a/objectio/hello.icl b/objectio/hello.icl new file mode 100644 index 0000000..1988c6a --- /dev/null +++ b/objectio/hello.icl @@ -0,0 +1,17 @@ +module hello + +import StdEnv, StdIO + +Start :: *World -> *World +Start world = startIO NDI Void initialise [] world +where + initialise pst + # (error,pst) = openDialog Void hello pst + | error <> NoError = closeProcess pst + | otherwise = pst + + hello = Dialog "ObjectIO" controls [WindowClose (noLS closeProcess)] + controls = TextControl "Hello World!" [] :+: + TextControl "Text 2" [] :+: + ButtonControl "Button" [] + diff --git a/objectio/support_button.icl b/objectio/support_button.icl new file mode 100644 index 0000000..973cf72 --- /dev/null +++ b/objectio/support_button.icl @@ -0,0 +1,33 @@ +module support_button + +import StdEnv, StdIO + +Start :: *World -> *World +Start world +# (id, world) = openId world +# buttons = [ + ButtonControl "Function" [ControlFunction (count 1 id)], + ButtonControl "Hide" [ControlHide], + ButtonControl "Id + Width" [ControlId id, ControlWidth (PixelWidth 250)], + ButtonControl "ModsFunction" [ControlModsFunction (modf id)], + ButtonControl "Pos" [ControlPos (Left, zero)], + ButtonControl "SelectState" [ControlSelectState Able], + ButtonControl "SelectState" [ControlSelectState Unable], + ButtonControl "Tip" [ControlTip "Some tip"], + ButtonControl "Width" [ControlWidth (PixelWidth 250)] + ] +# controls = ListLS buttons +# hello = Dialog "Support - ButtonControl" controls [WindowClose (noLS closeProcess)] += startIO NDI Void (initialise hello) [] world +where + initialise hello pst + # (error,pst) = openDialog 0 hello pst + | error <> NoError = closeProcess pst + | otherwise = pst + + count :: Int Id (Int, PSt .l) -> (Int, PSt .l) + count dx id (count,pst=:{io}) = (count + dx, appPIO (setControlText id (toString (count+dx))) pst) + + modf :: Id Modifiers -> (Int, PSt .l) -> (Int, PSt .l) + modf id mods = \(count,pst=:{io}) . (count, appPIO (setControlText id (toString mods)) pst) + diff --git a/objectio/support_check.icl b/objectio/support_check.icl new file mode 100644 index 0000000..032b5de --- /dev/null +++ b/objectio/support_check.icl @@ -0,0 +1,23 @@ +module support_check + +import StdEnv, StdIO + +Start :: *World -> *World +Start world +# (controlid, world) = openId world +# checks = [ + CheckControl [("Item &" +++ toString i, Nothing, if (isOdd i) Mark NoMark, id) \\ i <- [1..5]] (Columns 2) [ControlPos (Left, zero), ControlHide], + CheckControl [("Item &" +++ toString i, Nothing, if (isOdd i) Mark NoMark, id) \\ i <- [1..5]] (Columns 2) [ControlPos (Left, zero), ControlId controlid], + CheckControl [("Item &" +++ toString i, Nothing, if (isOdd i) Mark NoMark, id) \\ i <- [1..5]] (Columns 2) [ControlPos (Left, zero), ControlSelectState Able], + CheckControl [("Item &" +++ toString i, Nothing, if (isOdd i) Mark NoMark, id) \\ i <- [1..5]] (Columns 2) [ControlPos (Left, zero), ControlSelectState Unable], + CheckControl [("Item &" +++ toString i, Nothing, if (isOdd i) Mark NoMark, id) \\ i <- [1..5]] (Columns 2) [ControlPos (Left, zero), ControlTip "Some tip"] + ] +# controls = ListLS checks +# hello = Dialog "Support - CheckControl" controls [WindowClose (noLS closeProcess)] += startIO NDI Void (initialise hello) [] world +where + initialise hello pst + # (error,pst) = openDialog 0 hello pst + | error <> NoError = closeProcess pst + | otherwise = pst + diff --git a/objectio/support_edit.icl b/objectio/support_edit.icl new file mode 100644 index 0000000..a7f23ce --- /dev/null +++ b/objectio/support_edit.icl @@ -0,0 +1,37 @@ +module support_edit + +import StdEnv, StdIO + +Start :: *World -> *World +Start world +# (id, world) = openId world +# edits = let w = PixelWidth 200 in [ + EditControl "Activate" w 3 [ControlActivate (count 1 id)], + EditControl "Deactivate" w 3 [ControlDeactivate (count -1 id)], + EditControl "Hide" w 3 [ControlHide], + EditControl "Id" (PixelWidth 500) 3 [ControlId id], + EditControl "Keyboard" w 3 [ControlKeyboard (\ks . getKeyboardStateKeyState ks <> KeyUp) Able (kbfunc id)], + EditControl "Pos" w 3 [ControlPos (Left, zero)], + EditControl "Resize" w 3 [], //todo + EditControl "SelectState" w 3 [ControlSelectState Able], + EditControl "SelectState" w 3 [ControlSelectState Unable], + EditControl "Tip" w 3 [ControlTip "Some tip"] + ] +# controls = ListLS edits +# hello = Dialog "Support - EditControl" controls [WindowClose (noLS closeProcess)] += startIO NDI Void (initialise hello) [] world +where + initialise hello pst + # (error,pst) = openDialog 0 hello pst + | error <> NoError = closeProcess pst + | otherwise = pst + + count :: Int Id (Int, PSt .l) -> (Int, PSt .l) + count dx id (count,pst=:{io}) = (count + dx, appPIO (setControlText id (toString (count+dx))) pst) + + modf :: Id Modifiers -> (Int, PSt .l) -> (Int, PSt .l) + modf id mods = \(count,pst=:{io}) . (count, appPIO (setControlText id (toString mods)) pst) + + kbfunc :: Id KeyboardState -> (Int, PSt .l) -> (Int, PSt .l) + kbfunc id st = \(c,pst) . (c, appPIO (setControlText id (toString st)) pst) + diff --git a/objectio/support_popup.icl b/objectio/support_popup.icl new file mode 100644 index 0000000..50485b7 --- /dev/null +++ b/objectio/support_popup.icl @@ -0,0 +1,30 @@ +module support_popup + +import StdEnv, StdIO + +Start :: *World -> *World +Start world +# (textid, world) = openId world +# popups = let w = PixelWidth 200 in [ + PopUpControl [("Activate " +++ toString i, id) \\ i <- [1..5]] 1 [ControlActivate (count 1 textid)], // doesn't work yet + PopUpControl [("Deactivate " +++ toString i, id) \\ i <- [1..5]] 2 [ControlDeactivate (count -1 textid)], // doesn't work yet + PopUpControl [("Hide " +++ toString i, id) \\ i <- [1..5]] 1 [ControlHide], + PopUpControl [("Id " +++ toString i, id) \\ i <- [1..5]] 3 [], // todo + PopUpControl [("Pos " +++ toString i, id) \\ i <- [1..5]] 4 [ControlPos (Left, zero)], + PopUpControl [("SelectState " +++ toString i, id) \\ i <- [1..5]] 5 [ControlSelectState Able], + PopUpControl [("SelectState " +++ toString i, id) \\ i <- [1..5]] 1 [ControlSelectState Unable], + PopUpControl [("Tip " +++ toString i, id) \\ i <- [1..5]] 2 [ControlTip "Some tip"], + PopUpControl [("Width " +++ toString i, id) \\ i <- [1..5]] 3 [ControlWidth (PixelWidth 500)] + ] +# controls = ButtonControl "For callbacks" [ControlId textid] :+: ListLS popups +# hello = Dialog "Support - PopUpControl" controls [WindowClose (noLS closeProcess), WindowViewSize {w=1000,h=500}] // because vertical space isn't reserved properly += startIO NDI Void (initialise hello) [] world +where + initialise hello pst + # (error,pst) = openDialog 0 hello pst + | error <> NoError = closeProcess pst + | otherwise = pst + + count :: Int Id (Int, PSt .l) -> (Int, PSt .l) + count dx id (count,pst=:{io}) = (count + dx, appPIO (setControlText id (toString (count+dx))) pst) + diff --git a/objectio/tut2_4.icl b/objectio/tut2_4.icl new file mode 100644 index 0000000..3b26c0a --- /dev/null +++ b/objectio/tut2_4.icl @@ -0,0 +1,25 @@ +module tut2_4 + +// ******************************************************************************** +// Clean tutorial example program. +// +// This program creates a dialog that displays the "Hello world!" text. +// ******************************************************************************** + +import StdEnv, StdIO + +Start :: *World -> *World +Start world + = startIO NDI Void initialise [] world +where + initialise pst + # (error,pst) = openDialog Void hello pst + | error<>NoError = closeProcess pst + | otherwise = pst + + hello = Dialog "" + ( TextControl "Hello world!" [] + ) + [ WindowClose (noLS closeProcess) + ] + diff --git a/objectio/tut6_4_4.icl b/objectio/tut6_4_4.icl new file mode 100644 index 0000000..1e7f4d8 --- /dev/null +++ b/objectio/tut6_4_4.icl @@ -0,0 +1,34 @@ +module tut6_4_4 + +// ******************************************************************************** +// Clean tutorial example program. +// +// This program creates a window that displays a user selected bitmap. +// Make sure that this application has sufficient heap or extra memory. +// ******************************************************************************** + +import StdIO, StdEnv + +Start :: *World -> *World +Start world + # (maybeFile,world) = selectInputFile world + | isNothing maybeFile + = world + # bitmapfile = fromJust maybeFile + # (maybeBitmap,world) = openBitmap bitmapfile world + | isNothing maybeBitmap + = world + | otherwise + # bitmap = fromJust maybeBitmap + bitmapsize = getBitmapSize bitmap + window = Window "Bitmap" NilLS + [ WindowViewSize bitmapsize + , WindowLook True (\_ _->drawAt zero bitmap) + , WindowClose (noLS closeProcess) + ] + = startIO SDI + Void + (snd o openWindow Void window) + [ProcessClose closeProcess] + world + diff --git a/objectio/tut7_2_2.icl b/objectio/tut7_2_2.icl new file mode 100644 index 0000000..57d5e56 --- /dev/null +++ b/objectio/tut7_2_2.icl @@ -0,0 +1,18 @@ +module tut7_2_2 + +import StdEnv, StdIO + +Start :: *World -> *World +Start world = startIO NDI Void initialise [] world +where + initialise pst + # (error,pst) = openDialog Void dialog pst + | error <> NoError = closeProcess pst + | otherwise = pst + + dialog = Dialog "ObjectIO" controls [WindowClose (noLS closeProcess)] + + controls = ListLS [ TextControl label [ControlWidth (ContentWidth maxlabel), ControlPos (Left, zero)] :+: EditControl "" (PixelWidth 100) 1 [] \\ label <- labels] + maxlength = maxList (map size labels) + maxlabel = hd (dropWhile (\l . size l <> maxlength) labels) + labels = [ "Short label" , "Long and too verbose label" , "Medium length label" ] |