Commit Graph

347 Commits

Author SHA1 Message Date
Matthias Clasen
3c165b3b77 Drop GtkBin
It is no longer used anywhere.
2020-05-04 22:53:08 -04:00
Alexander Mikhaylenko
4aa8f6f73c Add GtkWindowControls
Move some code out of GtkHeaderBar and into a separate widget, making it
reusable in process.

See https://gitlab.gnome.org/GNOME/gtk/issues/2242
2020-04-26 15:13:15 +05:00
Benjamin Otte
cd0332aad5 shortcut: Add GtkShortcutAction
Similar to GtkShortcutTrigger, GtkShortCutAction provides all the
different ways to activate a shortcut.

So far, these different ways are supported:

 - do nothing
 - Call a user-provided callback
 - Call gtk_widget_activate()
 - Call gtk_widget_mnemonic_activate()
 - Emit an action signal
 - Activate an action from the widget's action muxer
2020-03-25 23:14:27 -04:00
Emmanuele Bassi
bca1f6b64f gtk: Remove GtkAccelMap
Now that accel paths are gone, the object managing them isn't needed
anymore either.
2020-03-25 23:14:27 -04:00
Emmanuele Bassi
aab10ea43b Add GtkShortcutManager
This adds an interface for taking care of shortcut controllers with
managed scope.

Only GtkWindow currently implements this interface, so we need to ensure
that we check if any top-level widget we reach is a shortcuts manager
before we call into it.
2020-03-25 23:14:27 -04:00
Benjamin Otte
9a03c8b4d8 gtk: Remove bindings
The whole binding functionality is now handled by shortcuts.
2020-03-25 23:14:27 -04:00
Matthias Clasen
6d452f1eb8 shortcut: Add GtkShortcutTrigger
Triggers are meant to describe how to trigger a shortcut.
So far only a keyval + modifiers trigger exists.
2020-03-25 22:36:03 -04:00
Benjamin Otte
d8603864a9 gtk: Add GtkShortcut
This is the base class for what is about to take over all sorts of
keyboard shortcuts. The initial version barely deals with keybindings.
2020-03-25 22:36:03 -04:00
Benjamin Otte
a232107122 shortcutcontroller: Introduce
This is a very barebones controller that currently does nothing but
activate the binding signals. Yay.

And because we have bindings on every widget (Yes, a GtkGrid has a
keybinding - 2 in fact), we need that controller everywhere.
2020-03-25 22:36:03 -04:00
Matthias Clasen
31db615885 Revert "Merge branch 'disable-window-test' into 'master'"
This reverts commit 3ac4c76b18, reversing
changes made to 6ec96d2e98.
2020-03-19 18:03:16 -04:00
Benjamin Otte
e6d0560a82 shortcut: Add GtkShortcutAction
Similar to GtkShortcutTrigger, GtkShortCutAction provides all the
different ways to activate a shortcut.

So far, these different ways are supported:

 - do nothing
 - Call a user-provided callback
 - Call gtk_widget_activate()
 - Call gtk_widget_mnemonic_activate()
 - Emit an action signal
 - Activate an action from the widget's action muxer
 - Activate a GAction
2020-03-18 23:00:51 -04:00
Emmanuele Bassi
b28da74e90 gtk: Remove GtkAccelMap
Now that accel paths are gone, the object managing them isn't needed
anymore either.
2020-03-18 23:00:51 -04:00
Emmanuele Bassi
09400b6bfe Add GtkShortcutManager
This adds an interface for taking care of shortcut controllers with
managed scope.

Only GtkWindow currently implements this interface, so we need to ensure
that we check if any top-level widget we reach is a shortcuts manager
before we call into it.
2020-03-18 23:00:50 -04:00
Benjamin Otte
fb99f834e6 gtk: Remove bindings
The whole binding functionality is now handled by shortcuts.
2020-03-18 23:00:50 -04:00
Matthias Clasen
78f9940ddc shortcut: Add GtkShortcutTrigger
Triggers are meant to describe how to trigger a shortcut.
So far only a keyval + modifiers trigger exists.
2020-03-18 23:00:49 -04:00
Benjamin Otte
ff13ee4b66 gtk: Add GtkShortcut
This is the base class for what is about to take over all sorts of
keyboard shortcuts. The initial version barely deals with keybindings.
2020-03-18 23:00:49 -04:00
Benjamin Otte
5c6be5c0cd shortcutcontroller: Introduce
This is a very barebones controller that currently does nothing but
activate the binding signals. Yay.

