aboutsummaryrefslogblamecommitdiffstats
path: root/embed/ephy-embed.h
blob: 8d16da85065bd7eed318ae8c5c26f0ff918b3eb6 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  
                                                













                                                                              

        




                    
                             
                           






                          





                                                                                                                 
 
                                             


















                                          














                                                   


















                                                                

              






























                                                                          















                                      









                            
                                  
 

                                                   







                                                       

                

                                                         

                                                        

                                                        

                                                   
                                                    
                                                   

                                                              
                                                   
                                                   
                                                   
                                                         
                                                   
                                                         
                                                   
                                                            
                                                   
                                                  

                      















                                                                                 

                                                                           
































                                                                                       

  
                                                               
 


                                                                          
 
                                                                           
 

                                                                                 
 
                                                                           
 

                                                                            
 



                                                                           

                                                                           
 
                                                                           
 
                                                                           
 
                                                                           
 
                                                                           
 
                                                                           
 
                                                                           
 
                                                                           
 




                                                                              
 
                                                                           
 

                                                                          
 


                                                                                   
 
          


                                                                          
 
                                                                           
 




                                                                                 
 

                                                                             
 


                                                                               
 
                                                                           
 


                                                                               
 
                                                                           
 
                                                                           
 


                                                                                       
 

                                                                           



           
/*
 *  Copyright (C) 2000-2003 Marco Pesenti Gritti
 *
 *  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 2, 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, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 *  $Id$
 */

#ifndef EPHY_EMBED_H
#define EPHY_EMBED_H

#include "ephy-embed-event.h"
#include "ephy-encodings.h"

#include <glib-object.h>
#include <glib.h>
#include <gtk/gtkwidget.h>

G_BEGIN_DECLS

#define EPHY_TYPE_EMBED         (ephy_embed_get_type ())
#define EPHY_EMBED(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_EMBED, EphyEmbed))
#define EPHY_EMBED_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_EMBED, EphyEmbedClass))
#define EPHY_IS_EMBED(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_EMBED))
#define EPHY_IS_EMBED_CLASS(k)      (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_EMBED))
#define EPHY_EMBED_GET_CLASS(inst)  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EPHY_TYPE_EMBED, EphyEmbedClass))

typedef struct EphyEmbedClass EphyEmbedClass;
typedef struct _EphyEmbed EphyEmbed;

typedef enum
{
    EMBED_STATE_UNKNOWN = 0,
    EMBED_STATE_START = 1 << 0,
    EMBED_STATE_REDIRECTING = 1 << 1,
    EMBED_STATE_TRANSFERRING = 1 << 2,
    EMBED_STATE_NEGOTIATING = 1 << 3,
    EMBED_STATE_STOP = 1 << 4,

    EMBED_STATE_IS_REQUEST = 1 << 5,
    EMBED_STATE_IS_DOCUMENT = 1 << 6,
    EMBED_STATE_IS_NETWORK = 1 << 7,
    EMBED_STATE_IS_WINDOW = 1 << 8
} EmbedState;

typedef enum
{
    EMBED_CHROME_NONE = 0,
    EMBED_CHROME_DEFAULT = 1 << 0,
    EMBED_CHROME_MENUBARON = 1 << 1,
    EMBED_CHROME_TOOLBARON = 1 << 2,
    EMBED_CHROME_BOOKMARKSBARON = 1 << 3,
    EMBED_CHROME_BOOKMARKSBAR_DEFAULT = 1 << 4,
    EMBED_CHROME_STATUSBARON = 1 << 5,
    EMBED_CHROME_WINDOWRAISED = 1 << 6,
    EMBED_CHROME_WINDOWLOWERED = 1 << 7,
    EMBED_CHROME_CENTERSCREEN = 1 << 8,
    EMBED_CHROME_OPENASDIALOG = 1 << 9,
    EMBED_CHROME_OPENASCHROME = 1 << 10,
    EMBED_CHROME_OPENASPOPUP = 1 << 11,
    EMBED_CHROME_PPVIEWTOOLBARON = 1 << 12
} EmbedChromeMask;

typedef struct
{
    char *modification_date;

    /* lists of hashtables with gvalues */
    GList *images;      /* url, alt, title, width, height */
    GList *forms;       /* action, type */
    GList *links;       /* url, title, type */
    GList *stylesheets; /* url, title */
} EmbedPageInfo;

