Documentation ¶
Overview ¶
Package cocoa - Go bindings for the Cocoa framework. It is currently in early stage development and not very usable yet.
Index ¶
- Constants
- func InitApplication()
- func OnApplicationDidFinishLaunching(fn func())
- func RunApplication()
- func RunOnMainLoop(fn func())
- func TerminateApplication()
- type Button
- func (btn *Button) OnClick(fn func())
- func (btn *Button) Remove()
- func (btn *Button) SetBackgroundColor(hexRGBA string)
- func (btn *Button) SetBezelStyle(bezelStyle ButtonBezelStyle)
- func (btn *Button) SetBorderColor(hexRGBA string)
- func (btn *Button) SetBorderWidth(borderWidth int)
- func (btn *Button) SetButtonType(buttonType ButtonType)
- func (btn *Button) SetColor(hexRGBA string)
- func (btn *Button) SetFontFamily(fontFamily string)
- func (btn *Button) SetFontSize(fontSize int)
- func (btn *Button) SetImage(img *image.RGBA)
- func (btn *Button) SetState(state ButtonState)
- func (btn *Button) SetTitle(title string)
- func (btn *Button) State() ButtonState
- func (btn *Button) Title() string
- type ButtonBezelStyle
- type ButtonState
- type ButtonType
- type ComboBox
- func (comboBox *ComboBox) AddItem(item string)
- func (comboBox *ComboBox) OnSelectionDidChange(fn func())
- func (comboBox *ComboBox) Remove()
- func (comboBox *ComboBox) SelectedIndex() int
- func (comboBox *ComboBox) SelectedText() string
- func (comboBox *ComboBox) SetEditable(editable bool)
- func (comboBox *ComboBox) SetSelectedIndex(selectedIndex int)
- func (comboBox *ComboBox) SetSelectedText(selectedText string)
- func (comboBox *ComboBox) SetStringValue(stringValue string)
- func (comboBox *ComboBox) StringValue() string
- type DatePicker
- func (datePicker *DatePicker) Date() string
- func (datePicker *DatePicker) Remove()
- func (datePicker *DatePicker) SetDate(date string)
- func (datePicker *DatePicker) SetDateFormat(dateFormat string)
- func (datePicker *DatePicker) SetMaximumDate(date string)
- func (datePicker *DatePicker) SetMinimumDate(date string)
- func (datePicker *DatePicker) SetMode(mode DatePickerMode)
- func (datePicker *DatePicker) SetStyle(style DatePickerStyle)
- type DatePickerMode
- type DatePickerStyle
- type EventHandler
- type FrameStyle
- type ImageAlignment
- type ImageScaling
- type ImageView
- func (imageView *ImageView) Remove()
- func (imageView *ImageView) SetAnimates(animates bool)
- func (imageView *ImageView) SetContentTintColor(hexRGBA string)
- func (imageView *ImageView) SetEditable(editable bool)
- func (imageView *ImageView) SetImage(img *image.RGBA)
- func (imageView *ImageView) SetImageAlignment(imageAlignment ImageAlignment)
- func (imageView *ImageView) SetImageFrameStyle(frameStyle FrameStyle)
- func (imageView *ImageView) SetImageScaling(imageScaling ImageScaling)
- type InteractiveView
- type ProgressIndicator
- func (indicator *ProgressIndicator) GetIsIndeterminate() bool
- func (indicator *ProgressIndicator) GetValue() float64
- func (indicator *ProgressIndicator) Hide()
- func (indicator *ProgressIndicator) IncrementBy(inc float64)
- func (indicator *ProgressIndicator) Remove()
- func (indicator *ProgressIndicator) SetAutohide(value bool)
- func (indicator *ProgressIndicator) SetDisplayedWhenStopped(value bool)
- func (indicator *ProgressIndicator) SetIsIndeterminate(value bool)
- func (indicator *ProgressIndicator) SetLimits(minValue float64, maxValue float64)
- func (indicator *ProgressIndicator) SetValue(value float64)
- func (indicator *ProgressIndicator) Show()
- func (indicator *ProgressIndicator) StartAnimation()
- func (indicator *ProgressIndicator) StopAnimation()
- type Screen
- type Slider
- func (slider *Slider) OnSliderValueChanged(fn func())
- func (slider *Slider) Remove()
- func (slider *Slider) SetMaximumValue(val float64)
- func (slider *Slider) SetMinimumValue(val float64)
- func (slider *Slider) SetSliderType(sliderType SliderType)
- func (slider *Slider) SetValue(val float64)
- func (slider *Slider) Value() float64
- type SliderType
- type Stepper
- func (stepper *Stepper) OnStepperValueChanged(fn func(value float64))
- func (stepper *Stepper) Remove()
- func (stepper *Stepper) SetIncrement(val float64)
- func (stepper *Stepper) SetMaxValue(val float64)
- func (stepper *Stepper) SetMinValue(val float64)
- func (stepper *Stepper) SetValue(val float64)
- func (stepper *Stepper) SetValueWraps(val bool)
- func (stepper *Stepper) Value() float64
- type TableView
- func (tableView *TableView) Add(row string)
- func (tableView *TableView) AllowsMultipleSelection() bool
- func (tableView *TableView) Clear()
- func (tableView *TableView) DeselectAll()
- func (tableView *TableView) IsEnabled() bool
- func (tableView *TableView) IsRowSelected(index int) bool
- func (tableView *TableView) NumberOfRows() int
- func (tableView *TableView) OnSelectionDidChange(fn func(indexes []int))
- func (tableView *TableView) Remove()
- func (tableView *TableView) ScrollRowToVisible(index int)
- func (tableView *TableView) SelectRowIndex(index int)
- func (tableView *TableView) SetAllowsMultipleSelection(enabled bool)
- func (tableView *TableView) SetEnabled(enabled bool)
- type TextField
- func (textField *TextField) Editable() bool
- func (textField *TextField) Enabled() bool
- func (textField *TextField) OnChange(fn func(value string))
- func (textField *TextField) Remove()
- func (textField *TextField) SetAlignmentCenter()
- func (textField *TextField) SetAlignmentLeft()
- func (textField *TextField) SetAlignmentRight()
- func (textField *TextField) SetBackgroundColor(hexRGBA string)
- func (textField *TextField) SetBezeled(bezeled bool)
- func (textField *TextField) SetBorderColor(hexRGBA string)
- func (textField *TextField) SetBorderWidth(borderWidth int)
- func (textField *TextField) SetColor(hexRGBA string)
- func (textField *TextField) SetDrawsBackground(drawsBackground bool)
- func (textField *TextField) SetEditable(editable bool)
- func (textField *TextField) SetEnabled(enabled bool)
- func (textField *TextField) SetFontFamily(fontFamily string)
- func (textField *TextField) SetFontSize(fontSize int)
- func (textField *TextField) SetSelectable(selectable bool)
- func (textField *TextField) SetStringValue(text string)
- func (textField *TextField) StringValue() string
- type TextView
- type Window
- func (wnd *Window) AddButton(btn *Button)
- func (wnd *Window) AddComboBox(comboBox *ComboBox)
- func (wnd *Window) AddDatePicker(datePicker *DatePicker)
- func (wnd *Window) AddDefaultQuitMenu()
- func (wnd *Window) AddImageView(imageView *ImageView)
- func (w *Window) AddInteractiveView(c *InteractiveView)
- func (wnd *Window) AddLabel(tv *TextField)
- func (wnd *Window) AddProgressIndicator(indicator *ProgressIndicator)
- func (wnd *Window) AddSlider(slider *Slider)
- func (wnd *Window) AddStepper(stepper *Stepper)
- func (wnd *Window) AddTableView(tableView *TableView)
- func (wnd *Window) AddTextField(tf *TextField)
- func (wnd *Window) AddTextView(tv *TextView)
- func (wnd *Window) GetScreen() *Screen
- func (wnd *Window) MakeKeyAndOrderFront()
- func (wnd *Window) OnDidDeminiaturize(fn EventHandler)
- func (wnd *Window) OnDidMiniaturize(fn EventHandler)
- func (wnd *Window) OnDidMove(fn EventHandler)
- func (wnd *Window) OnDidResize(fn EventHandler)
- func (wnd *Window) OnShouldClose(fn EventHandler)
- func (wnd *Window) SetAllowsResizing(allowsResizing bool)
- func (wnd *Window) SetCloseButtonEnabled(enabled bool)
- func (wnd *Window) SetMiniaturizeButtonEnabled(enabled bool)
- func (wnd *Window) SetTitle(title string)
- func (wnd *Window) SetZoomButtonEnabled(enabled bool)
- func (wnd *Window) Update()
- type WindowEvent
Constants ¶
const ( DatePickerStyleClockAndCalendar DatePickerStyle = 1 DatePickerStyleTextField DatePickerStyle = 2 DatePickerStyleTextFieldAndStepper DatePickerStyle = 0 DatePickerModeRange DatePickerMode = 1 DatePickerModeSingle DatePickerMode = 0 )
Variables ¶
This section is empty.
Functions ¶
func InitApplication ¶
func InitApplication()
InitApplication initializes the global application instance. Call this before using the rest of the cocoa package.
func OnApplicationDidFinishLaunching ¶
func OnApplicationDidFinishLaunching(fn func())
OnApplicationDidFinishLaunching - will be triggered after Application Launch is finished
func RunOnMainLoop ¶
func RunOnMainLoop(fn func())
func TerminateApplication ¶
func TerminateApplication()
TerminateApplication - will be triggered, when the Application terminates
Types ¶
type Button ¶
type Button struct {
// contains filtered or unexported fields
}
Button represents a button control that can trigger actions.
func NewButton ¶
NewButton constructs a new button at position (x, y) and with size (width x height). Gotcha! It is currently hard-coded to quit the app when the button is being pressed, until callbacks have been implemented. This func is not thread safe.
func (*Button) OnClick ¶
func (btn *Button) OnClick(fn func())
OnClick - function, that will be triggered, if the button is clicked.
func (*Button) SetBackgroundColor ¶
func (*Button) SetBezelStyle ¶
func (btn *Button) SetBezelStyle(bezelStyle ButtonBezelStyle)
func (*Button) SetBorderColor ¶
func (*Button) SetBorderWidth ¶
func (*Button) SetButtonType ¶
func (btn *Button) SetButtonType(buttonType ButtonType)
func (*Button) SetFontFamily ¶
func (*Button) SetFontSize ¶
func (*Button) SetState ¶
func (btn *Button) SetState(state ButtonState)
func (*Button) SetTitle ¶
SetTitle sets the title of the button, which is the text displayed on the button.
func (*Button) State ¶
func (btn *Button) State() ButtonState
type ButtonBezelStyle ¶
type ButtonBezelStyle int32
const ( ButtonBezelStyleRounded ButtonBezelStyle = 1 ButtonBezelStyleRegularSquare ButtonBezelStyle = 2 ButtonBezelStyleShadowlessSquare ButtonBezelStyle = 6 ButtonBezelStyleSmallSquare ButtonBezelStyle = 10 ButtonBezelStyleRoundRect ButtonBezelStyle = 12 ButtonBezelStyleInline ButtonBezelStyle = 15 ButtonBezelStyleRecessed ButtonBezelStyle = 13 ButtonBezelStyleDisclosure ButtonBezelStyle = 5 ButtonBezelStyleRoundedDisclosure ButtonBezelStyle = 14 ButtonBezelStyleCircular ButtonBezelStyle = 7 ButtonBezelStyleHelpButton ButtonBezelStyle = 9 ButtonBezelStyleTexturedRounded ButtonBezelStyle = 11 ButtonBezelStyleTexturedSquare ButtonBezelStyle = 8 )
type ButtonState ¶
type ButtonState int32
const ( ButtonStateValueOff ButtonState = 0 ButtonStateValueOn ButtonState = 1 ButtonStateValueMixed ButtonState = 2 )
type ButtonType ¶
type ButtonType int32
const ( ButtonTypeMomentaryPushIn ButtonType = 7 ButtonTypeMomentaryLight ButtonType = 0 ButtonTypeMomentaryChange ButtonType = 5 ButtonTypePushOnPushOff ButtonType = 1 ButtonTypeOnOff ButtonType = 6 ButtonTypeToggle ButtonType = 2 ButtonTypeSwitch ButtonType = 3 ButtonTypeRadio ButtonType = 4 ButtonTypeAccelerator ButtonType = 8 ButtonTypeMultiLevelAccelerator ButtonType = 9 )
type ComboBox ¶
type ComboBox struct {
// contains filtered or unexported fields
}
func (*ComboBox) OnSelectionDidChange ¶
func (comboBox *ComboBox) OnSelectionDidChange(fn func())
func (*ComboBox) Remove ¶
func (comboBox *ComboBox) Remove()
Remove removes a ComboBox from the parent view again.
func (*ComboBox) SelectedIndex ¶
func (*ComboBox) SelectedText ¶
func (*ComboBox) SetEditable ¶
func (*ComboBox) SetSelectedIndex ¶
func (*ComboBox) SetSelectedText ¶
func (*ComboBox) SetStringValue ¶
func (*ComboBox) StringValue ¶
type DatePicker ¶
type DatePicker struct {
// contains filtered or unexported fields
}
DatePicker represents a date picker control that can trigger actions.
func NewDatePicker ¶
func NewDatePicker(x int, y int, width int, height int) *DatePicker
func (*DatePicker) Date ¶
func (datePicker *DatePicker) Date() string
func (*DatePicker) Remove ¶
func (datePicker *DatePicker) Remove()
Remove removes a DatePicker from the parent view again.
func (*DatePicker) SetDate ¶
func (datePicker *DatePicker) SetDate(date string)
func (*DatePicker) SetDateFormat ¶
func (datePicker *DatePicker) SetDateFormat(dateFormat string)
func (*DatePicker) SetMaximumDate ¶
func (datePicker *DatePicker) SetMaximumDate(date string)
func (*DatePicker) SetMinimumDate ¶
func (datePicker *DatePicker) SetMinimumDate(date string)
func (*DatePicker) SetMode ¶
func (datePicker *DatePicker) SetMode(mode DatePickerMode)
func (*DatePicker) SetStyle ¶
func (datePicker *DatePicker) SetStyle(style DatePickerStyle)
type DatePickerMode ¶
type DatePickerMode int32
type DatePickerStyle ¶
type DatePickerStyle int32
type EventHandler ¶
type EventHandler func(wnd *Window)
EventHandler - handler functions that accepts the updated window as parameter
type FrameStyle ¶
type FrameStyle int32
const ( FrameStyleNone FrameStyle = 0 FrameStylePhoto FrameStyle = 1 FrameStyleGrayBezel FrameStyle = 2 FrameStyleGroove FrameStyle = 3 FrameStyleButton FrameStyle = 4 )
type ImageAlignment ¶
type ImageAlignment int32
const ( ImageAlignCenter ImageAlignment = 0 ImageAlignTop ImageAlignment = 1 ImageAlignTopLeft ImageAlignment = 2 ImageAlignTopRight ImageAlignment = 3 ImageAlignLeft ImageAlignment = 4 ImageAlignBottom ImageAlignment = 5 ImageAlignBottomLeft ImageAlignment = 6 ImageAlignBottomRight ImageAlignment = 7 ImageAlignRight ImageAlignment = 8 )
type ImageScaling ¶
type ImageScaling int32
const ( ImageScalingScaleProportionallyDown ImageScaling = 0 ImageScalingScaleAxesIndependently ImageScaling = 1 ImageScalingScaleNone ImageScaling = 2 ImageScalingScaleProportionallyUpOrDown ImageScaling = 3 )
type ImageView ¶
type ImageView struct {
// contains filtered or unexported fields
}
Represents an ImageView control that can display images.
func NewImageViewWithImage ¶
func (*ImageView) Remove ¶
func (imageView *ImageView) Remove()
Remove removes an ImageView from the parent view again.
func (*ImageView) SetAnimates ¶
func (*ImageView) SetContentTintColor ¶
func (*ImageView) SetEditable ¶
func (*ImageView) SetImageAlignment ¶
func (imageView *ImageView) SetImageAlignment(imageAlignment ImageAlignment)
func (*ImageView) SetImageFrameStyle ¶
func (imageView *ImageView) SetImageFrameStyle(frameStyle FrameStyle)
func (*ImageView) SetImageScaling ¶
func (imageView *ImageView) SetImageScaling(imageScaling ImageScaling)
type InteractiveView ¶
type InteractiveView struct {
// contains filtered or unexported fields
}
func NewInteractiveView ¶
func NewInteractiveView(x int, y int, width int, height int) *InteractiveView
func (*InteractiveView) OnClick ¶
func (c *InteractiveView) OnClick(fn func(x, y int, secondary bool))
func (*InteractiveView) Remove ¶
func (c *InteractiveView) Remove()
func (*InteractiveView) SetImage ¶
func (c *InteractiveView) SetImage(img *image.RGBA)
type ProgressIndicator ¶
type ProgressIndicator struct {
// contains filtered or unexported fields
}
ProgressIndicator represents a indicator control that can trigger actions.
func NewProgressIndicator ¶
func NewProgressIndicator(x int, y int, w int, h int) *ProgressIndicator
NewProgressIndicator constructs a new ProgressIndicator
func (*ProgressIndicator) GetIsIndeterminate ¶
func (indicator *ProgressIndicator) GetIsIndeterminate() bool
GetIsIndeterminate - return if the progressbar is indeterminate
func (*ProgressIndicator) GetValue ¶
func (indicator *ProgressIndicator) GetValue() float64
GetValue - returns the current value of the indicator
func (*ProgressIndicator) Hide ¶
func (indicator *ProgressIndicator) Hide()
Hide - hides the Progressbar
func (*ProgressIndicator) IncrementBy ¶
func (indicator *ProgressIndicator) IncrementBy(inc float64)
IncrementBy - increments by `inc`
func (*ProgressIndicator) Remove ¶
func (indicator *ProgressIndicator) Remove()
Remove - removes the indicator from the superview
func (*ProgressIndicator) SetAutohide ¶
func (indicator *ProgressIndicator) SetAutohide(value bool)
SetAutohide - if set to true, the indicator will disapear after 100%, default false
func (*ProgressIndicator) SetDisplayedWhenStopped ¶
func (indicator *ProgressIndicator) SetDisplayedWhenStopped(value bool)
SetDisplayedWhenStopped - A Boolean that indicates whether the progress indicator hides itself when it isn’t animating.
func (*ProgressIndicator) SetIsIndeterminate ¶
func (indicator *ProgressIndicator) SetIsIndeterminate(value bool)
SetIsIndeterminate - sets if the progressbar is indeterminate
func (*ProgressIndicator) SetLimits ¶
func (indicator *ProgressIndicator) SetLimits(minValue float64, maxValue float64)
SetLimits - sets min and max values
func (*ProgressIndicator) SetValue ¶
func (indicator *ProgressIndicator) SetValue(value float64)
SetValue - sets the value to `value`
func (*ProgressIndicator) Show ¶
func (indicator *ProgressIndicator) Show()
Show - shows the Progressbar
func (*ProgressIndicator) StartAnimation ¶
func (indicator *ProgressIndicator) StartAnimation()
StartAnimation - Starts the animation of an indeterminate progress indicator.
func (*ProgressIndicator) StopAnimation ¶
func (indicator *ProgressIndicator) StopAnimation()
StopAnimation - Stops the animation of an indeterminate progress indicator.
type Slider ¶
type Slider struct {
// contains filtered or unexported fields
}
func (*Slider) OnSliderValueChanged ¶
func (slider *Slider) OnSliderValueChanged(fn func())
func (*Slider) Remove ¶
func (slider *Slider) Remove()
Remove removes a Slider from the parent view again.
func (*Slider) SetMaximumValue ¶
func (*Slider) SetMinimumValue ¶
func (*Slider) SetSliderType ¶
func (slider *Slider) SetSliderType(sliderType SliderType)
type SliderType ¶
type SliderType int32
const ( SliderTypeCircular SliderType = 1 SliderTypeLinear SliderType = 0 )
type Stepper ¶
type Stepper struct {
// contains filtered or unexported fields
}
func (*Stepper) OnStepperValueChanged ¶
func (*Stepper) Remove ¶
func (stepper *Stepper) Remove()
Remove removes a Slider from the parent view again.
func (*Stepper) SetIncrement ¶
func (*Stepper) SetMaxValue ¶
func (*Stepper) SetMinValue ¶
func (*Stepper) SetValueWraps ¶
type TableView ¶
type TableView struct {
// contains filtered or unexported fields
}
TableView -Button represents a button control that can trigger actions.
func NewTableView ¶
NewTableView - This func is not thread safe.
func (*TableView) AllowsMultipleSelection ¶
func (*TableView) DeselectAll ¶
func (tableView *TableView) DeselectAll()
func (*TableView) IsRowSelected ¶
func (*TableView) NumberOfRows ¶
func (*TableView) OnSelectionDidChange ¶
func (*TableView) Remove ¶
func (tableView *TableView) Remove()
Remove - removes a Text Field from the parent view
func (*TableView) ScrollRowToVisible ¶
func (*TableView) SelectRowIndex ¶
func (*TableView) SetAllowsMultipleSelection ¶
func (*TableView) SetEnabled ¶
type TextField ¶
type TextField struct {
// contains filtered or unexported fields
}
TextField -Button represents a button control that can trigger actions.
func NewLabel ¶
NewLabel - This func is not thread safe. Label is only for convenience. Under the hood it's still a textfield with some preconfiguration in place
func NewTextField ¶
NewTextField - This func is not thread safe.
func (*TextField) Remove ¶
func (textField *TextField) Remove()
Remove - removes a Text Field from the parent view
func (*TextField) SetAlignmentCenter ¶
func (textField *TextField) SetAlignmentCenter()
func (*TextField) SetAlignmentLeft ¶
func (textField *TextField) SetAlignmentLeft()
func (*TextField) SetAlignmentRight ¶
func (textField *TextField) SetAlignmentRight()
func (*TextField) SetBackgroundColor ¶
func (*TextField) SetBezeled ¶
func (*TextField) SetBorderColor ¶
func (*TextField) SetBorderWidth ¶
func (*TextField) SetDrawsBackground ¶
func (*TextField) SetEditable ¶
func (*TextField) SetEnabled ¶
SetEnabled sets the enabled value of the text field. CANNOT BE CHANGED AT RUNTIME
func (*TextField) SetFontFamily ¶
func (*TextField) SetFontSize ¶
func (*TextField) SetSelectable ¶
func (*TextField) SetStringValue ¶
SetStringValue sets the string value of the text field
func (*TextField) StringValue ¶
StringValue - returns the string value of the text field
type TextView ¶
type TextView struct {
// contains filtered or unexported fields
}
TextView - represents a textView control that can trigger actions.
func NewTextView ¶
NewTextView - This func is not thread safe.
func (*TextView) Remove ¶
func (textview *TextView) Remove()
Remove - removes a Text View from the parent view
func (*TextView) SetEditable ¶
func (*TextView) SetFontSize ¶
SetText sets the text of the text view
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window is just that.
func NewCenteredWindow ¶
NewCenteredWindow constructs and returns a new window.
func (*Window) AddComboBox ¶
func (*Window) AddDatePicker ¶
func (wnd *Window) AddDatePicker(datePicker *DatePicker)
AddDatePicker adds a DatePicker to the window.
func (*Window) AddDefaultQuitMenu ¶
func (wnd *Window) AddDefaultQuitMenu()
func (*Window) AddImageView ¶
AddImageView adds an ImageView to the window.
func (*Window) AddInteractiveView ¶
func (w *Window) AddInteractiveView(c *InteractiveView)
func (*Window) AddProgressIndicator ¶
func (wnd *Window) AddProgressIndicator(indicator *ProgressIndicator)
AddProgressIndicator adds a ProgressIndicator to the window.
func (*Window) AddStepper ¶
func (*Window) AddTableView ¶
func (*Window) AddTextField ¶
AddTextField - adds a Text Field to the window.
func (*Window) AddTextView ¶
AddTextView - adds a Text View to the window.
func (*Window) MakeKeyAndOrderFront ¶
func (wnd *Window) MakeKeyAndOrderFront()
MakeKeyAndOrderFront moves the window to the front of the screen list, within its level and it shows the window.
func (*Window) OnDidDeminiaturize ¶
func (wnd *Window) OnDidDeminiaturize(fn EventHandler)
func (*Window) OnDidMiniaturize ¶
func (wnd *Window) OnDidMiniaturize(fn EventHandler)
func (*Window) OnDidMove ¶
func (wnd *Window) OnDidMove(fn EventHandler)
func (*Window) OnDidResize ¶
func (wnd *Window) OnDidResize(fn EventHandler)
func (*Window) OnShouldClose ¶ added in v0.3.2
func (wnd *Window) OnShouldClose(fn EventHandler)