2023-02-23 18:54:05 +01:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* gimpmenushell.h
|
|
|
|
* Copyright (C) 2023 Jehan
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GIMP_MENU_SHELL_H__
|
|
|
|
#define __GIMP_MENU_SHELL_H__
|
|
|
|
|
|
|
|
|
|
|
|
#define GIMP_TYPE_MENU_SHELL (gimp_menu_shell_get_type ())
|
|
|
|
#define GIMP_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MENU_SHELL, GimpMenuShell))
|
|
|
|
#define GIMP_IS_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MENU_SHELL))
|
|
|
|
#define GIMP_MENU_SHELL_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE((obj), GIMP_TYPE_MENU_SHELL, GimpMenuShellInterface))
|
|
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
GIMP_MENU_SHELL_PROP_0,
|
|
|
|
GIMP_MENU_SHELL_PROP_MANAGER,
|
app: new GimpMenuModel object, which is our own implementation of GMenuModel.
Since GAction don't have labels or visibility, it is up to every application to
fill the GMenuModel with such infos. In my previous implementation, I was simply
handling these in GimpMenuShell subclasses (GimpMenu, GimpToolbar and
GimpMenuBar) since we need them for tooltip support (unavailable from GMenu).
Nevertheless there are cases where we want to use GTK API directly with a
GMenuModel, in particular with gtk_application_set_menubar(). This is necessary
to handle the macOS specific code path, where we don't want our usual menu bar.
This OS has its own display of a software menu bar, directly in the desktop GUI.
See !558 for some screenshots of this.
So this commit moves around some code away from GimpMenuShell subclasses into
the new GimpMenuModel class. Now we use this new class instead of simpler GMenu
objects. It handles syncing with GimpAction-s, auto-updating labels, visibility
and sensitivity, as well as adding custom items (plug-in actions, recently
opened files, opened images, etc.).
2023-03-06 21:40:13 +01:00
|
|
|
GIMP_MENU_SHELL_PROP_MODEL,
|
2023-02-23 18:54:05 +01:00
|
|
|
|
app: new GimpMenuModel object, which is our own implementation of GMenuModel.
Since GAction don't have labels or visibility, it is up to every application to
fill the GMenuModel with such infos. In my previous implementation, I was simply
handling these in GimpMenuShell subclasses (GimpMenu, GimpToolbar and
GimpMenuBar) since we need them for tooltip support (unavailable from GMenu).
Nevertheless there are cases where we want to use GTK API directly with a
GMenuModel, in particular with gtk_application_set_menubar(). This is necessary
to handle the macOS specific code path, where we don't want our usual menu bar.
This OS has its own display of a software menu bar, directly in the desktop GUI.
See !558 for some screenshots of this.
So this commit moves around some code away from GimpMenuShell subclasses into
the new GimpMenuModel class. Now we use this new class instead of simpler GMenu
objects. It handles syncing with GimpAction-s, auto-updating labels, visibility
and sensitivity, as well as adding custom items (plug-in actions, recently
opened files, opened images, etc.).
2023-03-06 21:40:13 +01:00
|
|
|
GIMP_MENU_SHELL_PROP_LAST = GIMP_MENU_SHELL_PROP_MODEL,
|
2023-02-23 18:54:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _GimpMenuShellInterface GimpMenuShellInterface;
|
|
|
|
|
|
|
|
struct _GimpMenuShellInterface
|
|
|
|
{
|
|
|
|
GTypeInterface base_interface;
|
2023-03-02 01:01:52 +01:00
|
|
|
|
2023-03-30 14:53:01 +02:00
|
|
|
/* Signals */
|
|
|
|
|
|
|
|
void (* model_deleted) (GimpMenuShell *shell);
|
|
|
|
|
2023-03-02 01:01:52 +01:00
|
|
|
/* Virtual functions. */
|
|
|
|
|
2023-03-30 14:53:01 +02:00
|
|
|
void (* append) (GimpMenuShell *shell,
|
|
|
|
GimpMenuModel *model);
|
|
|
|
void (* add_ui) (GimpMenuShell *shell,
|
|
|
|
const gchar **paths,
|
|
|
|
const gchar *action_name,
|
|
|
|
const gchar *placeholder_key,
|
|
|
|
gboolean top);
|
|
|
|
void (* remove_ui) (GimpMenuShell *shell,
|
|
|
|
const gchar **paths,
|
|
|
|
const gchar *action_name);
|
2023-02-23 18:54:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
GType gimp_menu_shell_get_type (void) G_GNUC_CONST;
|
|
|
|
|
|
|
|
void gimp_menu_shell_fill (GimpMenuShell *shell,
|
app: new GimpMenuModel object, which is our own implementation of GMenuModel.
Since GAction don't have labels or visibility, it is up to every application to
fill the GMenuModel with such infos. In my previous implementation, I was simply
handling these in GimpMenuShell subclasses (GimpMenu, GimpToolbar and
GimpMenuBar) since we need them for tooltip support (unavailable from GMenu).
Nevertheless there are cases where we want to use GTK API directly with a
GMenuModel, in particular with gtk_application_set_menubar(). This is necessary
to handle the macOS specific code path, where we don't want our usual menu bar.
This OS has its own display of a software menu bar, directly in the desktop GUI.
See !558 for some screenshots of this.
So this commit moves around some code away from GimpMenuShell subclasses into
the new GimpMenuModel class. Now we use this new class instead of simpler GMenu
objects. It handles syncing with GimpAction-s, auto-updating labels, visibility
and sensitivity, as well as adding custom items (plug-in actions, recently
opened files, opened images, etc.).
2023-03-06 21:40:13 +01:00
|
|
|
GimpMenuModel *model,
|
2023-02-28 15:35:12 +01:00
|
|
|
gboolean drop_top_submenu);
|
2023-02-23 18:54:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Protected functions. */
|
|
|
|
|
app: new GimpMenuModel object, which is our own implementation of GMenuModel.
Since GAction don't have labels or visibility, it is up to every application to
fill the GMenuModel with such infos. In my previous implementation, I was simply
handling these in GimpMenuShell subclasses (GimpMenu, GimpToolbar and
GimpMenuBar) since we need them for tooltip support (unavailable from GMenu).
Nevertheless there are cases where we want to use GTK API directly with a
GMenuModel, in particular with gtk_application_set_menubar(). This is necessary
to handle the macOS specific code path, where we don't want our usual menu bar.
This OS has its own display of a software menu bar, directly in the desktop GUI.
See !558 for some screenshots of this.
So this commit moves around some code away from GimpMenuShell subclasses into
the new GimpMenuModel class. Now we use this new class instead of simpler GMenu
objects. It handles syncing with GimpAction-s, auto-updating labels, visibility
and sensitivity, as well as adding custom items (plug-in actions, recently
opened files, opened images, etc.).
2023-03-06 21:40:13 +01:00
|
|
|
void gimp_menu_shell_append (GimpMenuShell *shell,
|
|
|
|
GimpMenuModel *model);
|
|
|
|
|
2023-02-23 18:54:05 +01:00
|
|
|
void gimp_menu_shell_init (GimpMenuShell *shell);
|
|
|
|
void gimp_menu_shell_install_properties (GObjectClass *klass);
|
|
|
|
void gimp_menu_shell_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
void gimp_menu_shell_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
2023-03-02 01:01:52 +01:00
|
|
|
GimpUIManager * gimp_menu_shell_get_manager (GimpMenuShell *shell);
|
|
|
|
|
2023-02-23 18:54:05 +01:00
|
|
|
|
|
|
|
#endif /* __GIMP_MENU_SHELL_H__ */
|