typedef enum
{
    EMBED_RELOAD_NORMAL = 1 << 1,
    EMBED_RELOAD_BYPASSCACHE = 1 << 2,
    EMBED_RELOAD_BYPASSPROXY = 1 << 3
} EmbedReloadFlags;

typedef struct
{
    gboolean print_to_file;
    gchar *printer;
    gchar *file;
    gchar *paper;
    gint top_margin;
    gint bottom_margin;
    gint left_margin;
    gint right_margin;
    gint pages;
    gint from_page;
    gint to_page;
    gint frame_type;
    gint orientation;
    gboolean print_color;

     /*
     * &T - title
     * &U - Document URL
     * &D - Date/Time
     * &P - Page Number
     * &PT - Page Number with total Number of Pages (example: 1 of 34)
     *
     * So, if headerLeftStr = "&T" the title and the document URL
     * will be printed out on the top left-hand side of each page.
     */
    gchar *header_left_string;
    gchar *header_center_string;
    gchar *header_right_string;
    gchar *footer_left_string;
    gchar *footer_center_string;
    gchar *footer_right_string;

    gboolean preview;
}
EmbedPrintInfo;

typedef enum
{
    PRINTPREVIEW_GOTO_PAGENUM = 0,
    PRINTPREVIEW_PREV_PAGE = 1,
    PRINTPREVIEW_NEXT_PAGE = 2,
    PRINTPREVIEW_HOME = 3,
    PRINTPREVIEW_END = 4
} EmbedPrintPreviewNavType;

typedef enum
{
    STATE_IS_UNKNOWN,
    STATE_IS_INSECURE,
    STATE_IS_BROKEN,
    STATE_IS_SECURE_MED,
    STATE_IS_SECURE_LOW,
    STATE_IS_SECURE_HIGH
} EmbedSecurityLevel;

struct EphyEmbedClass
{
    GTypeInterface base_iface;

    /* Signals that we inherit from gtkmozembed
     *
     * void (* net_stop)     (GtkMozEmbed *embed);
     * void (* title)        (EphyEmbed *embed);
     * void (* visibility)   (EphyEmbed *embed,
     *            gboolean visibility);
     * void (* destroy_brsr) (EphyEmbed *embed);
     * void (* size_to)      (EphyEmbed *embed,
     *            gint width,
     *            gint height);
     */ 

    gint (* context_menu)    (EphyEmbed *embed,
                  EphyEmbedEvent *event);
    void (* favicon)     (EphyEmbed *embed,
                  const char *location);
    void (* location)        (EphyEmbed *embed,
                  const char *location);
    void (* net_state)       (EphyEmbed *embed,
                  const char *uri,
                  EmbedState state);
    void (* new_window)      (EphyEmbed *embed,
                  EphyEmbed **new_embed,
                  EmbedChromeMask chromemask);
    gint (* open_uri)        (EphyEmbed *embed,
                  const char *uri);
    gint (* dom_mouse_click) (EphyEmbed *embed,
                  EphyEmbedEvent *event);
    gint (* dom_mouse_down)  (EphyEmbed *embed,
                  EphyEmbedEvent *event);
    void (* security_change) (EphyEmbed *embed,
                  EmbedSecurityLevel level);
    void (* zoom_change)     (EphyEmbed *embed,
                  guint new_zoom);

    /* Methods  */
    void           (* load_url)         (EphyEmbed *embed,
                             const char *url);
    void           (* stop_load)        (EphyEmbed *embed);
    void           (* reload)           (EphyEmbed *embed,
                             EmbedReloadFlags flags);
    gboolean       (* can_go_back)      (EphyEmbed *embed);
    gboolean       (* can_go_forward)       (EphyEmbed *embed);
    gboolean       (* can_go_up)        (EphyEmbed *embed);
    GSList *       (* get_go_up_list)       (EphyEmbed *embed);
    void           (* go_back)          (EphyEmbed *embed);
    void           (* go_forward)       (EphyEmbed *embed);
    void           (* go_up)            (EphyEmbed *embed);

    char *         (* get_title)        (EphyEmbed *embed);
    char *         (* get_location)     (EphyEmbed *embed,
                             gboolean toplevel);
    char *         (* get_link_message)     (EphyEmbed *embed);
    char *         (* get_js_status)        (EphyEmbed *embed);
    int        (* shistory_n_items)     (EphyEmbed *embed);
    void           (* shistory_get_nth)     (EphyEmbed *embed,
                             int nth,
                             gboolean is_relative,
                             char **url,
                             char **title);
    int        (* shistory_get_pos)     (EphyEmbed *embed);
    void           (* shistory_go_nth)      (EphyEmbed *embed,
                             int nth);
    void           (* get_security_level)   (EphyEmbed *embed,
                             EmbedSecurityLevel *level,
                             char **description);
    void           (* zoom_set)         (EphyEmbed *embed,
                             float zoom,
                             gboolean reflow);
    float          (* zoom_get)         (EphyEmbed *embed);
    void           (* find_set_properties)  (EphyEmbed *embed,
                             char *search_string,
                             gboolean case_sensitive,
                             gboolean wrap_around);
    gboolean       (* find_next)        (EphyEmbed *embed,
                             gboolean backwards);
    void           (* set_encoding)     (EphyEmbed *embed,
                             const char *encoding);
    EphyEncodingInfo * (* get_encoding_info)    (EphyEmbed *embed);
    void           (* print)            (EphyEmbed *embed,
                             EmbedPrintInfo *info);
    void           (* print_preview_close)  (EphyEmbed *embed);
    int        (* print_preview_n_pages)    (EphyEmbed *embed);
    void           (* print_preview_navigate)   (EphyEmbed *embed,
                             EmbedPrintPreviewNavType type,
                             int page);
    void           (* activate)         (EphyEmbed *embed);
};

GType         ephy_embed_get_type           (void);

/* Base */
void          ephy_embed_load_url           (EphyEmbed *embed,
                             const char *url);

void          ephy_embed_stop_load          (EphyEmbed *embed);

void          ephy_embed_reload         (EphyEmbed *embed,
                             EmbedReloadFlags flags);

char         *ephy_embed_get_title          (EphyEmbed *embed);

char         *ephy_embed_get_location       (EphyEmbed *embed,
                             gboolean toplevel);

char         *ephy_embed_get_link_message       (EphyEmbed *embed);

char         *ephy_embed_get_js_status      (EphyEmbed *embed);

/* Navigation */
gboolean      ephy_embed_can_go_back        (EphyEmbed *embed);

gboolean      ephy_embed_can_go_forward     (EphyEmbed *embed);

gboolean      ephy_embed_can_go_up          (EphyEmbed *embed);

GSList       *ephy_embed_get_go_up_list     (EphyEmbed *embed);

void          ephy_embed_go_back            (EphyEmbed *embed);

void          ephy_embed_go_forward         (EphyEmbed *embed);

void          ephy_embed_go_up          (EphyEmbed *embed);

int       ephy_embed_shistory_n_items       (EphyEmbed *embed);

void          ephy_embed_shistory_get_nth       (EphyEmbed *embed,
                             int nth,
                             gboolean is_relative,
                             char **url,
                             char **title);

int       ephy_embed_shistory_get_pos       (EphyEmbed *embed);

void          ephy_embed_shistory_go_nth        (EphyEmbed *embed,
                             int nth);

void          ephy_embed_get_security_level     (EphyEmbed *embed,
                             EmbedSecurityLevel *level,
                            char **description);

/* Zoom */
void          ephy_embed_zoom_set           (EphyEmbed *embed,
                             float zoom,
                             gboolean reflow);

float         ephy_embed_zoom_get           (EphyEmbed *embed);

/* Find */
void          ephy_embed_find_set_properties    (EphyEmbed *embed,
                             char *search_string,
                             gboolean case_sensitive,
                             gboolean wrap_around);

gboolean      ephy_embed_find_next          (EphyEmbed *embed,
                             gboolean backwards);

/* Encoding */
void          ephy_embed_set_encoding       (EphyEmbed *embed,
                             const char *encoding);

EphyEncodingInfo *ephy_embed_get_encoding_info      (EphyEmbed *embed);

/* Print */
void          ephy_embed_print          (EphyEmbed *embed,
                             EmbedPrintInfo *info);

void          ephy_embed_print_preview_close    (EphyEmbed *embed);

int       ephy_embed_print_preview_n_pages  (EphyEmbed *embed);

void          ephy_embed_print_preview_navigate (EphyEmbed *embed,
                             EmbedPrintPreviewNavType type,
                             int page);

/* Misc. utility */
void          ephy_embed_activate           (EphyEmbed *embed);

G_END_DECLS

#endif