Documentation ¶
Index ¶
- func ShowEntry(ctx context.Context, entry *set.Entry) (r res.Entry, err error)
- func ShowFileSave(ctx context.Context, s *set.FileSave) (res.File, error)
- func ShowFileSelection(ctx context.Context, s *set.FileSelection) (res.File, error)
- func ShowMessage(ctx context.Context, msg *set.Message) (r res.Message, err error)
- func ShowNotification(ctx context.Context, s *set.Notification) error
- func ShowOptions(ctx context.Context, opts *set.Options) (r res.Options, err error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShowEntry ¶
Example ¶
package main import ( "runtime" "github.com/gabyx/githooks/githooks/apps/dialog/gui" "github.com/gabyx/githooks/githooks/apps/dialog/settings" ) func main() { t := settings.Entry{} t.Title = "SpamMails Remove" t.OkLabel = "Accept it" t.CancelLabel = "Cancel it" t.DefaultCancel = true if runtime.GOOS != "darwin" { t.ExtraButtons = []string{"Midnight"} } t.Text = "Enter the time:" t.DefaultEntry = "10:30" t.Width = 300 t.Height = 500 t.Icon = settings.InfoIcon t.WindowIcon = settings.InfoIcon _, _ = gui.ShowEntry(nil, &t) // nolint: staticcheck }
Output:
func ShowFileSave ¶
Example ¶
package main import ( "fmt" "os" "github.com/gabyx/githooks/githooks/apps/dialog/gui" "github.com/gabyx/githooks/githooks/apps/dialog/settings" ) func main() { t := &settings.FileSave{} t.Title = "Save the pizza to your desktop:" t.Width = 300 t.Height = 500 t.ConfirmOverwrite = true t.ConfirmCreate = true t.FileFilters = []settings.FileFilter{{Name: "Dev", Patterns: []string{"*.go", "*.sh"}}} t.Filename = "MySuperFile/Pizza.dat" t.Root = "../.." t.OnlyDirectories = false t.WindowIcon = settings.QuestionIcon f, e := gui.ShowFileSave(nil, t) // nolint: staticcheck fmt.Fprintf(os.Stderr, "%v, %v", f, e) }
Output:
func ShowFileSelection ¶
Example ¶
package main import ( "fmt" "os" "github.com/gabyx/githooks/githooks/apps/dialog/gui" "github.com/gabyx/githooks/githooks/apps/dialog/settings" ) func main() { t := settings.FileSelection{} t.Title = "Select your pizzas:" t.Width = 300 t.Height = 500 t.FileFilters = []settings.FileFilter{{Name: "Dev", Patterns: []string{"*.go", "*.sh"}}} t.Filename = "MySuperFile.dat" t.Root = "../.." t.MultipleSelection = true t.WindowIcon = settings.QuestionIcon t.ShowHidden = false f, e := gui.ShowFileSelection(nil, &t) // nolint: staticcheck fmt.Fprintf(os.Stderr, "%v, %v", f, e) }
Output:
func ShowMessage ¶
Example ¶
package main import ( "github.com/gabyx/githooks/githooks/apps/dialog/gui" "github.com/gabyx/githooks/githooks/apps/dialog/settings" ) func main() { t := settings.Message{} t.Title = "SpamMails Alert" t.OkLabel = "Okey" t.CancelLabel = "Cancel it" t.Text = "You have 200 spam mails in your mailbox, you should remove them sooooooon." t.Width = 300 t.Height = 500 t.WindowIcon = settings.ErrorIcon t.Icon = settings.ErrorIcon t.Style = settings.ErrorStyle _, _ = gui.ShowMessage(nil, &t) // nolint: staticcheck t.Icon = settings.WarningIcon _, _ = gui.ShowMessage(nil, &t) // nolint: staticcheck t.Icon = settings.InfoIcon _, _ = gui.ShowMessage(nil, &t) // nolint: staticcheck }
Output:
func ShowNotification ¶
func ShowNotification(ctx context.Context, s *set.Notification) error
Example ¶
package main import ( "github.com/gabyx/githooks/githooks/apps/dialog/gui" "github.com/gabyx/githooks/githooks/apps/dialog/settings" ) func main() { t := settings.Notification{} t.Title = "Hura: Your pizza has arrived." t.Text = "Remove the card box and enjoy your stupid Hawai-Style Pizza.\nWuaaaaaaaa...." t.Width = 300 t.Height = 500 t.WindowIcon = settings.WarningIcon _ = gui.ShowNotification(nil, &t) // nolint: staticcheck }
Output:
func ShowOptions ¶
Example ¶
package main import ( "github.com/gabyx/githooks/githooks/apps/dialog/gui" "github.com/gabyx/githooks/githooks/apps/dialog/settings" ) func main() { t := settings.Options{} t.Title = "What pizza do you want to order?" t.OkLabel = "Okey" t.CancelLabel = "Cancel it" t.Text = "Choose a pizza from below:" t.Options = []string{"Margherita", "Curry & Banana", "Hawai-Style"} t.MultipleSelection = true t.Width = 300 t.Height = 500 t.WindowIcon = settings.QuestionIcon _, _ = gui.ShowOptions(nil, &t) // nolint: staticcheck }
Output:
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.