And because we have bindings on every widget (Yes, a GtkGrid has a
keybinding - 2 in fact), we need that controller everywhere.
2020-03-18 23:00:49 -04:00
Benjamin Otte
a411959c91 droptarget: Redo
This is a huge reorganization of GtkDropTarget. I did not know how to
split this up, so it's unfortunately all one commit.

Highlights:

- Split GtkDropTarget into GtkDropTarget and GtkDropTargetAsync
  GtkDropTarget is the simple one that only works with GTypes and offers
  a synchronous interface.
  GtkDropTargetAsync retains the full old functionality and allows
  handling mime types.

- Drop events are handled differently
  Instead of picking a single drop target and sending all DND events to
  it, every event is sent to every drop target. The first one to handle
  the event gets to call gdk_drop_status(), further handlers do not
  interact with the GdkDrop.
  Of course, for the ultimate GDK_DROP_STARTING event, only the first
  one to accept the drop gets to handle it.
  This allows stacking DND event controllers that aren't necessarily
  interested in handling the event or that might decide later to drop
  it.

- Port all widgets to either of those
  Both have a somewhat changed API due to the new event handling.
  For the ones who should use the sync version, lots of cleanup was
  involved to operate on a sync API.
2020-03-02 03:18:55 +01:00
Benjamin Otte
a62d78bf70 selection: Remove GtkSelectionData 2020-02-23 01:59:00 +01:00
Benjamin Otte
34e5f36fdf Add GtkDropControllerMotion 2020-02-22 07:33:40 +01:00
Matthias Clasen
5a2f829a40 Split off GtkEventControllerFocus
Split the focus tracking into a separate
GtkEventControllerFocus, and change the API one more time.
We are back to having ::focus-in and ::focus-out signals.

Update all users.
2020-02-21 00:51:03 -05:00
Benjamin Otte
44e153d8a8 GtkToolbar: remove 2020-02-07 14:08:26 +01:00
Matthias Clasen
ef7172dc1e emojichooser: Make public
This is a useful widget to have, and it has minimal api.

Not having it public forces apps to recreate a lot of
complicated machinery for not good reason, if they need
an Emoji chooser in a different context.
2020-02-03 12:49:36 +01:00
Benjamin Otte
49b47c9133 Remove GtkWidgetPath
... and all associated demos and tests.
2020-01-28 02:17:02 +01:00
Matthias Clasen
78832c65b5 Make GtkDragIcon public
This is needed if we want to use gdk_drag_begin
for one-off drags, without a GtkDragSource.
2020-01-08 18:48:21 -05:00
Matthias Clasen
1e000c3dac Remove gtkdnd.h 2020-01-08 18:48:20 -05:00
Matthias Clasen
7ee5779efc gtk: Remove menu code
GtkMenu, GtkMenuBar, GtkMenuItem and their subclasses
and supporting classes are replaced by model-based popover
implementations.
2019-12-29 20:31:58 -05:00
Benjamin Otte
f8a7f30a0d builder: Add GtkBuilderScope
GtkBuilderScope is an interface that provides the scope that a builder
instance operates in.
It creates closures and resolves types. Language bindings are meant to
use this interface to customize the behavior of builder files, in
particular when instantiating templates.

A default implementation for C is provided via GtkBuilderCScope (to keep
with the awkward naming that glib uses for closures). It is derivable on
purpose so that languages or extensions that extend C can use it.

The reftest code in fact does derive GtkBuilderCScope for its own scope
implementation that implements looking up symbols in modules.

gtk-widget-factory was updated to use the new GtkBuilderCScope to add
its custom callback symbols.
So it does it different from gtk-demo, which uses the normal way of
exporting symbols for dlsym() and thereby makes the 2 demos test the 2
ways GtkBuilder uses for looking up symbols.
2019-12-12 19:39:23 +01:00
Matthias Clasen
bfa0509f08 Privatize popover menu pieces
Don't allow manual creation of popover menus
anymore. This lets us also make GtkModelButton
private
2019-11-11 12:42:06 +01:00
Benjamin Otte
1b68e76852 gtk: Add GtkNoSelection
Allows not to have anything selected.
2019-10-15 07:17:07 +02:00
Timm Bäder
a7b9a33efc Add GtkCenterLayout
And use it in GtkCenterBox, different widgets following.
2019-09-13 11:07:54 +02:00
Emmanuele Bassi
cdf80f1d65 Add GtkConstraintLayout
A layout manager using GtkConstraintSolver to measure and allocate
children.
2019-06-30 23:42:44 +01:00
Matthias Clasen
17ec958f30 Rename GtkPopoverBar to GtkPopoverMenuBar
Clarity over beauty.
2019-06-09 17:42:07 +00:00
Matthias Clasen
f91cc6c473 Introduce a popover bar
This is meant to grow into a menubar replacement
with popovers. For now, it is just a box of menubuttons,
and not very much like a menubar at all.
2019-06-09 17:38:54 +00:00
Matthias Clasen
7f65e5f96b Rename GtkGestureMultiPress to GtkGestureClick
The name just made it hard for people to find the
right gesture to use.
2019-05-29 17:10:46 +00:00
Matthias Clasen
12a16a298b Introduce GtkNative
Split off the parts of GtkRoot that are specific
to widgets having a surface into the GtkNative
interface.
2019-05-28 19:54:32 +00:00
Benjamin Otte
2e0a56665a css: Move gtkcsssection.[ch] into gtk/css 2019-04-12 19:34:28 +02:00
Benjamin Otte
a938c14d11 build: Add gtk-css static library
This library is meant to be the new CSS library that gets used from GDK,
GSK and GTK for string printing and parsing.

