diff --git a/LUA_API.rst b/LUA_API.rst index 76f6454f4..49e205235 100644 --- a/LUA_API.rst +++ b/LUA_API.rst @@ -724,15 +724,20 @@ can be omitted. Gui module ---------- -* ``dfhack.gui.getCurViewscreen()`` +* ``dfhack.gui.getCurViewscreen([skip_dismissed])`` - Returns the viewscreen that is current in the core. + Returns the topmost viewscreen. If ``skip_dismissed`` is *true*, + ignores screens already marked to be removed. * ``dfhack.gui.getFocusString(viewscreen)`` Returns a string representation of the current focus position in the ui. The string has a "screen/foo/bar/baz..." format. +* ``dfhack.gui.getCurFocus([skip_dismissed])`` + + Returns the focus string of the current viewscreen. + * ``dfhack.gui.getSelectedWorkshopJob([silent])`` When a job is selected in *'q'* mode, returns the job, else @@ -1291,9 +1296,10 @@ Screens are managed with the following functions: Displays the given screen, possibly placing it below a different one. The screen must not be already shown. Returns *true* if success. -* ``dfhack.screen.dismiss(screen)`` +* ``dfhack.screen.dismiss(screen[,to_first])`` Marks the screen to be removed when the game enters its event loop. + If ``to_first`` is *true*, all screens up to the first one will be deleted. * ``dfhack.screen.isDismissed(screen)`` @@ -1312,10 +1318,22 @@ Supported callbacks and fields are: Initialized by ``show`` with a reference to the backing viewscreen object, and removed again when the object is deleted. +* ``function screen:onShow()`` + + Called by ``dfhack.screen.show`` if successful. + +* ``function screen:onDismiss()`` + + Called by ``dfhack.screen.dismiss`` if successful. + * ``function screen:onDestroy()`` Called from the destructor when the viewscreen is deleted. +* ``function screen:onResize(w, h)`` + + Called before ``onRender`` or ``onIdle`` when the window size has changed. + * ``function screen:onRender()`` Called when the viewscreen should paint itself. This is the only context diff --git a/Lua API.html b/Lua API.html index c4ab9c8c4..15f1d89cb 100644 --- a/Lua API.html +++ b/Lua API.html @@ -987,13 +987,17 @@ can be omitted.

Gui module