Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NSProgressIndicator class #158

Merged
merged 4 commits into from
Jul 31, 2023

Conversation

programmingkidx
Copy link
Contributor

Add the NSProgressIndicator class. This program can be used to test it:

package main

import "github.com/progrium/macdriver/cocoa"
import "github.com/progrium/macdriver/objc"
import "github.com/progrium/macdriver/core"


func main() {

	app := cocoa.NSApp_WithDidLaunch(func(n objc.Object) {
		win := cocoa.NSWindow_New()
		win.SetTitle("NSProgressIndicator")
		win.MakeKeyAndOrderFront(nil)

		/* NSProgressIndicator code */
		rect := core.NSMakeRect(10, 40, 80, 25)
		progress := cocoa.NSProgressIndicator_Alloc()
		progress.InitWithFrame(rect)
		progress.StartAnimation(nil)
		win.ContentView().AddSubview(progress)
	})

	app.SetActivationPolicy(cocoa.NSApplicationActivationPolicyRegular)
	app.ActivateIgnoringOtherApps(true)
	app.Run()
}

@programmingkidx
Copy link
Contributor Author

This program can be used to test the NSDatePicker class:

package main

import "github.com/progrium/macdriver/cocoa"
import "github.com/progrium/macdriver/objc"
import "github.com/progrium/macdriver/core"


func main() {

	app := cocoa.NSApp_WithDidLaunch(func(n objc.Object) {
		win := cocoa.NSWindow_New()
		win.SetTitle("NSDatePicker")
		win.MakeKeyAndOrderFront(nil)

		/* NSDatePicker code */
		rect := core.NSMakeRect(1, 40, 100, 25)
		datepicker := cocoa.NSDatePicker_Alloc()
		datepicker.InitWithFrame(rect)
		win.ContentView().AddSubview(datepicker)
	})

	app.SetActivationPolicy(cocoa.NSApplicationActivationPolicyRegular)
	app.ActivateIgnoringOtherApps(true)
	app.Run()
}

@programmingkidx
Copy link
Contributor Author

Add the NSSegmentedControl class. This program can be used to test this class:

package main

import "github.com/progrium/macdriver/cocoa"
import "github.com/progrium/macdriver/objc"
import "github.com/progrium/macdriver/core"
import "fmt"

func main() {

	app := cocoa.NSApp_WithDidLaunch(func(n objc.Object) {
		win := cocoa.NSWindow_New()
		winRect := core.NSMakeRect(20,20, 250,200)
		win.SetFrameDisplay(winRect, true)
		win.SetTitle("NSSegmentedControl")
		win.MakeKeyAndOrderFront(nil)

		/* NSSegmentedControl code */
		rect := core.NSMakeRect(25, 40, 200, 25)
		segment := cocoa.NSSegmentedControl_Alloc()
		segment.InitWithFrame(rect)
		win.ContentView().AddSubview(segment)
		segment.SetSegmentCount(4)
		fmt.Println("segment count:", segment.SegmentCount())
	})

	app.SetActivationPolicy(cocoa.NSApplicationActivationPolicyRegular)
	app.ActivateIgnoringOtherApps(true)
	app.Run()
}

@progrium progrium merged commit b452240 into progrium:main Jul 31, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants