Documentation ¶
Index ¶
- Constants
- type Alert
- type AlertClicked
- type Application
- type FontWeight
- type ItemType
- type MenuItem
- type MenuState
- type Notification
- type UserDefaults
- func (u *UserDefaults) Boolean(key string) bool
- func (u *UserDefaults) Integer(key string) int
- func (u *UserDefaults) Marshal(key string, v interface{}) error
- func (u *UserDefaults) SetBoolean(key string, value bool)
- func (u *UserDefaults) SetInteger(key string, value int)
- func (u *UserDefaults) SetString(key, value string)
- func (u *UserDefaults) String(key string) string
- func (u *UserDefaults) Unmarshal(key string, v interface{}) error
Constants ¶
const ( // WeightUltraLight is equivalent to NSFontWeightUltraLight WeightUltraLight FontWeight = -0.8 // WeightThin is equivalent to NSFontWeightThin WeightThin = -0.6 // WeightLight is equivalent to NSFontWeightLight WeightLight = -0.4 // WeightRegular is equivalent to NSFontWeightRegular, and is the default WeightRegular = 0 // WeightMedium is equivalent to NSFontWeightMedium WeightMedium = 0.23 // WeightSemibold is equivalent to NSFontWeightSemibold WeightSemibold = 0.3 // WeightBold is equivalent to NSFontWeightBold WeightBold = 0.4 // WeightHeavy is equivalent to NSFontWeightHeavy WeightHeavy = 0.56 // WeightBlack is equivalent to NSFontWeightBlack WeightBlack = 0.62 )
const ( // Regular is a normal item with text and optional callback Regular ItemType = "" // Separator is a horizontal line Separator = "separator" // Root is the top level menu directly off the menubar Root = "root" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertClicked ¶
AlertClicked represents a selected alert button
type Application ¶
type Application struct { Name string Label string // Children returns the top level children Children func() []MenuItem // If Version and Repo are set, checks for updates every day AutoUpdate struct { Version string Repo string // For example "caseymrm/menuet" } // NotificationResponder is a handler called when notification respond NotificationResponder func(id, response string) // contains filtered or unexported fields }
Application represents the OSX application
func (*Application) Alert ¶
func (a *Application) Alert(alert Alert) AlertClicked
Alert shows an alert, and returns the index of the button pressed, or -1 if none
func (*Application) MenuChanged ¶
func (a *Application) MenuChanged()
MenuChanged refreshes any open menus
func (*Application) Notification ¶
func (a *Application) Notification(notification Notification)
Notification shows a notification to the user. Note that you have to be part of a proper application bundle for them to show up.
func (*Application) RunApplication ¶
func (a *Application) RunApplication()
RunApplication does not return
func (*Application) SetMenuState ¶
func (a *Application) SetMenuState(state *MenuState)
SetMenuState changes what is shown in the dropdown
type MenuItem ¶
type MenuItem struct { Type ItemType Text string Image string // In Resources dir or URL, should have height 16 FontSize int // Default: 14 FontWeight FontWeight State bool // shows checkmark when set Clicked func() `json:"-"` Children func() []MenuItem `json:"-"` }
MenuItem represents one item in the dropdown
type MenuState ¶
type MenuState struct { Title string Image string // // In Resources dir or URL, should have height 22 }
MenuState represents the title and drop down,
type Notification ¶
type Notification struct { // The basic text of the notification Title string Subtitle string Message string // These add an optional action button, change what the close button says, and adds an in-line reply ActionButton string CloseButton string ResponsePlaceholder string // Duplicate identifiers do not re-display, but instead update the notification center Identifier string // If true, the notification is shown, but then deleted from the notification center RemoveFromNotificationCenter bool }
Notification represents an NSUserNotification
type UserDefaults ¶
type UserDefaults struct {
// contains filtered or unexported fields
}
UserDefaults represents values stored in NSUserDefaults
func (*UserDefaults) Boolean ¶
func (u *UserDefaults) Boolean(key string) bool
Boolean gets a boolean default, 0 if not set
func (*UserDefaults) Integer ¶
func (u *UserDefaults) Integer(key string) int
Integer gets an integer default, 0 if not set
func (*UserDefaults) Marshal ¶
func (u *UserDefaults) Marshal(key string, v interface{}) error
Marshal marshals an object into JSON and stores it in user defaults, see json.Marshal docs
func (*UserDefaults) SetBoolean ¶
func (u *UserDefaults) SetBoolean(key string, value bool)
SetBoolean sets a boolean default
func (*UserDefaults) SetInteger ¶
func (u *UserDefaults) SetInteger(key string, value int)
SetInteger sets an integer default
func (*UserDefaults) SetString ¶
func (u *UserDefaults) SetString(key, value string)
SetString sets a string default
func (*UserDefaults) String ¶
func (u *UserDefaults) String(key string) string
String gets a string default, "" if not set
func (*UserDefaults) Unmarshal ¶
func (u *UserDefaults) Unmarshal(key string, v interface{}) error
Unmarshal unmarshals an object from JSON that was stored in user defaults, see json.Unmarshal docs