You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

250 lines
12 KiB

  1. /*
  2. * Copyright (C) 2008-2010 Nick Schermer <nick@xfce.org>
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. /* #if !defined(LIBXFCE4PANEL_INSIDE_LIBXFCE4PANEL_H) && !defined(LIBXFCE4PANEL_COMPILATION)
  19. #error "Only <libxfce4panel/libxfce4panel.h> can be included directly, this file may disappear or change contents"
  20. #endif */
  21. #ifndef __XFCE_PANEL_PLUGIN_H__
  22. #define __XFCE_PANEL_PLUGIN_H__
  23. #include <gtk/gtk.h>
  24. #include <libxfce4panel/libxfce4panel-enums.h>
  25. #include <libxfce4panel/xfce-panel-macros-46.h>
  26. G_BEGIN_DECLS
  27. typedef struct _XfcePanelPluginPrivate XfcePanelPluginPrivate;
  28. typedef struct _XfcePanelPluginClass XfcePanelPluginClass;
  29. typedef struct _XfcePanelPlugin XfcePanelPlugin;
  30. /**
  31. * XfcePanelPluginFunc:
  32. * @plugin : an #XfcePanelPlugin
  33. *
  34. * Callback function to create the plugin contents. It should be given as
  35. * the argument to the registration macros.
  36. **/
  37. typedef void (*XfcePanelPluginFunc) (XfcePanelPlugin *plugin);
  38. /**
  39. * XfcePanelPluginPreInit:
  40. * @argc: number of arguments to the plugin
  41. * @argv: argument array
  42. *
  43. * Callback function that is run in an external plugin before gtk_init(). It
  44. * should return %FALSE if the plugin is not available for whatever reason.
  45. * The function can be given as argument to one of the registration macros.
  46. *
  47. * The main purpose of this callback is to allow multithreaded plugins to call
  48. * g_thread_init().
  49. *
  50. * Returns: %TRUE on success, %FALSE otherwise.
  51. *
  52. * Since: 4.6
  53. **/
  54. typedef gboolean (*XfcePanelPluginPreInit) (gint argc,
  55. gchar **argv);
  56. /**
  57. * XfcePanelPluginCheck:
  58. * @screen : the #GdkScreen the panel is running on
  59. *
  60. * Callback function that is run before creating a plugin. It should return
  61. * %FALSE if the plugin is not available for whatever reason. The function
  62. * can be given as argument to one of the registration macros.
  63. *
  64. * Returns: %TRUE if the plugin can be started, %FALSE otherwise.
  65. **/
  66. typedef gboolean (*XfcePanelPluginCheck) (GdkScreen *screen);
  67. #define XFCE_TYPE_PANEL_PLUGIN (xfce_panel_plugin_get_type ())
  68. #define XFCE_PANEL_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_PANEL_PLUGIN, XfcePanelPlugin))
  69. #define XFCE_PANEL_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_PANEL_PLUGIN, XfcePanelPluginClass))
  70. #define XFCE_IS_PANEL_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_PANEL_PLUGIN))
  71. #define XFCE_IS_PANEL_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_PANEL_PLUGIN))
  72. #define XFCE_PANEL_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_PANEL_PLUGIN, XfcePanelPluginClass))
  73. /**
  74. * XfcePanelPluginClass:
  75. * @construct : This function is for object orientated plugins and
  76. * triggered after the init function of the object.
  77. * When this function is triggered, the plugin
  78. * information like name, display name, comment and unique
  79. * id are available. This is also the place where you would
  80. * call functions like xfce_panel_plugin_menu_show_configure().
  81. * You can see this as the replacement of #XfcePanelPluginFunc
  82. * for object based plugins. Since 4.8.
  83. * @screen_position_changed : See #XfcePanelPlugin::screen-position-changed for more information.
  84. * @size_changed : See #XfcePanelPlugin::size-changed for more information.
  85. * @orientation_changed : See #XfcePanelPlugin::orientation-changed for more information.
  86. * @free_data : See #XfcePanelPlugin::free-data for more information.
  87. * @save : See #XfcePanelPlugin::save for more information.
  88. * @about : See #XfcePanelPlugin::about for more information.
  89. * @configure_plugin : See #XfcePanelPlugin::configure-plugin for more information.
  90. * @removed : See #XfcePanelPlugin::removed for more information.
  91. * @remote_event : See #XfcePanelPlugin::remote-event for more information.
  92. *
  93. * Class of an #XfcePanelPlugin. The interface can be used to create GObject based plugin.
  94. **/
  95. struct _XfcePanelPluginClass
  96. {
  97. /*< private >*/
  98. GtkEventBoxClass __parent__;
  99. /*< public >*/
  100. /* for object oriented plugins only */
  101. void (*construct) (XfcePanelPlugin *plugin);
  102. /* signals */
  103. void (*screen_position_changed) (XfcePanelPlugin *plugin,
  104. XfceScreenPosition position);
  105. gboolean (*size_changed) (XfcePanelPlugin *plugin,
  106. gint size);
  107. void (*orientation_changed) (XfcePanelPlugin *plugin,
  108. GtkOrientation orientation);
  109. void (*free_data) (XfcePanelPlugin *plugin);
  110. void (*save) (XfcePanelPlugin *plugin);
  111. void (*about) (XfcePanelPlugin *plugin);
  112. void (*configure_plugin) (XfcePanelPlugin *plugin);
  113. void (*removed) (XfcePanelPlugin *plugin);
  114. gboolean (*remote_event) (XfcePanelPlugin *plugin,
  115. const gchar *name,
  116. const GValue *value);
  117. /* new in 4.10 */
  118. void (*mode_changed) (XfcePanelPlugin *plugin,
  119. XfcePanelPluginMode mode);
  120. void (*nrows_changed) (XfcePanelPlugin *plugin,
  121. guint rows);
  122. /*< private >*/
  123. void (*reserved1) (void);
  124. void (*reserved2) (void);
  125. };
  126. /**
  127. * XfcePanelPlugin:
  128. *
  129. * This struct contain private data only and should be accessed by
  130. * the functions below.
  131. **/
  132. struct _XfcePanelPlugin
  133. {
  134. /*< private >*/
  135. GtkEventBox __parent__;
  136. /*< private >*/
  137. XfcePanelPluginPrivate *priv;
  138. };
  139. GType xfce_panel_plugin_get_type (void) G_GNUC_CONST;
  140. const gchar *xfce_panel_plugin_get_name (XfcePanelPlugin *plugin) G_GNUC_PURE;
  141. const gchar *xfce_panel_plugin_get_display_name (XfcePanelPlugin *plugin) G_GNUC_PURE;
  142. const gchar *xfce_panel_plugin_get_comment (XfcePanelPlugin *plugin) G_GNUC_PURE;
  143. gint xfce_panel_plugin_get_unique_id (XfcePanelPlugin *plugin) G_GNUC_PURE;
  144. const gchar *xfce_panel_plugin_get_property_base (XfcePanelPlugin *plugin) G_GNUC_PURE;
  145. const gchar * const *xfce_panel_plugin_get_arguments (XfcePanelPlugin *plugin) G_GNUC_PURE;
  146. gint xfce_panel_plugin_get_size (XfcePanelPlugin *plugin) G_GNUC_PURE;
  147. gboolean xfce_panel_plugin_get_expand (XfcePanelPlugin *plugin) G_GNUC_PURE;
  148. void xfce_panel_plugin_set_expand (XfcePanelPlugin *plugin,
  149. gboolean expand);
  150. gboolean xfce_panel_plugin_get_shrink (XfcePanelPlugin *plugin) G_GNUC_PURE;
  151. void xfce_panel_plugin_set_shrink (XfcePanelPlugin *plugin,
  152. gboolean shrink);
  153. gboolean xfce_panel_plugin_get_small (XfcePanelPlugin *plugin) G_GNUC_PURE;
  154. void xfce_panel_plugin_set_small (XfcePanelPlugin *plugin,
  155. gboolean small);
  156. GtkOrientation xfce_panel_plugin_get_orientation (XfcePanelPlugin *plugin) G_GNUC_PURE;
  157. XfcePanelPluginMode xfce_panel_plugin_get_mode (XfcePanelPlugin *plugin) G_GNUC_PURE;
  158. guint xfce_panel_plugin_get_nrows (XfcePanelPlugin *plugin) G_GNUC_PURE;
  159. XfceScreenPosition xfce_panel_plugin_get_screen_position (XfcePanelPlugin *plugin) G_GNUC_PURE;
  160. void xfce_panel_plugin_take_window (XfcePanelPlugin *plugin,
  161. GtkWindow *window);
  162. void xfce_panel_plugin_add_action_widget (XfcePanelPlugin *plugin,
  163. GtkWidget *widget);
  164. void xfce_panel_plugin_menu_insert_item (XfcePanelPlugin *plugin,
  165. GtkMenuItem *item);
  166. void xfce_panel_plugin_menu_show_configure (XfcePanelPlugin *plugin);
  167. void xfce_panel_plugin_menu_show_about (XfcePanelPlugin *plugin);
  168. gboolean xfce_panel_plugin_get_locked (XfcePanelPlugin *plugin);
  169. void xfce_panel_plugin_remove (XfcePanelPlugin *plugin);
  170. void xfce_panel_plugin_block_menu (XfcePanelPlugin *plugin);
  171. void xfce_panel_plugin_unblock_menu (XfcePanelPlugin *plugin);
  172. void xfce_panel_plugin_register_menu (XfcePanelPlugin *plugin,
  173. GtkMenu *menu);
  174. GtkArrowType xfce_panel_plugin_arrow_type (XfcePanelPlugin *plugin);
  175. void xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
  176. GtkWidget *menu_widget,
  177. GtkWidget *attach_widget,
  178. gint *x,
  179. gint *y);
  180. void xfce_panel_plugin_position_menu (GtkMenu *menu,
  181. gint *x,
  182. gint *y,
  183. gboolean *push_in,
  184. gpointer panel_plugin);
  185. void xfce_panel_plugin_focus_widget (XfcePanelPlugin *plugin,
  186. GtkWidget *widget);
  187. void xfce_panel_plugin_block_autohide (XfcePanelPlugin *plugin,
  188. gboolean blocked);
  189. gchar *xfce_panel_plugin_lookup_rc_file (XfcePanelPlugin *plugin) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
  190. gchar *xfce_panel_plugin_save_location (XfcePanelPlugin *plugin,
  191. gboolean create) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
  192. G_END_DECLS
  193. #endif /* !__XFCE_PANEL_PLUGIN_H__ */