📄 osb.h
字号:
/* * Copyright (c) 2004 Nokia. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Nokia nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */#ifndef OSB__osb_h#define OSB__osb_h#include <glib.h>#include <gtk/gtk.h>/** private forward declarations */class FrameImpl;class RootImpl;class PreferencesImpl;namespace OSB {/** public forward declarations*/class Preferences;class History;class Position; class Root;class Frame;class FrameLoadDelegate;class UIDelegate;class ProtocolDelegate;class URLCredentialStorage;class DataSource;class ElementInfo{public: virtual ~ElementInfo() {} virtual gboolean selected()=0; virtual const gchar* linkTitle() =0; virtual const gchar* linkLabel()=0; virtual const gchar* linkURL()=0; virtual const gchar* linkTarget()=0; /** x = y = w = h= -1 if there's no image */ virtual void imageRect(int &x, int &y, int &w,int &h) = 0; virtual const gchar* imageURL()=0; virtual const gchar* imageAltText()=0;};class ContentRepresentation{public: virtual ~ContentRepresentation(); virtual void setDataSource(DataSource* source)=0; virtual void receivedData(DataSource* source)=0; virtual void receivedError(DataSource* source)=0; virtual void finishedLoading(DataSource* source)=0; virtual bool canProvideDocumentSource()=0; virtual const gchar* documentSource()=0; virtual const gchar* title()=0; virtual GtkWidget* widget()=0;};class ContentRepresentationFactory{public: virtual ~ContentRepresentationFactory(); virtual ContentRepresentation* create(const char* mime)=0; virtual void destroy(ContentRepresentation*)=0; enum Type { Embedded, Frame, Standalone }; virtual Type type(const char* mime)=0;};class ProtocolDelegate {public: virtual ~ProtocolDelegate() {} virtual bool provides(const gchar* proto){ return false;} virtual void setProxy(const gchar* proxy){}};class UIDelegate{public: virtual ~UIDelegate() {} virtual void setStatusText(Frame* sender, const gchar* status){} virtual bool toolbarsVisible(Frame* sender) {return true;} virtual void setToolbarsVisible(Frame* sender, bool flag){} virtual bool statusBarVisible(Frame* sender) {return true;} virtual void setStatusBarVisible(Frame* sender, bool flag) {} /** * @param node type to be changed */ virtual void onMouseOverChanged(Frame* sender, ElementInfo* node){} virtual Root* createNewRoot(Frame* sender, const gchar* url){return 0;} /** Prompt user an alert panel * @param message message to display in alert panel */ virtual void alertPanel(Frame* sender, const gchar *message) {} /** Prompt user with confirmation panel * * @return \true if user confirmed the panel * \false if user cancelled the panel */ virtual bool confirmPanel(Frame* sender, const gchar *message) { return false; } /** Prompt user with text input panel * * @param result pointer to string that should contain result of the text user entered to panel * String should be allocated with glib allocation functions (g_new(), g_strdup,..), * it will be freed by the caller with g_free() * @return \true if user confirmed the panel * \false if user cancelled the panel */ virtual bool textInputPanel(Frame* sender, const gchar *prompt, const gchar *defaultText, gchar **result) {if (result) *result = 0; return false;} /** Prompt user with authentiction panel * * @param realm realm to authenticate user in * @param username pointer to string that contains username to use. * String should be allocated with glib allocation functions (g_new(), g_strdup,..), * it will be freed by the caller with g_free() * @param password password to use or 0. * String should be allocated with glib allocation functions (g_new(), g_strdup,..), * it will be freed by the caller with g_free() * * @return \true if authentication should be tried, * \false if authentication should not be tried */ virtual bool authPanel(Frame* sender, const gchar * realm, gchar ** username, gchar ** password) { if (username) *username=0; if (password) *password=0; return false;}};class FrameLoadDelegate {public: virtual ~FrameLoadDelegate() {} /** parameters will change*/ virtual void onClientRedirectReceived(Frame* sender, const gchar* to){} virtual void onClientRedirected(Frame* sender, const gchar* to){} virtual void onClientRedirectCancelled(Frame* sender, const gchar* to){} virtual void onServerRedirected(Frame* sender, const gchar* to) {} virtual void onFrameLoadStarted(Frame* sender) {} virtual void onFrameLoadFinished(Frame* sender, int status) {} // after this we are working with new url virtual void onCommitLoad(Frame* sender) {} virtual void onTitleChanged(Frame* sender, const gchar* title) {}};class ResourceStatus {private: static int uniqId; static int newId() { return uniqId++; } gchar * _name; gint _size; gint _last; gint _received; gint _status; bool _error; int _id; protected: ResourceStatus(const gchar * name = 0) : _name(name?g_strdup(name):0), _size(0), _last(0), _received(0), _status(0), _error(false) { _id = newId(); } ~ResourceStatus() { g_free(_name); } void setSize(gint size) { _size = size; } void addReceived(gint received) { _received += received; _last=received; } void setError(gint errorCode = -1) { _error =true; _status = errorCode; }public: const gchar * name() { return _name; } gint id() const { return _id; } gint size() const { return _size; } gint received() const { return _received; } gint lastReceived() const { return _last; } gint status() const { return _status; } bool error() const { return _error; }};class ResourceLoadDelegate{public: virtual ~ResourceLoadDelegate() {} virtual void onResourceLoadStarted(Frame* sender, const ResourceStatus * status){} virtual void onResourceLoadHeaders(Frame* sender, const ResourceStatus * status){} /** for each item loaded in frame, including the frame page itself * @param item type to be changed */ virtual void onResourceLoadStatus(Frame* sender, const ResourceStatus * status){} virtual void onResourceLoadFinished(Frame* sender, const ResourceStatus * status){}};class BackForwardListItem{public: virtual ~BackForwardListItem() {} virtual const gchar* URL()=0; virtual const gchar* originalURL()=0; virtual const gchar* title()=0; virtual const gchar* alternateTitle()=0; virtual void setAlternateTitle(const gchar* title)=0; // GdkPixbuf icon(); /** Get the last visited time * @returns the last visited time. struct guaranteed to be valid until destruction of the item */ virtual const GDate* lastVisited()=0;};class BackForwardList {public: typedef BackForwardListItem Item; typedef void (*ChangedFunc)(BackForwardList*, Item*, gpointer data); virtual ~BackForwardList() {}; virtual void goBack()=0; virtual void goForward()=0; virtual void goToItem(Item* item)=0; virtual Item* backItem()=0; virtual int backListCount()=0; virtual Item* currentItem()=0; virtual Item* itemAtIndex(int index)=0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -