mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
Documentation only iup (#15732)
* ReSync with Devel
* ReSync
* Add Examples for IUP, based from official doc
(cherry picked from commit 3a69f14621)
This commit is contained in:
@@ -34,6 +34,46 @@
|
||||
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
# ****************************************************************************
|
||||
|
||||
|
||||
## Wrapper for the `IUP native GUI library <http://webserver2.tecgraf.puc-rio.br/iup>`_.
|
||||
##
|
||||
## 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):
|
||||
|
||||
Reference in New Issue
Block a user