gmenu.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /*
  2. * Copyright © 2011 Canonical Ltd.
  3. *
  4. * SPDX-License-Identifier: LGPL-2.1-or-later
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  18. *
  19. * Author: Ryan Lortie <desrt@desrt.ca>
  20. */
  21. #ifndef __G_MENU_H__
  22. #define __G_MENU_H__
  23. #include <gio/gmenumodel.h>
  24. G_BEGIN_DECLS
  25. #define G_TYPE_MENU (g_menu_get_type ())
  26. #define G_MENU(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
  27. G_TYPE_MENU, GMenu))
  28. #define G_IS_MENU(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
  29. G_TYPE_MENU))
  30. #define G_TYPE_MENU_ITEM (g_menu_item_get_type ())
  31. #define G_MENU_ITEM(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
  32. G_TYPE_MENU_ITEM, GMenuItem))
  33. #define G_IS_MENU_ITEM(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
  34. G_TYPE_MENU_ITEM))
  35. typedef struct _GMenuItem GMenuItem;
  36. typedef struct _GMenu GMenu;
  37. GIO_AVAILABLE_IN_2_32
  38. GType g_menu_get_type (void) G_GNUC_CONST;
  39. GIO_AVAILABLE_IN_2_32
  40. GMenu * g_menu_new (void);
  41. GIO_AVAILABLE_IN_2_32
  42. void g_menu_freeze (GMenu *menu);
  43. GIO_AVAILABLE_IN_2_32
  44. void g_menu_insert_item (GMenu *menu,
  45. gint position,
  46. GMenuItem *item);
  47. GIO_AVAILABLE_IN_2_32
  48. void g_menu_prepend_item (GMenu *menu,
  49. GMenuItem *item);
  50. GIO_AVAILABLE_IN_2_32
  51. void g_menu_append_item (GMenu *menu,
  52. GMenuItem *item);
  53. GIO_AVAILABLE_IN_2_32
  54. void g_menu_remove (GMenu *menu,
  55. gint position);
  56. GIO_AVAILABLE_IN_2_38
  57. void g_menu_remove_all (GMenu *menu);
  58. GIO_AVAILABLE_IN_2_32
  59. void g_menu_insert (GMenu *menu,
  60. gint position,
  61. const gchar *label,
  62. const gchar *detailed_action);
  63. GIO_AVAILABLE_IN_2_32
  64. void g_menu_prepend (GMenu *menu,
  65. const gchar *label,
  66. const gchar *detailed_action);
  67. GIO_AVAILABLE_IN_2_32
  68. void g_menu_append (GMenu *menu,
  69. const gchar *label,
  70. const gchar *detailed_action);
  71. GIO_AVAILABLE_IN_2_32
  72. void g_menu_insert_section (GMenu *menu,
  73. gint position,
  74. const gchar *label,
  75. GMenuModel *section);
  76. GIO_AVAILABLE_IN_2_32
  77. void g_menu_prepend_section (GMenu *menu,
  78. const gchar *label,
  79. GMenuModel *section);
  80. GIO_AVAILABLE_IN_2_32
  81. void g_menu_append_section (GMenu *menu,
  82. const gchar *label,
  83. GMenuModel *section);
  84. GIO_AVAILABLE_IN_2_32
  85. void g_menu_insert_submenu (GMenu *menu,
  86. gint position,
  87. const gchar *label,
  88. GMenuModel *submenu);
  89. GIO_AVAILABLE_IN_2_32
  90. void g_menu_prepend_submenu (GMenu *menu,
  91. const gchar *label,
  92. GMenuModel *submenu);
  93. GIO_AVAILABLE_IN_2_32
  94. void g_menu_append_submenu (GMenu *menu,
  95. const gchar *label,
  96. GMenuModel *submenu);
  97. GIO_AVAILABLE_IN_2_32
  98. GType g_menu_item_get_type (void) G_GNUC_CONST;
  99. GIO_AVAILABLE_IN_2_32
  100. GMenuItem * g_menu_item_new (const gchar *label,
  101. const gchar *detailed_action);
  102. GIO_AVAILABLE_IN_2_34
  103. GMenuItem * g_menu_item_new_from_model (GMenuModel *model,
  104. gint item_index);
  105. GIO_AVAILABLE_IN_2_32
  106. GMenuItem * g_menu_item_new_submenu (const gchar *label,
  107. GMenuModel *submenu);
  108. GIO_AVAILABLE_IN_2_32
  109. GMenuItem * g_menu_item_new_section (const gchar *label,
  110. GMenuModel *section);
  111. GIO_AVAILABLE_IN_2_34
  112. GVariant * g_menu_item_get_attribute_value (GMenuItem *menu_item,
  113. const gchar *attribute,
  114. const GVariantType *expected_type);
  115. GIO_AVAILABLE_IN_2_34
  116. gboolean g_menu_item_get_attribute (GMenuItem *menu_item,
  117. const gchar *attribute,
  118. const gchar *format_string,
  119. ...);
  120. GIO_AVAILABLE_IN_2_34
  121. GMenuModel *g_menu_item_get_link (GMenuItem *menu_item,
  122. const gchar *link);
  123. GIO_AVAILABLE_IN_2_32
  124. void g_menu_item_set_attribute_value (GMenuItem *menu_item,
  125. const gchar *attribute,
  126. GVariant *value);
  127. GIO_AVAILABLE_IN_2_32
  128. void g_menu_item_set_attribute (GMenuItem *menu_item,
  129. const gchar *attribute,
  130. const gchar *format_string,
  131. ...);
  132. GIO_AVAILABLE_IN_2_32
  133. void g_menu_item_set_link (GMenuItem *menu_item,
  134. const gchar *link,
  135. GMenuModel *model);
  136. GIO_AVAILABLE_IN_2_32
  137. void g_menu_item_set_label (GMenuItem *menu_item,
  138. const gchar *label);
  139. GIO_AVAILABLE_IN_2_32
  140. void g_menu_item_set_submenu (GMenuItem *menu_item,
  141. GMenuModel *submenu);
  142. GIO_AVAILABLE_IN_2_32
  143. void g_menu_item_set_section (GMenuItem *menu_item,
  144. GMenuModel *section);
  145. GIO_AVAILABLE_IN_2_32
  146. void g_menu_item_set_action_and_target_value (GMenuItem *menu_item,
  147. const gchar *action,
  148. GVariant *target_value);
  149. GIO_AVAILABLE_IN_2_32
  150. void g_menu_item_set_action_and_target (GMenuItem *menu_item,
  151. const gchar *action,
  152. const gchar *format_string,
  153. ...);
  154. GIO_AVAILABLE_IN_2_32
  155. void g_menu_item_set_detailed_action (GMenuItem *menu_item,
  156. const gchar *detailed_action);
  157. GIO_AVAILABLE_IN_2_38
  158. void g_menu_item_set_icon (GMenuItem *menu_item,
  159. GIcon *icon);
  160. G_END_DECLS
  161. #endif /* __G_MENU_H__ */