cocoa

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2021 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package cocoa provides platform-dependent routines required to support the package goey when targeting Cocoa or GNUstep.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialogSendKey

func DialogSendKey(key uint)

func MessageDialog

func MessageDialog(handle *Window, text string, title string, icon byte)

func OpenPanel

func OpenPanel(handle *Window, filename string) string

func SavePanel

func SavePanel(handle *Window, filename string) string

Types

type Button

type Button struct {
	Control
	// contains filtered or unexported fields
}

Button is a wrapper for a NSButton.

func NewButton

func NewButton(window *View, title string) *Button

func NewCheckButton

func NewCheckButton(window *View, title string, value bool) *Button

func (*Button) Callbacks

func (w *Button) Callbacks() (func(), func(bool), func(), func())

func (*Button) Close

func (w *Button) Close()

func (*Button) IsDefault

func (w *Button) IsDefault() bool

func (*Button) PerformClick

func (w *Button) PerformClick()

func (*Button) SetCallbacks

func (w *Button) SetCallbacks(onclick func(), onchange func(bool), onfocus func(), onblur func())

func (*Button) SetDefault

func (w *Button) SetDefault(value bool)

func (*Button) SetState

func (w *Button) SetState(value bool)

func (*Button) SetTitle

func (w *Button) SetTitle(title string)

func (*Button) State

func (w *Button) State() bool

func (*Button) Title

func (w *Button) Title() string

type Control

type Control struct {
	View
	// contains filtered or unexported fields
}

func (*Control) IntrinsicContentSize

func (c *Control) IntrinsicContentSize() (int, int)

func (*Control) IsEnabled

func (c *Control) IsEnabled() bool

func (*Control) MakeFirstResponder

func (c *Control) MakeFirstResponder() bool

func (*Control) SendKey

func (c *Control) SendKey(key uint)

func (*Control) SetEnabled

func (c *Control) SetEnabled(enabled bool)

type Decoration

type Decoration struct {
	View
	// contains filtered or unexported fields
}

Decoration is a wrapper for a GDecoration.

func NewDecoration

func NewDecoration(window *View, fill color.Color, stroke color.Color, rx, ry int) *Decoration

func (*Decoration) BorderRadius

func (w *Decoration) BorderRadius() (int, int)

func (*Decoration) Close

func (w *Decoration) Close()

func (*Decoration) FillColor

func (w *Decoration) FillColor() color.RGBA

func (*Decoration) SetBorderRadius

func (w *Decoration) SetBorderRadius(x, y int)

func (*Decoration) SetFillColor

func (w *Decoration) SetFillColor(fill color.Color)

func (*Decoration) SetStrokeColor

func (w *Decoration) SetStrokeColor(fill color.Color)

func (*Decoration) StrokeColor

func (w *Decoration) StrokeColor() color.RGBA

type HR

type HR struct {
	View
	// contains filtered or unexported fields
}

HR is a wrapper for a GHR.

func NewHR

func NewHR(window *View) *HR

type ImageView

type ImageView struct {
	Control
	// contains filtered or unexported fields
}

ImageView is a wrapper for a NSImageView.

func NewImageView

func NewImageView(window *View, prop image.Image) (*ImageView, error)

func (*ImageView) Image

func (w *ImageView) Image() image.Image

func (*ImageView) SetImage

func (w *ImageView) SetImage(prop image.Image) error

type IntField

type IntField struct {
	Control
	// contains filtered or unexported fields
}

IntField is a wrapper for a NSTextField and NSStepper.

func NewIntField

func NewIntField(window *View, value, min, max int64) *IntField

func (*IntField) Callbacks

func (w *IntField) Callbacks() (func(int64), func(), func())

func (*IntField) Close

func (w *IntField) Close()

func (*IntField) IsEditable

func (w *IntField) IsEditable() bool

func (*IntField) Max

func (w *IntField) Max() int64

func (*IntField) Min

func (w *IntField) Min() int64

func (*IntField) Placeholder

func (w *IntField) Placeholder() string

func (*IntField) SetCallbacks

func (w *IntField) SetCallbacks(onchange func(int64), onfocus func(), onblur func())

func (*IntField) SetEditable

func (w *IntField) SetEditable(value bool)

func (*IntField) SetFrame

func (c *IntField) SetFrame(x, y, dx, dy int)

func (*IntField) SetPlaceholder

func (w *IntField) SetPlaceholder(text string)

func (*IntField) SetValue

func (w *IntField) SetValue(value, min, max int64)

func (*IntField) Value

func (w *IntField) Value() int64

type PopUpButton

type PopUpButton struct {
	Control
	// contains filtered or unexported fields
}

PopUpButton is a wrapper for a NSPopUpButton.

func NewPopUpButton

func NewPopUpButton(window *View) *PopUpButton

func (*PopUpButton) AddItem

func (w *PopUpButton) AddItem(text string)

func (*PopUpButton) Callbacks

func (w *PopUpButton) Callbacks() (func(int), func(), func())

func (*PopUpButton) Close

func (w *PopUpButton) Close()

func (*PopUpButton) ItemAtIndex

func (w *PopUpButton) ItemAtIndex(index int) string

func (*PopUpButton) NumberOfItems

func (w *PopUpButton) NumberOfItems() int

func (*PopUpButton) RemoveAllItems

func (w *PopUpButton) RemoveAllItems()

func (*PopUpButton) SetCallbacks

func (w *PopUpButton) SetCallbacks(onchange func(int), onfocus func(), onblur func())

func (*PopUpButton) SetValue

func (w *PopUpButton) SetValue(value int, unset bool)

