WebKit/wx/WebKitSupport/EditorClientWx.h
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     1 /*
       
     2  * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com>
       
     3  *
       
     4  * All rights reserved.
       
     5  *
       
     6  * Redistribution and use in source and binary forms, with or without
       
     7  * modification, are permitted provided that the following conditions
       
     8  * are met:
       
     9  * 1. Redistributions of source code must retain the above copyright
       
    10  *    notice, this list of conditions and the following disclaimer.
       
    11  * 2. Redistributions in binary form must reproduce the above copyright
       
    12  *    notice, this list of conditions and the following disclaimer in the
       
    13  *    documentation and/or other materials provided with the distribution.
       
    14  *
       
    15  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
       
    16  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
       
    17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
       
    18  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
       
    19  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
       
    20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
       
    21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
       
    22  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
       
    23  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
       
    24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
       
    25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    26  */
       
    27 
       
    28 #ifndef EditorClientWx_h
       
    29 #define EditorClientWx_h
       
    30 
       
    31 #include "EditorClient.h"
       
    32 #include "Page.h"
       
    33 
       
    34 #include "WebView.h"
       
    35 #include "WebFrame.h"
       
    36 
       
    37 namespace WebCore {
       
    38 
       
    39 class EditorClientWx : public EditorClient {
       
    40 friend class ::wxWebView;
       
    41 friend class ::wxWebFrame;
       
    42 
       
    43 public:
       
    44     virtual ~EditorClientWx();
       
    45     void setPage(Page*);
       
    46     virtual void pageDestroyed();
       
    47 
       
    48     virtual bool shouldDeleteRange(Range*);
       
    49     virtual bool shouldShowDeleteInterface(HTMLElement*);
       
    50     virtual bool smartInsertDeleteEnabled();
       
    51     virtual bool isSelectTrailingWhitespaceEnabled();
       
    52     virtual bool isContinuousSpellCheckingEnabled();
       
    53     virtual void toggleContinuousSpellChecking();
       
    54     virtual bool isGrammarCheckingEnabled();
       
    55     virtual void toggleGrammarChecking();
       
    56     virtual int spellCheckerDocumentTag();
       
    57 
       
    58     virtual bool selectWordBeforeMenuEvent();
       
    59     virtual bool isEditable();
       
    60 
       
    61     virtual bool shouldBeginEditing(Range*);
       
    62     virtual bool shouldEndEditing(Range*);
       
    63     virtual bool shouldInsertNode(Node*, Range*,
       
    64                                   EditorInsertAction);
       
    65     virtual bool shouldInsertText(const String&, Range*,
       
    66                                   EditorInsertAction);
       
    67     virtual bool shouldApplyStyle(CSSStyleDeclaration*,
       
    68                                   Range*);
       
    69     virtual bool shouldMoveRangeAfterDelete(Range*, Range*);
       
    70     virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, 
       
    71                                 EAffinity, bool stillSelecting);
       
    72 
       
    73     virtual void didBeginEditing();
       
    74     virtual void respondToChangedContents();
       
    75     virtual void respondToChangedSelection();
       
    76     virtual void didEndEditing();
       
    77     virtual void didWriteSelectionToPasteboard();
       
    78     virtual void didSetSelectionTypesForPasteboard();
       
    79 
       
    80     virtual void registerCommandForUndo(PassRefPtr<EditCommand>);
       
    81     virtual void registerCommandForRedo(PassRefPtr<EditCommand>);
       
    82     virtual void clearUndoRedoOperations();
       
    83 
       
    84     virtual bool canUndo() const;
       
    85     virtual bool canRedo() const;
       
    86 
       
    87     virtual void undo();
       
    88     virtual void redo();
       
    89     
       
    90     virtual const char* interpretKeyEvent(const KeyboardEvent*);
       
    91     virtual bool handleEditingKeyboardEvent(KeyboardEvent*);
       
    92     virtual void handleKeyboardEvent(KeyboardEvent*);
       
    93     virtual void handleInputMethodKeydown(KeyboardEvent*);
       
    94     
       
    95     virtual void textFieldDidBeginEditing(Element*);
       
    96     virtual void textFieldDidEndEditing(Element*);
       
    97     virtual void textDidChangeInTextField(Element*);
       
    98     virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*);
       
    99     virtual void textWillBeDeletedInTextField(Element*);
       
   100     virtual void textDidChangeInTextArea(Element*);
       
   101 
       
   102     virtual void ignoreWordInSpellDocument(const String&);
       
   103     virtual void learnWord(const String&);
       
   104     virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength);
       
   105     virtual void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength);
       
   106     virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail& detail);
       
   107     virtual void updateSpellingUIWithMisspelledWord(const String&);
       
   108     virtual void showSpellingUI(bool show);
       
   109     virtual bool spellingUIIsShowing();
       
   110     virtual void getGuessesForWord(const String&, Vector<String>& guesses);
       
   111     virtual String getAutoCorrectSuggestionForMisspelledWord(const WebCore::String&);
       
   112     
       
   113     virtual void willSetInputMethodState();
       
   114     virtual void setInputMethodState(bool enabled);
       
   115 
       
   116 private:
       
   117     Page* m_page;
       
   118 };
       
   119 
       
   120 }
       
   121 
       
   122 #endif // EditorClientWx_h