As a first step, move GtkCssProviderError into it.

While doing so, split it into GtkCssParserError (for critical problems)
and GtkCssParserWarning (for non-critical problems).
2019-04-12 19:34:28 +02:00
Emmanuele Bassi
6e0f1800c8 Add GtkGridLayout
Layout manager for grid-like widgets.
2019-04-03 19:03:58 +01:00
Emmanuele Bassi
447dfc029f Remove GtkLayout
The need of a specialised fixed layout container that can be placed into
a GtkScrolledWindow ceased to exist once GtkScrolledWindow gained the
ability to automatically interpose a GtkViewport when adding a child
that does not implement GtkScrollable.

All the other justifications that led to the existence of GtkLayout as a
separate widget from GtkFixed have been largely made irrelevant in the
20 years since its inception.
2019-04-02 15:29:20 +01:00
Emmanuele Bassi
9a4c19349e Add GtkFixedLayout
A layout manager for fixed positioning.
2019-03-26 17:43:53 +00:00
Emmanuele Bassi
65965bed16 Changes after review
- Rename GtkLegacyLayout to GtkCustomLayout
 - Use for() to iterate over children in GtkBinLayout
 - Whitespace fixes for code imported from GtkBox
 - Store the GtkLayoutChild instances inside LayoutManager
 - Simplify the GtkLayoutManager API by dropping unnecessary arguments
 - Fix the ownership model of GtkLayoutManager
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
d6dfa41f10 Add GtkBinLayout
Like GtkBin, but lets you lay out multiple children instead of just one.
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
ef9863ab63 Add GtkBoxLayout
The same layout policy of GtkBox, without all the GtkContainer calories.
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
5cbf6f5fbd Add GtkLayoutChild
Layout managers needs a way to store properties that control the layout
policy of a widget; typically, we used to store these in GtkContainer's
child properties, but since GtkLayoutManager is decoupled from the
actual container widget, we need a separate storage. Additionally, child
properties have their own downsides, like requiring a separate, global
GParamSpecPool storage, and additional lookup API.

GtkLayoutChild is a simple GObject class, which means you can introspect
and document it as you would any other type.
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
24754c3259 Add GtkLayoutManager
A base abstract class for layout manager delegate objects.

Layout managers are associated to a single widget, like event
controllers, and are responsible for measuring and allocating the
children of the widget they are bound to.
2019-03-26 00:11:27 +00:00
Benjamin Otte
0e1a50366a transform: Move to GSK
The renaming of the prefix makes this a large patch.
2019-03-04 23:09:02 +01:00
Benjamin Otte
49d83820a2 gtk: Add GtkTransform
This is a new object (well, boxed type, but I'm calling it object) for
dealing with transform in a more constructive way than graphene_matrix_t
by keeping track of how the transform was created.

This way, reasoning about the transform becomes easier, and we can create
better ways to print it or transition from one transform to another one.

An example of this is that while a 0 degree and a 360degree rotation are
both the identity matrix, doing a transition between the two would cause
a rotation.
2019-02-21 19:47:27 +01:00
Matthias Clasen
c6e6fb19e7 Add GtkPasswordEntry
This is a simple editable which hides the entered
text and shows a caps-lock warning.
2019-02-19 00:25:59 -05:00
Matthias Clasen
1801bf6d83 Add a GtkText widget
This is a GtkEntry without any of the extras, such as
icons, completion, progress, caps-lock warning, emoji icon.
2019-02-18 14:24:21 -05:00