func (*PopUpButton) Value

func (w *PopUpButton) Value() int

type Progress

type Progress struct {
	View
	// contains filtered or unexported fields
}

Progress is a wrapper for a NSProgressIndicator.

func NewProgress

func NewProgress(window *View, min, value, max float64) *Progress

func (*Progress) Max

func (w *Progress) Max() float64

func (*Progress) Min

func (w *Progress) Min() float64

func (*Progress) Update

func (w *Progress) Update(min, value, max float64)

func (*Progress) Value

func (w *Progress) Value() float64

type Slider

type Slider struct {
	Control
	// contains filtered or unexported fields
}

Slider is a wrapper for a NSSlider.

func NewSlider

func NewSlider(window *View, min, value, max float64) *Slider

func (*Slider) Callbacks

func (w *Slider) Callbacks() (func(float64), func(), func())

func (*Slider) Max

func (w *Slider) Max() float64

func (*Slider) Min

func (w *Slider) Min() float64

func (*Slider) SetCallbacks

func (w *Slider) SetCallbacks(onchange func(float64), onfocus func(), onblur func())

func (*Slider) Update

func (w *Slider) Update(min, value, max float64)

func (*Slider) Value

func (w *Slider) Value() float64

type TabView

type TabView struct {
	View
	// contains filtered or unexported fields
}

TabView is a wrapper for a NSTabView.

func NewTabView

func NewTabView(window *View) *TabView

func (*TabView) AddItem

func (w *TabView) AddItem(text string)

func (*TabView) Close

func (w *TabView) Close()

func (*TabView) ContentInsets

func (w *TabView) ContentInsets() (int, int)

func (*TabView) ContentView

func (w *TabView) ContentView(index int) *View

func (*TabView) ItemAtIndex

func (w *TabView) ItemAtIndex(index int) string

func (*TabView) NumberOfItems

func (w *TabView) NumberOfItems() int

func (*TabView) RemoveItemAtIndex

func (w *TabView) RemoveItemAtIndex(index int)

func (*TabView) SelectItem

func (w *TabView) SelectItem(index int)

func (*TabView) SetItemAtIndex

func (w *TabView) SetItemAtIndex(index int, text string)

func (*TabView) SetOnChange

func (w *TabView) SetOnChange(cb func(int))

type Text

type Text struct {
	View
	// contains filtered or unexported fields
}

Text is a wrapper for a NSText.

func NewText

func NewText(window *View, title string) *Text

func (*Text) Alignment

func (w *Text) Alignment() int

func (*Text) EightyEms

func (w *Text) EightyEms() int

func (*Text) MinHeight

func (w *Text) MinHeight(width int) int

func (*Text) MinWidth

func (w *Text) MinWidth() int

func (*Text) SetAlignment

func (w *Text) SetAlignment(align int)

func (*Text) SetText

func (w *Text) SetText(text string)

func (*Text) Text

func (w *Text) Text() string

type TextField

type TextField struct {
	Control
	// contains filtered or unexported fields
}

TextField is a wrapper for a NSTextField.

func NewTextField

func NewTextField(window *View, title string, password bool) *TextField

func (*TextField) Callbacks

func (w *TextField) Callbacks() (func(string), func(), func(), func(string))

func (*TextField) Close

func (w *TextField) Close()

func (*TextField) IsEditable

func (w *TextField) IsEditable() bool

func (*TextField) IsPassword

func (w *TextField) IsPassword() bool

func (*TextField) Placeholder

func (w *TextField) Placeholder() string

func (*TextField) SetCallbacks

func (w *TextField) SetCallbacks(onchange func(string), onfocus func(), onblur func(), onenterkey func(string))

func (*TextField) SetEditable

func (w *TextField) SetEditable(value bool)

func (*TextField) SetPlaceholder

func (w *TextField) SetPlaceholder(text string)

func (*TextField) SetValue

func (w *TextField) SetValue(text string)

func (*TextField) Value

func (w *TextField) Value() string

type View

type View struct {
	// contains filtered or unexported fields
}

View is a wrapper for a NSView.

func (*View) Close

func (c *View) Close()

Close is a a wrapper for removeFromSuperview + release.

func (*View) SetFrame

func (c *View) SetFrame(x, y, dx, dy int)

SetFrame is a wrapper for the setFrame message.

type Window

type Window struct {
	// contains filtered or unexported fields
}

Window is a wrapper for a NSWindow.

func NewWindow

func NewWindow(title string, width, height uint) *Window

func (*Window) Close

func (w *Window) Close()

func (*Window) ContentSize

func (w *Window) ContentSize() (int, int)

func (*Window) ContentView

func (w *Window) ContentView() *View

func (*Window) MakeFirstResponder

func (w *Window) MakeFirstResponder(c *Control)

func (*Window) Screenshot

func (w *Window) Screenshot() image.Image

func (*Window) SetCallbacks

func (w *Window) SetCallbacks(cb WindowCallbacks)

func (*Window) SetContentSize

func (w *Window) SetContentSize(width, height int)

func (*Window) SetIcon

func (w *Window) SetIcon(img image.Image) error

func (*Window) SetMinSize

func (w *Window) SetMinSize(width, height int)

func (*Window) SetScrollVisible

func (w *Window) SetScrollVisible(horz, vert bool)

func (*Window) SetTitle

func (w *Window) SetTitle(title string)

func (*Window) Title

func (w *Window) Title() string

type WindowCallbacks

type WindowCallbacks interface {
	OnShouldClose() bool
	OnWillClose()
	OnDidResize()
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL