All Projects → Airr → nim-cocoa

Airr / nim-cocoa

Licence: MIT License
macOS GUI Library for the Nim Programming Language

Programming Languages

objective c
16641 projects - #2 most used programming language
nim
578 projects

Projects that are alternatives of or similar to nim-cocoa

easywave
Easy WAVE file handling for Nim
Stars: ✭ 18 (-35.71%)
Mutual labels:  nim-lang
Neel
A Nim library for making Electron-like HTML/JS GUI apps, with full access to Nim capabilities.
Stars: ✭ 144 (+414.29%)
Mutual labels:  nim-lang
razcal
Build cross platform desktop app with Lua, MoonScript, and Layout Language
Stars: ✭ 15 (-46.43%)
Mutual labels:  nim-lang
nim-lmdb
Nim LMDB wrapper
Stars: ✭ 31 (+10.71%)
Mutual labels:  nim-lang
webgui
Web Technologies based Crossplatform GUI Framework with Dark theme
Stars: ✭ 81 (+189.29%)
Mutual labels:  nim-lang
cosmonim
A simple example to show how cosmopolitan libc can be used with Nim
Stars: ✭ 90 (+221.43%)
Mutual labels:  nim-lang
theBookOfNoah
Everything ive learned developing web applications
Stars: ✭ 22 (-21.43%)
Mutual labels:  nim-lang
Decimal
A big/arbitrary precision Decimal class in pure Nim
Stars: ✭ 26 (-7.14%)
Mutual labels:  nim-lang
LatexDSL
A mini DSL to generate LaTeX from Nim
Stars: ✭ 22 (-21.43%)
Mutual labels:  nim-lang
suru
A tqdm-style progress bar in Nim
Stars: ✭ 40 (+42.86%)
Mutual labels:  nim-lang
unofficial-webapp-office-poc1
Access all of your favorite Office 365 apps from Linux
Stars: ✭ 31 (+10.71%)
Mutual labels:  nim-lang
nim-telegram-bot
Nim Telegram Bot.
Stars: ✭ 18 (-35.71%)
Mutual labels:  nim-lang
nim-syslog
Nim syslog module
Stars: ✭ 17 (-39.29%)
Mutual labels:  nim-lang
nim-gatabase
Connection-Pooling Compile-Time ORM for Nim
Stars: ✭ 103 (+267.86%)
Mutual labels:  nim-lang
badgemaker
The Nim badgemaker tool.
Stars: ✭ 15 (-46.43%)
Mutual labels:  nim-lang
grim
grim brings property graphs to the Nim language. Look around you: everything is a graph!
Stars: ✭ 44 (+57.14%)
Mutual labels:  nim-lang
nimodpi
Oracle ODPI-C wrapper for Nim
Stars: ✭ 17 (-39.29%)
Mutual labels:  nim-lang
TimepixAnalysis
Contains code related to calibration and analysis of Timepix based detector + CAST related code
Stars: ✭ 14 (-50%)
Mutual labels:  nim-lang
microparsec
⭐ A performant Nim parsing library built for humans.
Stars: ✭ 26 (-7.14%)
Mutual labels:  nim-lang
nim-redisparser
RESP(REdis Serialization Protocol) Serialization for Nim
Stars: ✭ 16 (-42.86%)
Mutual labels:  nim-lang

NimCocoa

NimCocoa is an experimental implementation of a Native GUI for the Nim programming language running on macOS.

Rather than rely on low level calls to objc_msgsend and it's variants, it uses actual Objective-C code modules I created that are wrapped using C-Style functions, which Nim can then use.

At the moment, the following GUI objects are available:

NSWindow NSMenu NSSavedialog NSSlider
NSButton NSTextfield NSMessagebox NSListbox NSContainer (Groupbox)
NSLabel NSCheckbox NSOpendialog NSTextedit NSTableView
NSCombobox NSDialog NSLine NSRadioButton

Preliminary documentation for GUI objects is available in the doc folder and in the wiki.

Here is an example of what coding with NimCocoa looks like:

import Cocoa / [NSWindow, NSTextfield, NSLabel, NSCheckbox, NSButton, NSLine, NSOpendialog, NSFunctions]
import json, os, plists, times

var mainWin: ID

var lblFile, txtFile, btnFile, lblAuthor, txtAuthor, lblApp, 
    txtApp, lblImage, txtImage, btnImage, line1, lblVersion, 
    txtVersion, lblIdent, txtIdent, line2, chkLaunch, btnExec: ID

const
  width:cint = 800
  height:cint = 310
  winStyle = NSWindowStyleMaskTitled or NSWindowStyleMaskClosable or NSWindowStyleMaskMiniaturizable


proc main() =

  Cocoa_Init()

  mainWin = newWindow("macOS Application Bundler", width, height, winStyle)

  lblFile = newLabel(mainWin, "Select Executable",30, 20, 120, 25)
  txtFile = newTextField(mainWin, "", 160, 20, 500, 25)
  btnFile = newButton(mainWin, "Load", 680, 20, 100, 25, getExecutable)
  txtFile.anchor=akWidth; btnFile.anchor=akRight

  lblAuthor = newLabel(mainWin, "Author Name", 30, 60, 120, 25)
  txtAuthor = newTextField(mainWin, "", 160, 60, 500, 25)
  txtAuthor.anchor=akWidth

  lblApp = newLabel(mainWin, "Application Name", 30, 100, 120, 25)
  txtApp = newTextField(mainWin, "", 160, 100, 170, 25)
  txtApp.anchor=akWidth

  lblImage = newLabel(mainWin, "Select Icon File", 30, 200, 120, 25)
  txtImage = newTextField(mainWin, "", 160, 200, 500, 25)
  btnImage = newButton(mainWin, "Load", 680, 200, 100, 25, getImage)
  txtImage.anchor=akWidth; btnImage.anchor=akRight

  line1 = newSeparator(mainWin, 30, 140, 750)

  lblVersion = newLabel(mainWin, "Application Version", 350, 100, 130, 25)
  txtVersion = newTextField(mainWin, "", 490, 100, 170, 25)
  txtVersion.anchor=akRight; lblVersion.anchor=akRight

  lblIdent = newLabel(mainWin, "Bundle Identifier", 30, 160, 120, 25)
  txtIdent = newTextField(mainWin, "", 160, 160, 500, 25)
  # btnCredits = newButton(mainWin, "Load", 680, 160, 100, 25, nil)
  txtIdent.anchor=akWidth

  line2 = newSeparator(mainWin, 20, 240, 750)

  chkLaunch = newCheckBox(mainWin, "Launch Application?", 320, 270, 150, 25)
  btnExec = newButton(mainWin, "Execute", 680, 270, 100, 25, createAppBundle)
  chkLaunch.anchor=akLeft + akRight + akBottom; btnExec.anchor=akRight + akBottom

  Cocoa_Run(mainWin)

if isMainModule:
  main()

Which results in the following:

Another screenshot:

Same app resized, showing how objects flow based on their associated 'anchor' setting:

I am working on documenting the available objects/functions as well as examples.

Stay Tuned!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].