diff options
Diffstat (limited to 'ClientHamr')
-rw-r--r-- | ClientHamr/GuiLua/skang.lua | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index d20d122..67df94b 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua | |||
@@ -883,7 +883,7 @@ client. Mostly it all happenes automatically through the ACLs. | |||
883 | Bouncer is the Java skang security manager, it extended the Java | 883 | Bouncer is the Java skang security manager, it extended the Java |
884 | SecurityManager. Lua has no such thing, though C code running stuff in | 884 | SecurityManager. Lua has no such thing, though C code running stuff in |
885 | a sandbox does a similar job. Fascist is the Java security supervisor, | 885 | a sandbox does a similar job. Fascist is the Java security supervisor, |
886 | again should go inot the C sandbox. | 886 | again should go into the C sandbox. |
887 | 887 | ||
888 | Human is used for authenticating a human, Puter for authenticating a | 888 | Human is used for authenticating a human, Puter for authenticating a |
889 | computer, Suits for corporate style authentication, and they all | 889 | computer, Suits for corporate style authentication, and they all |
@@ -926,7 +926,7 @@ access to the module. | |||
926 | 926 | ||
927 | 927 | ||
928 | --[[ TODO | 928 | --[[ TODO |
929 | NOTE that skang.thing{} doesn't care what other names you pass in, they all get assigned to the thing. | 929 | NOTE that skang.thingasm{} doesn't care what other names you pass in, they all get assigned to the Thing. |
930 | 930 | ||
931 | 931 | ||
932 | Widget - | 932 | Widget - |
@@ -934,7 +934,7 @@ access to the module. | |||
934 | of creating widgets via introspection. Should also allow access to | 934 | of creating widgets via introspection. Should also allow access to |
935 | widget internals via table access. Lua code could look like this - | 935 | widget internals via table access. Lua code could look like this - |
936 | 936 | ||
937 | foo = widget.label(0, "0.1", 0.5, 0, 'Text goes here :") | 937 | foo = widget('label', 0, "0.1", 0.5, 0, 'Text goes here :") |
938 | -- Method style. | 938 | -- Method style. |
939 | foo:colour(255, 255, 255, 0, 0, 100, 255, 0) | 939 | foo:colour(255, 255, 255, 0, 0, 100, 255, 0) |
940 | foo:hide() | 940 | foo:hide() |
@@ -945,23 +945,14 @@ access to the module. | |||
945 | foo.look('some/edje/file/somewhere.edj') | 945 | foo.look('some/edje/file/somewhere.edj') |
946 | foo.help = 'This is a widget for labelling some foo.' | 946 | foo.help = 'This is a widget for labelling some foo.' |
947 | 947 | ||
948 | For widgets with "rows", which was handled by Stuff in skang, we could | ||
949 | maybe use the Lua concat operator via metatable. I think that works by | ||
950 | having the widget (a table) on one side of the concat or the other, and | ||
951 | the metatable function gets passed left and right sides, then must | ||
952 | return the result. Needs some experimentation, but this might look like | ||
953 | this - | ||
954 | |||
955 | this.bar = this.bar .. 'new choice' | ||
956 | this.bar = 'new first choice' .. this.bar | ||
957 | |||
958 | |||
959 | Widgets get a type as well, which would be label, button, edit, grid, etc. | 948 | Widgets get a type as well, which would be label, button, edit, grid, etc. |
960 | A grid could even have sub types - grid,number,string,button,date. B-) | 949 | A grid could even have sub types - grid,number,string,button,date. |
961 | A required widget might mean that the window HAS to have one. | 950 | A required widget might mean that the window HAS to have one. |
962 | Default for a widget could be the default creation arguments - '"Press me", 1, 1, 10, 50'. | 951 | Default for a widget could be the default creation arguments - '"Press me", 1, 1, 10, 50'. |
963 | 952 | ||
964 | skang.thing('foo,s,fooAlias', 'Foo is a bar, not the drinking type.', function () print('foo') end, '', '"button", "The foo :"' 1, 1, 10, 50') | 953 | skang.thingasm{'myButton', types='Button', rectangle={1, 1, 10, 50}, title='Press me', ...} |
954 | |||
955 | skang.thingasm('foo,s,fooAlias', 'Foo is a bar, not the drinking type.', function () print('foo') end, '', '"button", "The foo :"' 1, 1, 10, 50') | ||
965 | myButton = skang.widget('foo') -- Gets the default widget creation arguments. | 956 | myButton = skang.widget('foo') -- Gets the default widget creation arguments. |
966 | myButton:colour(1, 2, 3, 4) | 957 | myButton:colour(1, 2, 3, 4) |
967 | -- Use generic positional / named arguments for widget to, then we can do - | 958 | -- Use generic positional / named arguments for widget to, then we can do - |
@@ -975,7 +966,18 @@ access to the module. | |||
975 | quitter = skang.widget(nil, 'button', 'Quit', 0.5, 0.5, 0.5, 0.5) | 966 | quitter = skang.widget(nil, 'button', 'Quit', 0.5, 0.5, 0.5, 0.5) |
976 | quitter:action('quit') | 967 | quitter:action('quit') |
977 | 968 | ||
978 | coordinates and sizes | 969 | For widgets with "rows", which was handled by Stuff in skang, we could |
970 | maybe use the Lua concat operator via metatable. I think that works by | ||
971 | having the widget (a table) on one side of the concat or the other, and | ||
972 | the metatable function gets passed left and right sides, then must | ||
973 | return the result. Needs some experimentation, but it might look like | ||
974 | this - | ||
975 | |||
976 | this.bar = this.bar .. 'new choice' | ||
977 | this.bar = 'new first choice' .. this.bar | ||
978 | |||
979 | |||
980 | coordinates and sizes - | ||
979 | 981 | ||
980 | Originally skang differentiated between pixels and character cells, | 982 | Originally skang differentiated between pixels and character cells, |
981 | using plain integers to represent pixels, and _123 to represent | 983 | using plain integers to represent pixels, and _123 to represent |
@@ -1000,8 +1002,8 @@ access to the module. | |||
1000 | Another idea for relative numbers could be to have a coord object with | 1002 | Another idea for relative numbers could be to have a coord object with |
1001 | various methods, so we could have something like - | 1003 | various methods, so we could have something like - |
1002 | 1004 | ||
1003 | widget:bottom(-10):right(5) -- 10 pixels below the bottom of widget, 5 pixels to the right of the right edge of widget. | 1005 | button:bottom(-10):right(5) -- 10 pixels below the bottom of button, 5 pixels to the right of the right edge of button. |
1004 | widget:width("12") -- 12 characters longer than the width of widget. | 1006 | button:width("12") -- 12 characters longer than the width of button. |
1005 | 1007 | ||
1006 | 1008 | ||
1007 | Squeal - | 1009 | Squeal - |
@@ -1010,26 +1012,25 @@ access to the module. | |||
1010 | database stuff for now, but should keep it in mind. | 1012 | database stuff for now, but should keep it in mind. |
1011 | For SquealStuff, the metadata would be read from the SQL database automatically. | 1013 | For SquealStuff, the metadata would be read from the SQL database automatically. |
1012 | 1014 | ||
1013 | squeal.database('db', 'host', 'someDb', 'user', 'password') -> Should return a module. | 1015 | squeal.database('db', 'host', 'someDb', 'user', 'password') -> Should return a Squeal Thing. |
1014 | local db = require 'someDbThing' -> Same as above, only the database details are encodode in the someDbThing source, OR come from someDbThing.properties. | 1016 | local db = require 'someDbThing' -> Same as above, only the database details are encodode in the someDbThing source, OR come from someDbThing.properties. |
1015 | db:getTable('stuff', 'someTable') -> Grabs the metadata, but not the rows. | 1017 | db:getTable('stuff', 'someTable') -> Grabs the metadata, but not the rows. |
1016 | db:read('stuff', 'select * from someTable'} -> Fills stuff up with several rows, including setting up the metadata for the columns. | 1018 | db:read('stuff', 'select * from someTable'} -> Fills stuff up with several rows, including setting up the metadata for the columns. |
1017 | stuff[1].field1 -> Is a Thing, with a stuff in the stuff metatable, that was created automatically from the database meta data. | 1019 | stuff[1].field1 -> Is a Thing, with a proper metatable, that was created automatically from the database meta data. |
1018 | stuff:read('someIndex') -> Grabs a single row that has the key 'someIndex', or perhaps multiple rows since this might have SQL under it. | 1020 | stuff:read('someIndex') -> Grabs a single row that has the key 'someIndex', or perhaps multiple rows since this might have SQL under it. |
1019 | stuff = db:read('stuff', 'select * from someTable where key='someIndex') | 1021 | stuff = db:read('stuff', 'select * from someTable where key='someIndex') |
1020 | 1022 | ||
1021 | stuff:write() -> Write all rows to the database table. | 1023 | stuff:write() -> Write all rows to the database table. |
1022 | stuff:write(1) -> Write one row to the database table. | 1024 | stuff:write(1) -> Write one row to the database table. |
1023 | stuff:stuff('field1').isValid = someFunction -- Should work, all stuff[key] shares the same stuff. | 1025 | stuff:stuff('field1').isValid = someFunction -- Should work, all stuff[key] share the same Thing description. |
1024 | stuff:isValid(db) -> Validate the entire stuff against it's metadata at least. | 1026 | stuff:isValid(db) -> Validate the entire Thing against it's metadata at least. |
1025 | window.stuff = stuff -> Window gets stuff as it's default stuff, any widgets with same names as the table fields get linked. | 1027 | window.stuff = stuff -> Window gets stuff as it's default 'Keyed' table, any widgets with same names as the table fields get linked. |
1026 | grid.stuff = stuff -> Replace contents of this grid widget with data from all the rows in stuff. | 1028 | grid.stuff = stuff -> Replace contents of this grid widget with data from all the rows in stuff. |
1027 | choice.stuff = stuff -> As in grid, but only using the keys. | 1029 | choice.stuff = stuff -> As in grid, but only using the keys. |
1028 | widget.stuff = stuff:stuff('field1') -> This widget gets a particular stufflet. | 1030 | widget.stuff = stuff:stuff('field1') -> This widget gets a particular stufflet. |
1029 | widget would have to look up getmetatable(window.stuff).parent. Or maybe this should work some other way? | 1031 | widget would have to look up getmetatable(window.stuff).parent. Or maybe this should work some other way? |
1030 | 1032 | ||
1031 | In all these cases above, stuff is a table that has a Thing metatable, so it has stuff. | 1033 | In all these cases above, stuff is a 'Keyed' table that has a Thing metatable, so it has sub Things. |
1032 | It is also a Stuff. | ||
1033 | Should include some way of specifyings details like key name, where string, etc. | 1034 | Should include some way of specifyings details like key name, where string, etc. |
1034 | getmetatable(stuff).__keyName | 1035 | getmetatable(stuff).__keyName |
1035 | getmetatable(stuff).__squeal.where | 1036 | getmetatable(stuff).__squeal.where |