From c8f6eb6c140de92cd384d11c407c4ce51cbee22e Mon Sep 17 00:00:00 2001 From: Juan Carlos Date: Mon, 26 Oct 2020 14:49:01 -0300 Subject: [PATCH] Documentation only iup (#15732) * ReSync with Devel * ReSync * Add Examples for IUP, based from official doc (cherry picked from commit 3a69f14621156358e2fc154881f60459d04814a1) --- lib/wrappers/iup.nim | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/lib/wrappers/iup.nim b/lib/wrappers/iup.nim index 3c1ff1483c..0242d79815 100644 --- a/lib/wrappers/iup.nim +++ b/lib/wrappers/iup.nim @@ -34,6 +34,46 @@ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # **************************************************************************** + +## Wrapper for the `IUP native GUI library `_. +## +## Requires `iup.dll` on Windows, `libiup.so` on Linux, `libiup.dylib` on OS X. +## Compile with `-d:nimDebugDlOpen` to debug the shared library opening. +## +## Examples +## ======== +## +## .. image:: http://webserver2.tecgraf.puc-rio.br/iup/en/tutorial/example2_1.png +## +## .. code-block:: nim +## import os, iup +## var argc = create(cint) +## argc[] = paramCount().cint +## var argv = allocCstringArray(commandLineParams()) +## assert open(argc, argv.addr) == 0 # UIP requires calling open() +## message(r"Hello world 1", r"Hello world") # Message popup +## close() # UIP requires calling close() +## +## +## .. image:: http://webserver2.tecgraf.puc-rio.br/iup/en/tutorial/example3_1.png +## +## .. code-block:: nim +## import os, iup +## var argc = create(cint) +## argc[] = paramCount().cint +## var argv = allocCstringArray(commandLineParams()) +## assert open(argc, argv.addr) == 0 # UIP requires open() +## let textarea = text(nil) # Text widget. +## setAttribute(textarea, r"MULTILINE", r"YES") # Set text widget to multiline. +## setAttribute(textarea, r"EXPAND", r"YES") # Set text widget to auto expand. +## let layout = vbox(textarea) # Vertical layout. +## let window = dialog(layout) # Dialog window. +## setAttribute(window, "TITLE", "Nim Notepad") # Set window title. +## showXY(window, IUP_CENTER, IUP_CENTER) # Show window. +## mainLoop() # Main loop. +## close() # UIP requires calling close() + + when defined(windows): const dllname = "iup(|30|27|26|25|24).dll" elif defined(macosx):