~eliasnaur/gio

1

Pop-up menus and other layered drawing

Ian Bruene
Details
Message ID
<5a743e19-f349-430d-10fc-7cbfa127da4a@gmail.com>
DKIM signature
pass
Download raw message
I am building a GUI tool for a project and have been looking at gio 
because it seems to be one of the few libraries that takes cross 
platform seriously, is actively maintained, and isn't a port of a port 
of a port.

The original program this is being built after makes extensive use of 
popup menus for settings and option switches. I know there are large 
parts of hypothetical future functionality that don't exist yet, but I'm 
also not seeing anything that I recognize as drawing over other parts of 
the interface (as a menu would). Am I missing something, or does this 
functionality not exist yet?

Also in reading some of the mailing list traffic before posting I got 
the impression that gio is more oriented towards phone-style interfaces 
than I thought. Is this impression correct?

-- 
"In the end; what separates a Man, from a Slave? Money? Power? No. A Man 
Chooses, a Slave Obeys." -- Andrew Ryan
"Utopia cannot precede the Utopian. It will exist the moment we are fit 
to occupy it." -- Sophia Lamb
Details
Message ID
<CAFcc3FS21vHGo1N50f6R3VGbHJR5s7ddqyHEzrxx8tAFtcgOfg@mail.gmail.com>
In-Reply-To
<5a743e19-f349-430d-10fc-7cbfa127da4a@gmail.com> (view parent)
DKIM signature
pass
Download raw message
Hi Ian!

> I am building a GUI tool for a project and have been looking at gio
> because it seems to be one of the few libraries that takes cross
> platform seriously, is actively maintained, and isn't a port of a port
> of a port.

We do take cross platform support seriously, and I'm glad that it shows!

> The original program this is being built after makes extensive use of
> popup menus for settings and option switches. I know there are large
> parts of hypothetical future functionality that don't exist yet, but I'm
> also not seeing anything that I recognize as drawing over other parts of
> the interface (as a menu would). Am I missing something, or does this
> functionality not exist yet?

Until recently (last 3-4 months) it didn't exist. Now that it does,
there just aren't a ton of examples that leverage it in the wild yet.
The key functionality you're looking for is the op.DeferOp, which lets
you provide some content that will be rendered after all other content
and outside of its parent's clip. This enables context menus that
extend beyond the bounds of their parents and such.

https://pkg.go.dev/gioui.org/op#Defer

For an example of actually building context menus and popups, you
could look at some of my recent work in gioui.org/x/component. I'm
just about done adding context menus that take advantage of this
feature. They're currently in a branch called `menu`, but I hope to
merge support over the weekend. There's an example program for using
them as well in the `menu` branch of the examples repo.

https://git.sr.ht/~whereswaldon/gio-x/tree/menu/item/component/menu.go
https://git.sr.ht/~eliasnaur/gio-example/tree/menu/item/x/component/main.go

> Also in reading some of the mailing list traffic before posting I got
> the impression that gio is more oriented towards phone-style interfaces
> than I thought. Is this impression correct?

No, but I can see why you might think so. We do end up paying a lot of
attention to phone interfaces, but mostly because supporting them is
more difficult. It's easy(ish) to build things that work on all
desktops, but making sure that the abstractions in use are also
appropriate and implementable on modern phone OSes can be tricky. I
often work on sprig, which is a single codebase that runs as both
desktop and mobile apps on every mainstream OS gio supports, and it's
tricky to make design decisions that can support both kinds of
platform.

https://git.sr.ht/~whereswaldon/sprig

Welcome to the gio community!
Chris
Reply to thread Export thread (mbox)