Changes between Initial Version and Version 1 of GtkAPIProposal


Ignore:
Timestamp:
Apr 19, 2007, 8:20:04 AM (18 years ago)
Author:
christian@twotoasts.de
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GtkAPIProposal

    v1 v1  
     1/* Private structure type */
     2typedef struct WebiPrivate_ WebiPrivate;
     3
     4/*
     5 * Main object structure
     6 */
     7typedef struct Webi_ Webi;
     8
     9struct Webi_ {
     10  GtkBin __parent__;
     11  /*< private >*/
     12  WebiPrivate *_priv;
     13};
     14
     15/** Structure used to set device type. */
     16typedef enum {
     17  WEBI_DEVICE_TYPE_SCREEN,
     18  WEBI_DEVICE_TYPE_HANDHELD,
     19  WEBI_DEVICE_TYPE_PRINTER
     20} WebiDeviceType;
     21
     22/** Rendering engine settings structure
     23 *  Rendering engine settings structure.
     24 */
     25
     26typedef struct WebiSettings_ WebiSettings;
     27struct WebiSettings_ {
     28  gboolean javascript_enabled;
     29  gboolean java_enabled;
     30  gboolean plugins_enabled;
     31  gboolean autoload_images;
     32  gfloat minimum_font_size;
     33  gfloat default_font_size;
     34  gfloat default_fixed_font_size;
     35  const gchar* default_text_encoding;
     36  const gchar* serif_font_family;
     37  const gchar* sans_serif_font_family;
     38  const gchar* fixed_font_family;
     39  const gchar* standard_font_family;
     40  const gchar* cursive_font_family;
     41  const gchar* fantasy_font_family;
     42  const gchar* user_agent_string;
     43
     44  /** Full url (including port) of the proxy to use. If NULL, empty (""), */
     45  const gchar* http_proxy;
     46
     47  /** Rendering Mode */
     48  const WebiDeviceType device_type;
     49};
     50
     51typedef struct WebiLoadStatus_ WebiLoadStatus;
     52
     53/** Type of the status message. */
     54typedef enum  {
     55        /** Report start loading a resource */
     56        WEBI_LOADING_START,
     57        /** Report progress in loading a resource */
     58        WEBI_LOADING,
     59        /** Report a successful resource load */
     60        WEBI_LOADING_COMPLETE,
     61        /** Report an error in resource loading. */
     62        WEBI_LOADING_ERROR
     63} WebiStatus;
     64
     65/** Status message. */
     66struct WebiLoadStatus_ {
     67  /** Status of the loading process. */
     68  WebiStatus status;
     69
     70  /** Number of files to download */
     71  guint files;
     72
     73  /** Number of files received with Content-Length set*/
     74  guint filesWithSize;
     75
     76  /** Number of files received */
     77  guint ready;
     78
     79  /** Bytes available for resource. */
     80  guint size;
     81
     82  /** Bytes received from resource. */
     83  guint received;
     84
     85  /** Total size of the resources including those that didn't have
     86      Content-Length set. */
     87  guint totalSize;
     88
     89  /** Bytes received total. */
     90  guint totalReceived;
     91
     92  /** Error code. */
     93  gint statusCode;
     94};
     95
     96
     97
     98typedef struct WebiPromptArgs_ WebiPromptArgs;
     99
     100
     101/** Type of message prompt if message prompt was an alert (ok button), confirm (yes/no) or input (textfield, ok, cancel).
     102 */
     103typedef enum {
     104        /** alert (ok button)*/
     105        WEBI_ALERT,
     106        /**confirm (yes/no)*/
     107        WEBI_CONFIRM,
     108        /**or input (textfield, ok, cancel) */
     109        WEBI_INPUT
     110} WebiPromptType;
     111
     112/** Structure used to pass arguments of javascript prompt messages
     113 */
     114struct WebiPromptArgs_
     115{
     116  /*<public>*/
     117
     118  /** Flag specifying if message prompt was an alert (ok button), confirm (yes/no) or
     119   *  input (textfield, ok, cancel). */
     120  WebiPromptType type;
     121
     122  /** The prompt message*/
     123  const gchar* msg;
     124
     125  /**  default input text.
     126   *  if type == WEBI_INPUT contains default input text to be shown in input field */
     127  const gchar* default_input;
     128
     129  /**  text entered in the prompt textfield
     130   *   should be set if type == WEBI_INPUT
     131   *  string will be deallocated by signaller with g_free().
     132   *  ie. there's an ownership change. */
     133  gchar* out_input;
     134
     135  /** flag specifying if the button pressed was ok or cancel, yes or no
     136   * \TRUE means ok or yes
     137   * \FALSE means cancel or no
     138   */
     139  gboolean out_ok_pressed;
     140};
     141
     142typedef struct WebiAuthArgs_ WebiAuthArgs;
     143
     144/** Structure used to pass arguments of javascript prompt messages
     145 */
     146struct WebiAuthArgs_
     147{
     148  /*< public >*/
     149  /** realm of authentication */
     150  const gchar* realm;
     151
     152  /** Out parameter containing username from user.
     153   *  string will be deallocated by caller with g_free().
     154   *  ie. there's an ownership change.*/
     155  gchar* out_username;
     156
     157  /** Out parameter containing password from user.
     158   *  string will be deallocated by caller with g_free()
     159   *  ie. there's an ownership change. */
     160
     161  gchar* out_password;
     162
     163  /** flag specifying if the button pressed was ok or cancel
     164   * \TRUE means ok
     165   * \FALSE otherwise  */
     166  gboolean out_ok_pressed;
     167};
     168
     169typedef struct WebiCookie_ WebiCookie;
     170
     171/** Structure used to pass arguments of javascript prompt messages
     172 */
     173struct WebiCookie_
     174{
     175  /*<public>*/
     176
     177  /** Whole cookie */
     178  const gchar* cookie;
     179
     180  /** Cookie name */
     181  const gchar* name;
     182
     183  /** Cookie value */
     184  const gchar* value;
     185
     186  /* Cookie comment */
     187  const gchar* comment;
     188
     189  /* Cookie domain */
     190  const gchar* domain;
     191
     192  /* Cookie TTL */
     193  const gchar* maxAge;
     194
     195  /* Cookie path */
     196  const gchar* path;
     197
     198  /* Is cookie secure? */
     199  gboolean secure;
     200
     201  /* Cookie-specification version. */
     202  gint version;
     203
     204  /** Out argument - user accepted the cookie. */
     205  gboolean out_accept_cookie;
     206};
     207
     208typedef struct WebiWindowProperties_ WebiWindowProperties;
     209
     210/** Structure used to pass arguments of javascript prompt messages
     211 */
     212struct WebiWindowProperties_
     213{
     214  /*<public>*/
     215  /* Are toolbars wisible. */
     216  gboolean toolbarsVisible;
     217
     218  /* is status bar visible. */
     219  gboolean statusBarVisible;
     220
     221  /* are scroll bars visible. */
     222  gboolean scrollbarsVisible;
     223
     224  /* Is window resizable. */
     225  gboolean isResizable;
     226};
     227
     228/** Structure used to get and set window size and content rectangle size. */
     229typedef enum {
     230  WEBI_CONTENT_SIZE,
     231  WEBI_WINDOW_SIZE
     232} WebiWindowSize;
     233
     234/*
     235 * Class definition
     236 */
     237typedef struct WebiClass_ WebiClass;
     238struct WebiClass_ {
     239  GtkBinClass __parent__;
     240
     241  /*signals*/
     242
     243
     244  /** Location change indication signal.
     245   * use \webi_get_location() to get the url string
     246   * @emited when current page changes.
     247   * @param self the engine which sent the signal
     248   */
     249  void (* location) (Webi * self);
     250
     251  /** Title change indication signal.
     252   * use \webi_get_title() to get the title string
     253   * @emited when title of current page changes.
     254   * @param self the engine which sent the signal
     255   */
     256  void (* title) (Webi * self);
     257
     258  /** Load start indication signal.
     259   * @emited when page loading is started
     260   * @param self the engine which sent the signal
     261   */
     262  void (* load_start) (Webi * self);
     263
     264  /** Load start indication signal.
     265   * @emited when page loading is stopped.
     266   * @emited on error
     267   * @param self the engine which sent the signal
     268   */
     269  void (* load_stop) (Webi * self);
     270
     271  /** Set cookie indication signal.
     272   * @emited when a cookie is received from network
     273   * @param self the engine which sent the signal
     274   * @param cookie The actual cookie received.
     275   * @return \FALSE if don't allow cookie to be set
     276   *         \TRUE if cookie should be set
     277   */
     278  gboolean (* set_cookie) (Webi * self, WebiCookie * cookie);
     279
     280  /** javascript status change indication signal
     281   * use \webi_get_status_text() to get the status string
     282   *
     283   * @emited when javascript status changes.
     284   * @param self the engine which sent the signal
     285   */
     286  void (* status_text) (Webi * self);
     287
     288  /** Page load status change indication signal
     289   *
     290   * @emited when page load status changes.
     291   * @param self the engine which sent the signal
     292   * @param status status of the engine.
     293   */
     294  void (* status) (Webi * self, WebiLoadStatus * status);
     295
     296  /** javascript prompt and alert request signal
     297   * must be synchronous
     298   * @emited when javascript generates an alert
     299   * @emited when javascript generates an prompt
     300   *
     301   * @param self the engine which sent the signal
     302   * @param args used to pass information between browser and engine (in and out)
     303   *        see #WebiPromptAgs
     304   */
     305  void (* req_js_prompt) (Webi *self, WebiPromptArgs* args);
     306
     307  /** HTTP Auth
     308   * must be synchronous
     309   * @emited when javascript generates an alert
     310   * @emited when javascript generates an prompt
     311   *
     312   * @param self the engine which sent the signal
     313   * @param args used to pass information between browser and engine (in and out)
     314   *        see #WebiPromptAgs
     315   */
     316  void (* req_auth_prompt) (Webi *self, WebiAuthArgs* args);
     317
     318  /** javascript/html new window request signal
     319   * must be synchronous
     320   *
     321   * @emited when javascript requests to create a new window
     322   * @emited when html link contains target="_blank" -attribute   *
     323   * @param self the engine which sent the signal
     324   * @param url the URL string loading by newengine.
     325   * @return newengine The new engine of the new window
     326   *        or \NULL if new window creation is not allowed
     327   */
     328  Webi * (* req_new_window) (Webi *self, const gchar *url);
     329
     330  void (* show_window) (Webi *self, WebiWindowProperties* features);
     331  void (* close_window) (Webi *self);
     332
     333  void (* set_window_properties) (Webi *self, WebiWindowProperties* features);
     334  void (* get_window_size) (Webi *self, WebiWindowSize * type, GtkAllocation * size);
     335  void (* set_window_size) (Webi *self, WebiWindowSize * type, GtkRequisition * size);
     336
     337
     338  /** Set device type signal
     339   * must be synchronous
     340   *
     341   * @emited when user wants to change device type used in rendering and
     342   *         style sheet selection
     343   * @param self the engine which sent the signal
     344   * @param newDeviceType The new device type of current window
     345   */
     346  void (* set_device_type) (Webi *self, WebiDeviceType type);
     347
     348  /** Get device type signal
     349   * must be synchronous
     350   *
     351   * @emited when user wants to change device type used in rendering and
     352   *         style sheet selection
     353   * @param self the engine which sent the signal
     354   * @param newDeviceType The new device type of current window
     355   */
     356  WebiDeviceType (* get_device_type) (Webi *self);
     357
     358  void (* mouse_over) (Webi *self, const gchar* link_title, const gchar* link_label, const gchar* link_url, const gchar* link_target);
     359
     360  /** selection change signal*/
     361  void (* selection) (Webi *self);
     362#if 0
     363  /* not implemented at the moment */
     364  void (* req_file_attach) (Webi *self);
     365  void (* file_upload_finished) (Webi *self);
     366  void (* file_upload_finished) (Webi *self);
     367#endif
     368
     369};
     370
     371
     372/*
     373 * Public methods
     374 */
     375
     376
     377/** Returns GObject type for KHTML html renderer class
     378 * Returns GObject type for KHTML html renderer class.
     379 *
     380 * @return type for KHTML html renderer class
     381 */
     382GType webi_get_type ();
     383
     384
     385/** Creates new html rendering engine
     386 * Creates new html rendering engine widget. To be able to view web pages,
     387 * add returned widget to a container and show the container.
     388 *
     389 * @return html rendering engine widget
     390 */
     391GtkWidget * webi_new ();
     392
     393/** Starts loading of a new url
     394 * Starts loading of a new url. Loading is asynchronous.
     395 *
     396 * @emit "load-start" signal on start
     397 * @emit "load-stop"  signal when loading stops, ie. succesfully loaded page, or error
     398 * @param self the engine to use
     399 * @param url the url to load
     400 */
     401void webi_load_url (Webi * self, const gchar * url);
     402
     403/** Reloads current url
     404 * reloads current url
     405 */
     406void webi_refresh (Webi * self);
     407
     408/** Cancels the load currently in progress, if any
     409 * Cancels the load currently in progress, if any.
     410 * @emit "load-stop"
     411 *
     412 * @param self the engine to use
     413 */
     414void webi_stop_load (Webi * self);
     415
     416/** Checks the browsing history position relative to the beginning of the history
     417 * Checks if the engine is at the beginning of browsing history.
     418 * @return \TRUE if browsing history has previous elements
     419 *         \FALSE otherwise
     420 */
     421gboolean webi_can_go_back (Webi * self);
     422
     423
     424/** Checks the browsing history position relative to the end of the history
     425 * Checks if the engine is at the end of browsing history.
     426 * @return \TRUE if browsing history has successive elements
     427 *         \FALSE otherwise
     428 */
     429gboolean webi_can_go_forward (Webi * self);
     430
     431/** Directs browser engine to the previous url in the browsing history
     432 * Directs browser engine to the previous url in the browsing history.
     433 * @emit "load-start" see \webi_load_url
     434 * @emit "load-stop" see \webi_load_url
     435 */
     436void webi_go_back (Webi * self);
     437
     438/** Directs browser engine to the next url in the browsing history
     439 * Directs browser engine to the next url in the browsing history.
     440 *
     441 * @emit "load-start" see \webi_load_url
     442 * @emit "load-stop" see \webi_load_url
     443 */
     444void webi_go_forward (Webi * self);
     445
     446/** Returns the url of the currently loaded page
     447 * Returns the url of the currently loaded page.
     448 * The string contains the full url used, including
     449 * the protocol. It can be absolute or relative.
     450 * The string must not be freed (const).
     451 *
     452 * @return  the url string of the currently loaded page.
     453 */
     454const gchar* webi_get_location (Webi * self);
     455
     456/** Returns the title of the currently loaded page
     457 * Returns the title of the currently loaded page.
     458 * If the page contains a frameset, title is the title of the
     459 * frameset.
     460 *
     461 * @return the title of the currently loaded page.
     462 */
     463const gchar* webi_get_title (Webi * self);
     464
     465/** Returns a status string set by javascript
     466 * Returns a string that javascript has set to be used
     467 * usually in the statusbar of the browser.
     468 *
     469 * @return javascript status string
     470 */
     471const gchar* webi_get_status_text (Webi * self);
     472
     473/** Returns internal representation of the engine
     474 * Returns internal representation of the engine.
     475 * Can be used in C++ code. Exposes the public NRCore api
     476 * to the user. This may be needed if certain functionality
     477 * is not implemented in C interface.
     478 * usage not recommended
     479 * Used with:
     480 * OSBB::Bridge* engine = 0;
     481 * Webi* khtml_engine = webi_new();
     482 * engine = static_cast<OSB::Bridge*>(webi_get_internal (engine));
     483 *
     484 */
     485void* webi_get_internal (Webi * self);
     486
     487/** Sets the settings of the rendering engine
     488 * Sets the settings of the rendering engine.
     489 *
     490 */
     491void webi_set_settings (Webi * self, const WebiSettings* settings);
     492
     493/**  Prints the internal render tree of the engine.
     494 *
     495 * Can be used in C++ debug code. This
     496 * usage not recommended
     497 */
     498const gchar* webi_render_tree (Webi * self);
     499
     500/** Toggles the emission of internal constructed load status messages
     501 * Sets the emission of internal constructed load status messages
     502 * Signalö emitted is status-text
     503 *
     504 * @param flag \TRUE if you want to receive internal status messages
     505 for loading
     506 \FALSE if not
     507*/
     508void webi_set_emit_internal_status (Webi * self, gboolean flag);
     509
     510
     511/** Sets the device type used for current window.
     512 *
     513 * @param self the engine which sent the signal
     514 * @param newDeviceType The new device type of current window
     515 */
     516void webi_set_device_type (Webi * self, WebiDeviceType device);
     517
     518/** Gets the device type used for current window.
     519 *
     520 * @param self the engine which sent the signal
     521 * @param newDeviceType The new device type of current window
     522 */
     523WebiDeviceType webi_get_device_type (Webi * self);
     524
     525
     526void webi_set_group (Webi* self, const gchar* group);
     527
     528const gchar* webi_get_group (Webi* self);
     529
     530void webi_set_text_multiplier (Webi* self, gfloat multiplier);
     531gfloat webi_get_text_multiplier (Webi* self);
     532
     533gboolean webi_find (Webi* self, const gchar* text, gboolean case_sensitive, gboolean dir_down);
     534
     535/** Gets the active selection.
     536 * The returned string must be freed with g_free()
     537 * Returns "" if selection is not active
     538 */
     539gchar* webi_get_current_selection_as_text(Webi* self);
     540
     541/** Gets the engine user agent string.
     542 * The returned string can be used to construct browser-specific
     543 * user-agent strings
     544 */
     545const gchar* webi_get_engine_user_agent_string ();
     546
     547#ifdef __cplusplus
     548}
     549#endif /* __cplusplus */
     550
     551#endif