Back to index

lightning-sunbird  0.9+nobinonly
gtkmozembed.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is mozilla.org code.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Christopher Blizzard. Portions created by Christopher Blizzard are Copyright (C) Christopher Blizzard.  All Rights Reserved.
00018  * Portions created by the Initial Developer are Copyright (C) 2001
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *   Christopher Blizzard <blizzard@mozilla.org>
00023  *   Ramiro Estrugo <ramiro@eazel.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifndef gtkmozembed_h
00040 #define gtkmozembed_h
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif /* __cplusplus */
00045 
00046 #include <stddef.h>
00047 #include <gtk/gtk.h>
00048 #ifdef MOZILLA_CLIENT
00049 #include "nscore.h"
00050 #ifdef _IMPL_GTKMOZEMBED
00051 #define GTKMOZEMBED_API(type) NS_EXPORT_(type)
00052 #else
00053 #define GTKMOZEMBED_API(type) NS_IMPORT_(type)
00054 #endif
00055 #else
00056 #define GTKMOZEMBED_API(type) type
00057 #endif
00058 
00059 #define GTK_TYPE_MOZ_EMBED             (gtk_moz_embed_get_type())
00060 #define GTK_MOZ_EMBED(obj)             GTK_CHECK_CAST((obj), GTK_TYPE_MOZ_EMBED, GtkMozEmbed)
00061 #define GTK_MOZ_EMBED_CLASS(klass)     GTK_CHECK_CLASS_CAST((klass), GTK_TYPE_MOZ_EMBED, GtkMozEmbedClass)
00062 #define GTK_IS_MOZ_EMBED(obj)          GTK_CHECK_TYPE((obj), GTK_TYPE_MOZ_EMBED)
00063 #define GTK_IS_MOZ_EMBED_CLASS(klass)  GTK_CHECK_CLASS_TYPE((klass), GTK_TYPE_MOZ_EMBED)
00064 
00065 typedef struct _GtkMozEmbed      GtkMozEmbed;
00066 typedef struct _GtkMozEmbedClass GtkMozEmbedClass;
00067 
00068 struct _GtkMozEmbed
00069 {
00070   GtkBin    bin;
00071   void     *data;
00072 };
00073 
00074 struct _GtkMozEmbedClass
00075 {
00076   GtkBinClass parent_class;
00077 
00078   void (* link_message)        (GtkMozEmbed *embed);
00079   void (* js_status)           (GtkMozEmbed *embed);
00080   void (* location)            (GtkMozEmbed *embed);
00081   void (* title)               (GtkMozEmbed *embed);
00082   void (* progress)            (GtkMozEmbed *embed, gint curprogress,
00083                             gint maxprogress);
00084   void (* progress_all)        (GtkMozEmbed *embed, const char *aURI,
00085                             gint curprogress, gint maxprogress);
00086   void (* net_state)           (GtkMozEmbed *embed, gint state, guint status);
00087   void (* net_state_all)       (GtkMozEmbed *embed, const char *aURI,
00088                             gint state, guint status);
00089   void (* net_start)           (GtkMozEmbed *embed);
00090   void (* net_stop)            (GtkMozEmbed *embed);
00091   void (* new_window)          (GtkMozEmbed *embed, GtkMozEmbed **newEmbed,
00092                             guint chromemask);
00093   void (* visibility)          (GtkMozEmbed *embed, gboolean visibility);
00094   void (* destroy_brsr)        (GtkMozEmbed *embed);
00095   gint (* open_uri)            (GtkMozEmbed *embed, const char *aURI);
00096   void (* size_to)             (GtkMozEmbed *embed, gint width, gint height);
00097   gint (* dom_key_down)        (GtkMozEmbed *embed, gpointer dom_event);
00098   gint (* dom_key_press)       (GtkMozEmbed *embed, gpointer dom_event);
00099   gint (* dom_key_up)          (GtkMozEmbed *embed, gpointer dom_event);
00100   gint (* dom_mouse_down)      (GtkMozEmbed *embed, gpointer dom_event);
00101   gint (* dom_mouse_up)        (GtkMozEmbed *embed, gpointer dom_event);
00102   gint (* dom_mouse_click)     (GtkMozEmbed *embed, gpointer dom_event);
00103   gint (* dom_mouse_dbl_click) (GtkMozEmbed *embed, gpointer dom_event);
00104   gint (* dom_mouse_over)      (GtkMozEmbed *embed, gpointer dom_event);
00105   gint (* dom_mouse_out)       (GtkMozEmbed *embed, gpointer dom_event);
00106   void (* security_change)     (GtkMozEmbed *embed, gpointer request,
00107                             guint state);
00108   void (* status_change)       (GtkMozEmbed *embed, gpointer request,
00109                             gint status, gpointer message);
00110   gint (* dom_activate)        (GtkMozEmbed *embed, gpointer dom_event);
00111   gint (* dom_focus_in)        (GtkMozEmbed *embed, gpointer dom_event);
00112   gint (* dom_focus_out)       (GtkMozEmbed *embed, gpointer dom_event);
00113 };
00114 
00115 GTKMOZEMBED_API(GtkType)    gtk_moz_embed_get_type         (void);
00116 GTKMOZEMBED_API(GtkWidget*) gtk_moz_embed_new              (void);
00117 GTKMOZEMBED_API(void)       gtk_moz_embed_push_startup     (void);
00118 GTKMOZEMBED_API(void)       gtk_moz_embed_pop_startup      (void);
00119 GTKMOZEMBED_API(void)       gtk_moz_embed_set_comp_path    (const char *aPath);
00120 GTKMOZEMBED_API(void)       gtk_moz_embed_set_profile_path (const char *aDir,
00121                                                      const char *aName);
00122 GTKMOZEMBED_API(void)       gtk_moz_embed_load_url         (GtkMozEmbed *embed,
00123                                                      const char *url);
00124 GTKMOZEMBED_API(void)      gtk_moz_embed_stop_load        (GtkMozEmbed *embed);
00125 GTKMOZEMBED_API(gboolean)  gtk_moz_embed_can_go_back      (GtkMozEmbed *embed);
00126 GTKMOZEMBED_API(gboolean)  gtk_moz_embed_can_go_forward   (GtkMozEmbed *embed);
00127 GTKMOZEMBED_API(void)      gtk_moz_embed_go_back          (GtkMozEmbed *embed);
00128 GTKMOZEMBED_API(void)      gtk_moz_embed_go_forward       (GtkMozEmbed *embed);
00129 GTKMOZEMBED_API(void)   gtk_moz_embed_render_data      (GtkMozEmbed *embed, 
00130                                                  const char *data,
00131                                                  guint32 len,
00132                                                  const char *base_uri, 
00133                                                  const char *mime_type);
00134 GTKMOZEMBED_API(void)   gtk_moz_embed_open_stream      (GtkMozEmbed *embed,
00135                                                  const char *base_uri,
00136                                                  const char *mime_type);
00137 GTKMOZEMBED_API(void)   gtk_moz_embed_append_data      (GtkMozEmbed *embed,
00138                                                  const char *data,
00139                                                  guint32 len);
00140 GTKMOZEMBED_API(void)   gtk_moz_embed_close_stream     (GtkMozEmbed *embed);
00141 GTKMOZEMBED_API(char*)  gtk_moz_embed_get_link_message (GtkMozEmbed *embed);
00142 GTKMOZEMBED_API(char*)  gtk_moz_embed_get_js_status    (GtkMozEmbed *embed);
00143 GTKMOZEMBED_API(char*)  gtk_moz_embed_get_title        (GtkMozEmbed *embed);
00144 GTKMOZEMBED_API(char*)  gtk_moz_embed_get_location     (GtkMozEmbed *embed);
00145 GTKMOZEMBED_API(void)   gtk_moz_embed_reload           (GtkMozEmbed *embed,
00146                                                  gint32 flags);
00147 GTKMOZEMBED_API(void)   gtk_moz_embed_set_chrome_mask  (GtkMozEmbed *embed, 
00148                                                  guint32 flags);
00149 GTKMOZEMBED_API(guint32) gtk_moz_embed_get_chrome_mask (GtkMozEmbed *embed);
00150 
00151 /* enum types */
00152 #define GTK_TYPE_MOZ_EMBED_PROGRESS_FLAGS \
00153              (gtk_moz_embed_progress_flags_get_type())
00154 #define GTK_TYPE_MOZ_EMBED_STATUS_ENUMS \
00155              (gtk_moz_embed_status_enums_get_type())
00156 #define GTK_TYPE_MOZ_EMBED_RELOAD_FLAGS \
00157              (gtk_moz_embed_reload_flags_get_type())
00158 #define GTK_TYPE_MOZ_EMBED_CHROME_FLAGS \
00159              (gtk_moz_embed_chrome_flags_get_type())
00160 
00161 GTKMOZEMBED_API(GtkType)      gtk_moz_embed_progress_flags_get_type (void);
00162 GTKMOZEMBED_API(GtkType)      gtk_moz_embed_status_enums_get_type (void);
00163 GTKMOZEMBED_API(GtkType)      gtk_moz_embed_reload_flags_get_type (void);
00164 GTKMOZEMBED_API(GtkType)      gtk_moz_embed_chrome_flags_get_type (void);
00165 
00166 /* These are straight out of nsIWebProgressListener.h */
00167 
00168 typedef enum
00169 {
00170   GTK_MOZ_EMBED_FLAG_START = 1,
00171   GTK_MOZ_EMBED_FLAG_REDIRECTING = 2,
00172   GTK_MOZ_EMBED_FLAG_TRANSFERRING = 4,
00173   GTK_MOZ_EMBED_FLAG_NEGOTIATING = 8,
00174   GTK_MOZ_EMBED_FLAG_STOP = 16,
00175   
00176   GTK_MOZ_EMBED_FLAG_IS_REQUEST = 65536,
00177   GTK_MOZ_EMBED_FLAG_IS_DOCUMENT = 131072,
00178   GTK_MOZ_EMBED_FLAG_IS_NETWORK = 262144,
00179   GTK_MOZ_EMBED_FLAG_IS_WINDOW = 524288,
00180 
00181   GTK_MOZ_EMBED_FLAG_RESTORING = 16777216
00182 } GtkMozEmbedProgressFlags;
00183 
00184 /* These are from various networking headers */
00185 
00186 typedef enum
00187 {
00188   /* NS_ERROR_UNKNOWN_HOST */
00189   GTK_MOZ_EMBED_STATUS_FAILED_DNS     = 2152398878U,
00190  /* NS_ERROR_CONNECTION_REFUSED */
00191   GTK_MOZ_EMBED_STATUS_FAILED_CONNECT = 2152398861U,
00192  /* NS_ERROR_NET_TIMEOUT */
00193   GTK_MOZ_EMBED_STATUS_FAILED_TIMEOUT = 2152398862U,
00194  /* NS_BINDING_ABORTED */
00195   GTK_MOZ_EMBED_STATUS_FAILED_USERCANCELED = 2152398850U
00196 } GtkMozEmbedStatusFlags;
00197 
00198 /* These used to be straight out of nsIWebNavigation.h until the API
00199    changed.  Now there's a mapping table that maps these values to the
00200    internal values. */
00201 
00202 typedef enum 
00203 {
00204   GTK_MOZ_EMBED_FLAG_RELOADNORMAL = 0,
00205   GTK_MOZ_EMBED_FLAG_RELOADBYPASSCACHE = 1,
00206   GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXY = 2,
00207   GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXYANDCACHE = 3,
00208   GTK_MOZ_EMBED_FLAG_RELOADCHARSETCHANGE = 4
00209 } GtkMozEmbedReloadFlags;
00210 
00211 /* These are straight out of nsIWebBrowserChrome.h */
00212 
00213 typedef enum
00214 {
00215   GTK_MOZ_EMBED_FLAG_DEFAULTCHROME = 1U,
00216   GTK_MOZ_EMBED_FLAG_WINDOWBORDERSON = 2U,
00217   GTK_MOZ_EMBED_FLAG_WINDOWCLOSEON = 4U,
00218   GTK_MOZ_EMBED_FLAG_WINDOWRESIZEON = 8U,
00219   GTK_MOZ_EMBED_FLAG_MENUBARON = 16U,
00220   GTK_MOZ_EMBED_FLAG_TOOLBARON = 32U,
00221   GTK_MOZ_EMBED_FLAG_LOCATIONBARON = 64U,
00222   GTK_MOZ_EMBED_FLAG_STATUSBARON = 128U,
00223   GTK_MOZ_EMBED_FLAG_PERSONALTOOLBARON = 256U,
00224   GTK_MOZ_EMBED_FLAG_SCROLLBARSON = 512U,
00225   GTK_MOZ_EMBED_FLAG_TITLEBARON = 1024U,
00226   GTK_MOZ_EMBED_FLAG_EXTRACHROMEON = 2048U,
00227   GTK_MOZ_EMBED_FLAG_ALLCHROME = 4094U,
00228   GTK_MOZ_EMBED_FLAG_WINDOWRAISED = 33554432U,
00229   GTK_MOZ_EMBED_FLAG_WINDOWLOWERED = 67108864U,
00230   GTK_MOZ_EMBED_FLAG_CENTERSCREEN = 134217728U,
00231   GTK_MOZ_EMBED_FLAG_DEPENDENT = 268435456U,
00232   GTK_MOZ_EMBED_FLAG_MODAL = 536870912U,
00233   GTK_MOZ_EMBED_FLAG_OPENASDIALOG = 1073741824U,
00234   GTK_MOZ_EMBED_FLAG_OPENASCHROME = 2147483648U 
00235 } GtkMozEmbedChromeFlags;
00236 
00237 /* this is a singleton object that you can hook up to to get signals
00238    that are not handed out on a per widget basis. */
00239 
00240 #define GTK_TYPE_MOZ_EMBED_SINGLE            (gtk_moz_embed_single_get_type())
00241 #define GTK_MOZ_EMBED_SINGLE(obj)            GTK_CHECK_CAST((obj), GTK_TYPE_MOZ_EMBED_SINGLE, GtkMozEmbedSingle)
00242 #define GTK_MOZ_EMBED_SINGLE_CLASS(klass)    GTK_CHEK_CLASS_CAST((klass), GTK_TYPE_MOZ_EMBED_SINGLE, GtkMozEmbedSingleClass)
00243 #define GTK_IS_MOZ_EMBED_SINGLE(obj)         GTK_CHECK_TYPE((obj), GTK_TYPE_MOZ_EMBED_SINGLE)
00244 #define GTK_IS_MOZ_EMBED_SINGLE_CLASS(klass) GTK_CHECK_CLASS_TYPE((klass), GTK_TYPE_MOZ_EMBED)
00245 
00246 typedef struct _GtkMozEmbedSingle      GtkMozEmbedSingle;
00247 typedef struct _GtkMozEmbedSingleClass GtkMozEmbedSingleClass;
00248 
00249 struct _GtkMozEmbedSingle
00250 {
00251   GtkObject  object;
00252   void      *data;
00253 };
00254 
00255 struct _GtkMozEmbedSingleClass
00256 {
00257   GtkObjectClass parent_class;
00258 
00259   void (* new_window_orphan)   (GtkMozEmbedSingle *embed,
00260                             GtkMozEmbed **newEmbed,
00261                             guint chromemask);
00262 };
00263 
00264 GTKMOZEMBED_API(GtkType)             gtk_moz_embed_single_get_type  (void);
00265 GTKMOZEMBED_API(GtkMozEmbedSingle *) gtk_moz_embed_single_get       (void);
00266 
00267 #ifdef __cplusplus
00268 }
00269 #endif /* __cplusplus */
00270 
00271 #endif /* gtkmozembed_h */