WebKit/wx/WebSettings.h
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     1 /*
       
     2  * Copyright (C) 2009 Kevin Ollivier.  All rights reserved.
       
     3  *
       
     4  * Redistribution and use in source and binary forms, with or without
       
     5  * modification, are permitted provided that the following conditions
       
     6  * are met:
       
     7  *
       
     8  * 1.  Redistributions of source code must retain the above copyright
       
     9  *     notice, this list of conditions and the following disclaimer. 
       
    10  * 2.  Redistributions in binary form must reproduce the above copyright
       
    11  *     notice, this list of conditions and the following disclaimer in the
       
    12  *     documentation and/or other materials provided with the distribution. 
       
    13  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
       
    14  *     its contributors may be used to endorse or promote products derived
       
    15  *     from this software without specific prior written permission. 
       
    16  *
       
    17  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
       
    18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       
    19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
       
    20  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
       
    21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
       
    22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
       
    23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
       
    24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
       
    25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
       
    26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    27  */
       
    28  
       
    29 #ifndef WebSettings_h
       
    30 #define WebSettings_h
       
    31 
       
    32 #include "wx/wxprec.h"
       
    33 #ifndef WX_PRECOMP
       
    34     #include "wx/wx.h"
       
    35 #endif
       
    36 
       
    37 #include "WebKitDefines.h"
       
    38 
       
    39 namespace WebCore {
       
    40 class Settings;
       
    41 }
       
    42 
       
    43 enum wxEditableLinkBehavior {
       
    44     wxEditableLinkDefaultBehavior,
       
    45     wxEditableLinkAlwaysLive,
       
    46     wxEditableLinkOnlyLiveWithShiftKey,
       
    47     wxEditableLinkLiveWhenNotFocused,
       
    48     wxEditableLinkNeverLive
       
    49 };
       
    50 
       
    51 /**
       
    52     @class wxWebSettings
       
    53     
       
    54     This class is used to control the configurable aspects of the WebKit engine.
       
    55     
       
    56     Do not instantiate this object directly. Instead, create a wxWebView and
       
    57     call its wxWebView::GetWebSettings() method to get and change that WebView's settings.
       
    58     
       
    59 */
       
    60 
       
    61 class WXDLLIMPEXP_WEBKIT wxWebSettings: public wxObject {
       
    62 public:
       
    63     wxWebSettings(WebCore::Settings* settings) :
       
    64         wxObject(),
       
    65         m_settings(settings)
       
    66     {}
       
    67     
       
    68     wxWebSettings() : wxObject() {}
       
    69 
       
    70     /**
       
    71         Sets the default font size for fixed fonts.
       
    72     */
       
    73     void SetDefaultFixedFontSize(int size);
       
    74     
       
    75     /**
       
    76         Returns the default font size for fixed fonts.
       
    77     */
       
    78     int GetDefaultFixedFontSize() const;
       
    79     
       
    80     /**
       
    81         Sets the default font size for fonts.
       
    82     */
       
    83     void SetDefaultFontSize(int size);
       
    84 
       
    85     /**
       
    86         Returns the default font size for fonts.
       
    87     */
       
    88     int GetDefaultFontSize() const;
       
    89     
       
    90     /**
       
    91         Sets the minimum acceptable font size.
       
    92     */
       
    93     void SetMinimumFontSize(int size);
       
    94 
       
    95     /**
       
    96         Returns the minimum acceptable font size.
       
    97     */
       
    98     int GetMinimumFontSize() const;
       
    99     
       
   100     /**
       
   101         Sets whether or not images are loaded automatically. (e.g. in email 
       
   102         programs you may wish to not load images until you confirm it is not SPAM)
       
   103     */
       
   104     void SetLoadsImagesAutomatically(bool loadAutomatically);
       
   105     
       
   106     /**
       
   107         Returns whether or not images are loaded automatically.
       
   108     */
       
   109     bool LoadsImagesAutomatically() const;
       
   110     
       
   111     /**
       
   112         Sets whether or not the WebView runs JavaScript code.
       
   113     */
       
   114     void SetJavaScriptEnabled(bool enabled);
       
   115 
       
   116     /**
       
   117         Returns whether or not the WebView runs JavaScript code.
       
   118     */
       
   119     bool IsJavaScriptEnabled() const;
       
   120     
       
   121     /**
       
   122         Sets the path where local data will be stored.
       
   123     */
       
   124     void SetLocalStoragePath(const wxString& path);
       
   125 
       
   126     /**
       
   127         Returns the path where local data will be stored.
       
   128     */
       
   129     wxString GetLocalStoragePath() const;
       
   130     
       
   131     /**
       
   132         Sets how links are handled when the wxWebView is in editing mode. 
       
   133     */    
       
   134     void SetEditableLinkBehavior(wxEditableLinkBehavior behavior);
       
   135     
       
   136     /**
       
   137         Returns how links are handled when the wxWebView is in editing mode. 
       
   138     */   
       
   139     wxEditableLinkBehavior GetEditableLinkBehavior() const;
       
   140     
       
   141     /**
       
   142         Sets whether or not web pages can load plugins.
       
   143     */
       
   144     void SetPluginsEnabled(bool enabled);
       
   145     
       
   146     /**
       
   147         Returns whether or not web pages can load plugins.
       
   148     */    
       
   149     bool ArePluginsEnabled() const;
       
   150     
       
   151 private:
       
   152     WebCore::Settings* m_settings;
       
   153 
       
   154 };
       
   155 
       
   156 #endif // WebSettings_h