diff options
author | David Walter Seikel | 2014-03-29 00:28:00 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-03-29 00:28:00 +1000 |
commit | 89be8fb2358e81bfa40b6c520c5bea9178fb230d (patch) | |
tree | 29f5c9511fab4c8f712504a86a40802e2ad1c83f | |
parent | Stuff things in the Thing to. (diff) | |
download | SledjHamr-89be8fb2358e81bfa40b6c520c5bea9178fb230d.zip SledjHamr-89be8fb2358e81bfa40b6c520c5bea9178fb230d.tar.gz SledjHamr-89be8fb2358e81bfa40b6c520c5bea9178fb230d.tar.bz2 SledjHamr-89be8fb2358e81bfa40b6c520c5bea9178fb230d.tar.xz |
Combine and improve the widget TODOs.
-rw-r--r-- | ClientHamr/GuiLua/skang.lua | 57 |
1 files changed, 25 insertions, 32 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index b6de7c9..b6af22d 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua | |||
@@ -257,6 +257,7 @@ Other Thing things are - | |||
257 | --[[ TODO | 257 | --[[ TODO |
258 | NOTE that skang.thing{} doesn't care what other names you pass in, they all get assigned to the thing. | 258 | NOTE that skang.thing{} doesn't care what other names you pass in, they all get assigned to the thing. |
259 | 259 | ||
260 | |||
260 | Multiple copies of modules - | 261 | Multiple copies of modules - |
261 | skang.new(test, 'pre') | 262 | skang.new(test, 'pre') |
262 | local result = {} | 263 | local result = {} |
@@ -287,6 +288,7 @@ Other Thing things are - | |||
287 | skang.things.foo.value | 288 | skang.things.foo.value |
288 | skang.things.pre_foo.value | 289 | skang.things.pre_foo.value |
289 | 290 | ||
291 | |||
290 | Stuff - | 292 | Stuff - |
291 | test{'foo', key='blah', field0='something', field1=1, ...} -> skang.things.foo.key='blah' skang.things.foo.field='something' ... | 293 | test{'foo', key='blah', field0='something', field1=1, ...} -> skang.things.foo.key='blah' skang.things.foo.field='something' ... |
292 | test{'foo', bar='...', baz='..'} -> __call(test, {'foo', ...}) -> skang.stuff{'foo', ...} | 294 | test{'foo', bar='...', baz='..'} -> __call(test, {'foo', ...}) -> skang.stuff{'foo', ...} |
@@ -307,11 +309,29 @@ Other Thing things are - | |||
307 | skang.things.foo.things.field1 | 309 | skang.things.foo.things.field1 |
308 | test.foo[blah].field1 | 310 | test.foo[blah].field1 |
309 | 311 | ||
310 | Widgets - | 312 | |
311 | Use generic positional / named arguments for widget to, then we can do - | 313 | Widget - |
312 | widget.button{'Cancel', 0.5, 0.5, 1, 0, look='cancel.edj', colour={1, 2, 3, 4}, action='...'} | 314 | Merging widgets might work to. B-) |
313 | Using the Thing alias stuff, maybe we can do the "first stage tokenise" step after all - | 315 | This does make the entire "Things with the same name link automatically" deal work easily, since they ARE the same Thing. |
314 | widget.button{'Cancel', 0.5, 0.5, 1, 0, l='cancel.edj', c={b=20}, a='...'} | 316 | |
317 | Widgets get a type as well, which would be label, button, edit, grid, etc. | ||
318 | A grid could even have sub types - grid,number,string,button,date. B-) | ||
319 | A required widget might mean that the window HAS to have one. | ||
320 | Default for a widget could be the default creation arguments - '"Press me", 1, 1, 10, 50'. | ||
321 | |||
322 | skang.thing('foo,s,fooAlias', 'Foo is a bar, not the drinking type.', function () print('foo') end, '', '"button", "The foo :"' 1, 1, 10, 50') | ||
323 | myButton = skang.widget('foo') -- Gets the default widget creation arguments. | ||
324 | myButton:colour(1, 2, 3, 4) | ||
325 | -- Use generic positional / named arguments for widget to, then we can do - | ||
326 | myEditor = skang.widget{'foo', "edit", "Edit foo :", 5, 15, 10, 100, look='edit.edj', colour={blue=20}, action='...'} | ||
327 | -- Using the Thing alias stuff, maybe we can do the "first stage tokenise" step after all - | ||
328 | myEditor = skang.widget{'foo', "edit", "Edit foo :", 5, 15, 10, 100, l='edit.edj', c={b=20}, a='...'} | ||
329 | myEditor:colour(1, 2, 3, 4, 5, 6, 7, 8) | ||
330 | myButton = 'Not default' -- myEditor and foo change to. Though now foo is a command, not a parameter, so maybe don't change that. | ||
331 | -- Though the 'quit' Thing could have a function that does quitting, this is just an example of NOT linking to a Thing. | ||
332 | -- If we had linked to this theoretical 'quit' Thing, then pushing that Quit button would invoke it's Thing function. | ||
333 | quitter = skang.widget(nil, 'button', 'Quit', 0.5, 0.5, 0.5, 0.5) | ||
334 | quitter:action('quit') | ||
315 | ]] | 335 | ]] |
316 | 336 | ||
317 | -- Default things values. | 337 | -- Default things values. |
@@ -501,33 +521,6 @@ thing = function (names, ...) | |||
501 | if new then thing.module[name] = thing.default end | 521 | if new then thing.module[name] = thing.default end |
502 | end | 522 | end |
503 | 523 | ||
504 | --[[ TODO - It might be worth it to combine parameters and commands, since in Lua, functions are first class types like numbers and strings. | ||
505 | Merging widgets might work to. B-) | ||
506 | This does make the entire "Things with the same name link automatically" deal work easily, since they ARE the same Thing. | ||
507 | |||
508 | Parameter gets a type, which might help since Lua is untyped, versus Java being strongly typed. | ||
509 | Widgets get a type as well, which would be label, button, edit, grid, etc. | ||
510 | A grid could even have sub types - grid,number,string,button,date. B-) | ||
511 | |||
512 | Required commands makes no sense, but can just be ignored. | ||
513 | A required widget might mean that the window HAS to have one. | ||
514 | |||
515 | Default for a command would be the actual function. | ||
516 | Default being a function makes this Thing a command. | ||
517 | Default for a widget could be the default creation arguments - '"Press me", 1, 1, 10, 50' | ||
518 | |||
519 | skang.thing(_M, 'foo,s,fooAlias', 'Foo is a bar, not the drinking type.', function () print('foo') end, nil, '"button", "The foo :"' 1, 1, 10, 50') | ||
520 | myButton = skang.widget('foo') -- Gets the default widget creation arguments. | ||
521 | myButton:colour(1, 2, 3, 4) | ||
522 | myEditor = skang.widget('foo', "edit", "Edit foo :", 5, 15, 10, 100) | ||
523 | myEditor:colour(1, 2, 3, 4, 5, 6, 7, 8) | ||
524 | myButton = 'Not default' -- myEditor and _M.foo change to. Though now _M.foo is a command, not a parameter, so maybe don't change that. | ||
525 | -- Though the 'quit' Thing could have a function that does quitting, this is just an example of NOT linking to a Thing. | ||
526 | -- If we had linked to this theoretical 'quit' Thing, then pushing that Quit button would invoke it's Thing function. | ||
527 | quitter = skang.widget(nil, 'button', 'Quit', 0.5, 0.5, 0.5, 0.5) | ||
528 | quitter:action('quit') | ||
529 | ]] | ||
530 | |||
531 | 524 | ||
532 | -- TODO - Some function stubs, for now. Fill them up later. | 525 | -- TODO - Some function stubs, for now. Fill them up later. |
533 | nada = function () end | 526 | nada = function () end |