lxn / walk

A Windows GUI toolkit for the Go Programming Language
Other
6.83k stars 884 forks source link

Frameless window like on Game Launchers #472

Open majimboo opened 5 years ago

majimboo commented 5 years ago

Can I use dialog without the titlebar? And use a custom image for the window with transparency? And use images for buttons on hover and on click? Custom image for progress bar?

Like how they do MMORPG patchers:

5E70D875-5C4F-4FE4-B065-8A6E05FBFE30

lxn commented 5 years ago

Out-of-the-box this is not possible. Hidden title bar and transparent window stuff shouldn't be too much work for me to support. You would have to paint custom button and progress bar visuals yourself though, probably having to come up with completely custom widgets similar to the externalwidgets example, but embedding CustomWidget instead of WidgetBase.

majimboo commented 5 years ago

Thank you for the information. Looking forward for the frameless window implementation.

majimboo commented 5 years ago

Here is my suggestion for the borderless window:

dialog.go

func NewDialog(owner Form) (*Dialog, error) {
    return newDialogWithStyle(owner, win.WS_THICKFRAME|win.WS_CAPTION|win.WS_SYSMENU)
}

func NewDialogWithFixedSize(owner Form) (*Dialog, error) {
    return newDialogWithStyle(owner, win.WS_CAPTION|win.WS_SYSMENU)
}

func NewBorderlessDialog(owner Form) (*Dialog, error) {
    return newDialogWithStyle(owner, win.WS_POPUP|win.WS_THICKFRAME)
}

func newDialogWithStyle(owner Form, style uint32) (*Dialog, error) {
    dlg := &Dialog{
        FormBase: FormBase{
            owner: owner,
        },
    }

    if err := InitWindow(
        dlg,
        owner,
        dialogWindowClass,
        style,
        0); err != nil {
        return nil, err
    }

    succeeded := false
    defer func() {
        if !succeeded {
            dlg.Dispose()
        }
    }()

    dlg.centerInOwnerWhenRun = owner != nil

    dlg.result = DlgCmdNone

    succeeded = true

    return dlg, nil
}

and on declarative:

    if d.FixedSize {
        w, err = walk.NewDialogWithFixedSize(owner)
    } else if d.Borderless {
        w, err = walk.NewBorderlessDialog(owner)
    } else {
        w, err = walk.NewDialog(owner)
    }
majimboo commented 4 years ago

Hello, is there an update to this for built in support?