Coder Social home page Coder Social logo

gocoa's Introduction

What is this?

This is a friendly fork of @mojbro's gocoa package with some additional features and bug fixes so it is suitable as Cocoa backend of my Spot GUI toolkit. I'll be in touch with the original author to get my changes upstreamed or make this a proper, maintained fork. Original README follows.

โ€”@roblillack

Changes to original

  • 2024-05-22 #5: Add NSStepper
  • 2024-05-22 #4: Add text alignment options to textfields
  • 2024-05-22 #3: Add support for OnChange callbacks for textfields
  • 2024-05-22 #1: Add support for removing controls (based on work by @phaus)
  • 2024-05-22 #2: Update deprecated NSButton enums (by @dim13)
  • 2024-05-14 e85e4be progressindicator: Don't hide by default as this would increase time to create widgets in the first place
  • 2024-05-14 724ee73 textview: Add hacky SetFontSize functionality.
  • 2024-05-14 57058d9 window: Flip all views by default
  • 2024-05-14 c93457a application: Add RunOnMainLoop

gocoa

GoDoc Go Report Card

Go bindings for the Cocoa framework to build macOS applications.

How to use

The following is a basic Hello World application.

package main

import (
	"fmt"

	"github.com/mojbro/gocoa"
)

func main() {
	gocoa.InitApplication()
	gocoa.OnApplicationDidFinishLaunching(func() {
		fmt.Println("App running!")
	})
	wnd := gocoa.NewWindow("Hello World!", 150, 150, 300, 200)

	// Change me button
	currentTitle, nextTitle := "Change me!", "Change me again!"
	changeButton := gocoa.NewButton(75, 125, 150, 25)
	changeButton.SetTitle(currentTitle)
	changeButton.OnClick(func() {
		changeButton.SetTitle(nextTitle)
		currentTitle, nextTitle = nextTitle, currentTitle
	})
	wnd.AddButton(changeButton)

	// Quit button
	quitButton := gocoa.NewButton(75, 50, 150, 25)
	quitButton.SetTitle("Quit")
	quitButton.OnClick(func() { gocoa.TerminateApplication() })
	wnd.AddButton(quitButton)

	wnd.MakeKeyAndOrderFront()
	gocoa.RunApplication()
}

Status of this project

This package is very, very early and incomplete! It is mostly just an experiment and is not really useful yet.

Contributors

Big thanks to Philipp Haussleiter who has contributed a great deal to this project.

gocoa's People

Contributors

starhack avatar mojbro avatar phaus avatar roblillack avatar dim13 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.