kopia lustrzana https://gitlab.com/sane-project/frontends
Add menu functions
rodzic
30b61a04e6
commit
7b950bf75a
|
@ -88,3 +88,45 @@ gtk_window_set_position_with_mouse (GtkWindow *window)
|
|||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void
|
||||
create_item ( GMenu *menu,
|
||||
const gchar *const label,
|
||||
const gchar *const action,
|
||||
const gchar *const icon,
|
||||
const gchar *const target,
|
||||
const gchar *const accel )
|
||||
{
|
||||
g_return_if_fail ( G_IS_MENU ( menu ) );
|
||||
|
||||
GMenuItem *item = g_menu_item_new ( NULL, NULL );
|
||||
g_menu_item_set_attribute ( item, G_MENU_ATTRIBUTE_LABEL, "s", label, NULL );
|
||||
g_menu_item_set_attribute ( item, G_MENU_ATTRIBUTE_ACTION, "s", action, NULL );
|
||||
g_menu_item_set_attribute ( item, G_MENU_ATTRIBUTE_ICON, "s", icon, NULL );
|
||||
|
||||
if ( target )
|
||||
{
|
||||
g_menu_item_set_attribute ( item, "target", "s", target, NULL );
|
||||
}
|
||||
|
||||
g_menu_item_set_attribute ( item, "accel", "s", accel, NULL );
|
||||
g_menu_append_item ( menu, item );
|
||||
|
||||
g_object_unref ( item );
|
||||
}
|
||||
|
||||
void
|
||||
create_submenu_item ( GMenu *menu,
|
||||
GMenu *submenu,
|
||||
const gchar *const label )
|
||||
{
|
||||
g_return_if_fail ( G_IS_MENU ( menu ) );
|
||||
|
||||
GMenuItem *item = g_menu_item_new ( NULL, NULL );
|
||||
|
||||
g_menu_item_set_attribute ( item, G_MENU_ATTRIBUTE_LABEL, "s", label, NULL );
|
||||
g_menu_item_set_submenu ( item, G_MENU_MODEL ( submenu ) );
|
||||
g_menu_append_item ( menu, item );
|
||||
|
||||
g_object_unref ( item );
|
||||
}
|
||||
|
|
|
@ -28,5 +28,7 @@ void gtk_container_set_border_width (GtkWidget *widget, int width);
|
|||
void gtk_box_pack_start (GtkBox *box, GtkWidget* child, gboolean expand, gboolean fill, guint padding);
|
||||
void gtk_box_pack_end (GtkBox *box, GtkWidget* child, gboolean expand, gboolean fill, guint padding);
|
||||
// void gtk_window_set_position_with_mouse (GtkWindow *window);
|
||||
void create_submenu_item (GMenu *menu, GMenu *submenu, const gchar *const label);
|
||||
void create_item (GMenu *menu, const gchar *const label, const gchar *const action, const gchar *const icon, const gchar *const target, const gchar *const accel);
|
||||
|
||||
#endif
|
||||
|
|
Ładowanie…
Reference in New Issue