#ifndef InputMethodContext_h
#define InputMethodContext_h
#include "bindings/v8/ScriptWrappable.h"
#include "core/editing/CompositionUnderline.h"
#include "core/events/EventTarget.h"
#include "core/html/HTMLElement.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/RefPtr.h"
#include "wtf/text/AtomicString.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
class ExecutionContext;
class InputMethodController;
class Node;
class InputMethodContext FINAL : public ScriptWrappable, public EventTargetWithInlineData {
public:
static PassOwnPtr<InputMethodContext> create(HTMLElement*);
virtual ~InputMethodContext();
void ref() { m_element->ref(); }
void deref() { m_element->deref(); }
String locale() const;
HTMLElement* target() const;
unsigned compositionStartOffset();
unsigned compositionEndOffset();
void confirmComposition();
String compositionText() const;
int selectionStart() const;
int selectionEnd() const;
const Vector<unsigned>& segments();
virtual const AtomicString& interfaceName() const OVERRIDE;
virtual ExecutionContext* executionContext() const OVERRIDE;
DEFINE_ATTRIBUTE_EVENT_LISTENER(candidatewindowshow);
DEFINE_ATTRIBUTE_EVENT_LISTENER(candidatewindowupdate);
DEFINE_ATTRIBUTE_EVENT_LISTENER(candidatewindowhide);
void dispatchCandidateWindowShowEvent();
void dispatchCandidateWindowUpdateEvent();
void dispatchCandidateWindowHideEvent();
private:
InputMethodContext(HTMLElement*);
bool hasFocus() const;
CompositionUnderline selectedSegment() const;
InputMethodController& inputMethodController() const;
virtual void refEventTarget() OVERRIDE { ref(); }
virtual void derefEventTarget() OVERRIDE { deref(); }
HTMLElement* m_element;
Vector<unsigned> m_segments;
};
}
#endif