|
35 | 35 | * [View Methods](#view-methods)
|
36 | 36 | * [view:show()](#view_show)
|
37 | 37 | * [view:hide()](#view_hide)
|
| 38 | + * [view:setTitle()](#view_setTitle) |
38 | 39 | * [view:setMinSize()](#view_setMinSize)
|
39 | 40 | * [view:setMaxSize()](#view_setMaxSize)
|
40 | 41 | * [view:setSize()](#view_setSize)
|
41 | 42 | * [view:getSize()](#view_getSize)
|
42 | 43 | * [view:setFrame()](#view_setFrame)
|
43 | 44 | * [view:getFrame()](#view_getFrame)
|
44 |
| - * [view:setEventFunc()](#view_setEventFunc) |
45 | 45 | * [view:getLayoutContext()](#view_getLayoutContext)
|
46 | 46 | * [view:getDrawContext()](#view_getDrawContext)
|
47 | 47 | * [view:getScreenScale()](#view_getScreenScale)
|
|
187 | 187 |
|
188 | 188 | * **<a id="lpugl_MOD_">Key modifier flags</a>**
|
189 | 189 |
|
190 |
| - The current key modifier state (e.g. as delivered in a [BUTTON_PRESS](#event_BUTTON_PRESS) event) |
| 190 | + The current key modifier state (e.g. as delivered in a [*BUTTON_PRESS*](#event_BUTTON_PRESS) event) |
191 | 191 | is an integer value where each key modifier is presented as a bit flag.
|
192 | 192 | You may use the function [lpugl.btest()](#lpugl_btest) for testing which
|
193 | 193 | flags are set in a key modifier state.
|
@@ -246,27 +246,60 @@ TODO
|
246 | 246 | [*view:close()*](#view_close) or if the world becomes garbage collected or is closed
|
247 | 247 | explicitly via [*world:close()*](#world_close)
|
248 | 248 |
|
249 |
| - * *initArgs* - lua table with initial key-value parameters. Can be ommitted, if a |
250 |
| - default backend was set via |
251 |
| - [*world:setDefaultBackend()*](#world_setDefaultBackend), |
252 |
| - otherwise at least a backend must be given. |
| 249 | + * *initArgs* - lua table with initial key-value parameters. |
253 | 250 |
|
254 | 251 | The parameter *initArgs* may contain the following parameters as key value pairs:
|
255 | 252 |
|
256 |
| - * *backend* - backend object to be used for the created view. |
257 |
| - * *title* - title for the created window. |
258 |
| - * *resizable* - *true* if the created window should be resizable. |
259 |
| - * *parent* - optional parent view. If given the created view is embedded |
260 |
| - into the parent view. Otherwise a top level window |
261 |
| - is created. |
262 |
| - * *popupFor* - TODO |
263 |
| - * *transientFor* - TODO |
264 |
| - * *dontMergeRects* - TODO |
265 |
| - |
266 |
| - The parameters *title* and *resizable* have no effect if *parent* or |
267 |
| - *popupFor* is given. |
268 |
| - |
269 |
| - Only one of the parameters *parent*, *popupFor* or *transientFor* can be set. |
| 253 | + * <a id="newView_backend">**`backend = lpuglBackend`**</a> - backend object to be used for the |
| 254 | + created view. Can be ommitted, if a default backend was set via |
| 255 | + [*world:setDefaultBackend()*](#world_setDefaultBackend) |
| 256 | + |
| 257 | + * <a id="newView_title">**`title = titleString`**</a> - optional string, initial title for the |
| 258 | + created window. This parameter should not be set if [*parent*](#newView_parent) or |
| 259 | + [*popupFor*](#newView_popupFor) is given. The title may afterwards be changed using |
| 260 | + [*view:setTitle()*](#view_setTitle). |
| 261 | + |
| 262 | + * <a id="newView_size">**`size = {width, height}`**</a> - optional table containing |
| 263 | + width and height as first and second table entry. Sets the initial size for the new view. |
| 264 | + The size may afterwards be changed using [*view:setSize()*](#view_setSize). |
| 265 | + |
| 266 | + * <a id="newView_resizable">**`resizable = flag`**</a> - *true* if the created window should be |
| 267 | + resizable. This parameter should not be set if [*parent*](#newView_parent) or |
| 268 | + [*popupFor*](#newView_popupFor) is given. |
| 269 | + |
| 270 | + * <a id="newView_parent">**`parent = view`**</a> - optional parent view. If given the created |
| 271 | + view is embedded into the parent view. Otherwise a top level window is created. This parameter |
| 272 | + cannot be combined with [*popupFor*](#newView_popupFor) or [*transientFor*](#newView_transientFor). |
| 273 | + |
| 274 | + * <a id="newView_popupFor">**`popupFor = view`**</a> - TODO - This parameter |
| 275 | + cannot be combined with [*parent*](#newView_parent) or [*transientFor*](#newView_transientFor). |
| 276 | + |
| 277 | + * <a id="newView_transientFor">**`transientFor = view`**</a> - TODO - This parameter |
| 278 | + cannot be combined with [*parent*](#newView_parent) or [*popupFor*](#newView_popupFor). |
| 279 | + |
| 280 | + * <a id="newView_dontMergeRects">**`dontMergeRects = flag`**</a> - TODO |
| 281 | + |
| 282 | + * <a id="newView_eventFunc">**`eventFunc = func | {func, ...}`**</a> - sets a function for |
| 283 | + handling the view's [event processing](#event-processing). The value for *eventFunc* may |
| 284 | + be a function or a table with it's first entry being the event handling function. The other |
| 285 | + entries with index > 1 in this table are context parameters that are given to the |
| 286 | + event handling function for each invocation. |
| 287 | + |
| 288 | + If for the example the event handling function *func* is set up by the following |
| 289 | + invocation: |
| 290 | + ```lua |
| 291 | + view = world:newView { eventFunc = {func, "foo1", "foo2"} } |
| 292 | + ``` |
| 293 | + and if an [mouse motion event](#event_MOTION) for the view at position 100, 200 occurs, then |
| 294 | + *func* will be called with the arguments `"foo1", "foo2", view, "MOTION", 100, 200`. If |
| 295 | + the event handling function is set up without context parameters, e.g.: |
| 296 | + ```lua |
| 297 | + view = world:newView { eventFunc = func } |
| 298 | + ``` |
| 299 | + the above mouse motion event would lead to an invocation of *func* with the arguments |
| 300 | + `view, "MOTION", 100, 200`. |
| 301 | + |
| 302 | + |
270 | 303 |
|
271 | 304 | <!-- ---------------------------------------------------------------------------------------- -->
|
272 | 305 |
|
|
387 | 420 |
|
388 | 421 | * *func* - a error reporting function that takes two arguments: first argument is a string
|
389 | 422 | containing the error message and stack traceback, second argument is the original
|
390 |
| - error object. |
| 423 | + error object that caused the error. |
391 | 424 |
|
392 | 425 | <!-- ---------------------------------------------------------------------------------------- -->
|
393 | 426 |
|
@@ -451,6 +484,13 @@ TODO
|
451 | 484 |
|
452 | 485 | <!-- ---------------------------------------------------------------------------------------- -->
|
453 | 486 |
|
| 487 | +* <a id="view_setTitle">**` view:setTitle(titleString) |
| 488 | + `**</a> |
| 489 | + |
| 490 | + Sets the title of the window. |
| 491 | + |
| 492 | +<!-- ---------------------------------------------------------------------------------------- --> |
| 493 | + |
454 | 494 | * <a id="view_setMinSize">**` view:setMinSize(width, height)
|
455 | 495 | `**</a>
|
456 | 496 |
|
@@ -503,32 +543,6 @@ TODO
|
503 | 543 |
|
504 | 544 | <!-- ---------------------------------------------------------------------------------------- -->
|
505 | 545 |
|
506 |
| -* <a id="view_setEventFunc">**` view:setEventFunc(func, ...) |
507 |
| - `**</a> |
508 |
| - |
509 |
| - Sets an event handling function for a view. |
510 |
| - |
511 |
| - * *func* - an event handling function. This function will be invoked for |
512 |
| - any event that occurs for the view. |
513 |
| - * *...* - optional context parameters: these arguments are given to the event |
514 |
| - handling function for each invocation. |
515 |
| - |
516 |
| - When an event for the view occurs, the function *func* is called with the optional |
517 |
| - context parameters as first arguments. After the context parameters, the event name |
518 |
| - followed by event specific parameters is given. |
519 |
| - |
520 |
| - *Example:* |
521 |
| - * if the event handling function *func* is set by the following invocation: |
522 |
| - |
523 |
| - ```lua |
524 |
| - view:setEventFunc(func, "foo1", "foo2") |
525 |
| - ``` |
526 |
| - and if an mouse motion event for the view at position 100, 200 occurs, then |
527 |
| - *func* will be called with the arguments `"foo1", "foo2", "MOTION", 100, 200` |
528 |
| - |
529 |
| - For further details see [*Event Processing*](#event-processing). |
530 |
| - |
531 |
| -<!-- ---------------------------------------------------------------------------------------- --> |
532 | 546 |
|
533 | 547 | * <a id="view_getLayoutContext">**` view:getLayoutContext()
|
534 | 548 | `**</a>
|
@@ -616,12 +630,12 @@ TODO
|
616 | 630 | <!-- ---------------------------------------------------------------------------------------- -->
|
617 | 631 |
|
618 | 632 | Events for a view object are processed by the event handling function that
|
619 |
| - was set with [*view:setEventFunc()*](#view_setEventFunc). |
| 633 | + was set as [*eventFunc*](#newView_eventFunc) in [*world:newView()*](#world_newView). |
620 | 634 |
|
621 | 635 | When an event for the view occurs, the event handling function is called with the optional
|
622 |
| - context parameters given to [*view:setEventFunc()*](#view_setEventFunc) as first arguments. |
623 |
| - After the context parameters, the event name followed by event specific paramters is given |
624 |
| - to the event handling function. |
| 636 | + context parameters given to [*eventFunc*](#newView_eventFunc) as first arguments. |
| 637 | + After the context parameters, the view and then the event name followed by event specific |
| 638 | + paramaters are given to the event handling function. |
625 | 639 |
|
626 | 640 | The event handling function is called with the following possible events (event names
|
627 | 641 | followed by event specific parameters):
|
|
650 | 664 | otherwise configure the context, but not to draw anything.
|
651 | 665 |
|
652 | 666 | * *x, y* - new position, parent-relative if the view is embedded into a parent view (i.e.
|
653 |
| - *parent* was given in [world:newView()](#world_newView)). Otherwise the position |
| 667 | + *parent* was given in [*world:newView()*](#world_newView)). Otherwise the position |
654 | 668 | is in absolute screen coordinates (the view is a top level window or popup in
|
655 | 669 | these cases).
|
656 | 670 | * *width*, *height* - new width and height
|
|
0 commit comments