#include "config.h"
#include "WKView.h"
#include "WKAPICast.h"
#include "WebView.h"
using namespace WebKit;
WKTypeID WKViewGetTypeID()
{
return toAPI(APIObject::TypeView);
}
WKViewRef WKViewCreate(RECT rect, WKContextRef contextRef, WKPageGroupRef pageGroupRef, HWND parentWindow)
{
RefPtr<WebView> view = WebView::create(rect, toImpl(contextRef), toImpl(pageGroupRef), parentWindow);
return toAPI(view.release().leakRef());
}
HWND WKViewGetWindow(WKViewRef viewRef)
{
return toImpl(viewRef)->window();
}
WKPageRef WKViewGetPage(WKViewRef viewRef)
{
return toAPI(toImpl(viewRef)->page());
}
void WKViewSetParentWindow(WKViewRef viewRef, HWND hostWindow)
{
toImpl(viewRef)->setParentWindow(hostWindow);
}
void WKViewWindowAncestryDidChange(WKViewRef viewRef)
{
toImpl(viewRef)->windowAncestryDidChange();
}
void WKViewSetIsInWindow(WKViewRef viewRef, bool isInWindow)
{
toImpl(viewRef)->setIsInWindow(isInWindow);
}
void WKViewSetInitialFocus(WKViewRef viewRef, bool forward)
{
bool isKeyboardEventValid = false;
toImpl(viewRef)->setInitialFocus(forward, isKeyboardEventValid, WebKeyboardEvent());
}
void WKViewSetScrollOffsetOnNextResize(WKViewRef viewRef, WKSize scrollOffset)
{
toImpl(viewRef)->setScrollOffsetOnNextResize(toIntSize(scrollOffset));
}
void WKViewSetFindIndicatorCallback(WKViewRef viewRef, WKViewFindIndicatorCallback callback, void* context)
{
toImpl(viewRef)->setFindIndicatorCallback(callback, context);
}
WKViewFindIndicatorCallback WKViewGetFindIndicatorCallback(WKViewRef viewRef, void** context)
{
return toImpl(viewRef)->getFindIndicatorCallback(context);
}
bool WKViewIsPageOverlayInstalled(WKViewRef viewRef)
{
return toImpl(viewRef)->pageOverlayInstalled();
}
void WKViewSetViewUndoClient(WKViewRef viewRef, const WKViewUndoClient* wkClient)
{
if (wkClient && wkClient->version)
return;
toImpl(viewRef)->initializeUndoClient(wkClient);
}
void WKViewReapplyEditCommand(WKViewRef viewRef, WKEditCommandRef command)
{
toImpl(viewRef)->reapplyEditCommand(toImpl(command));
}
void WKViewUnapplyEditCommand(WKViewRef viewRef, WKEditCommandRef command)
{
toImpl(viewRef)->unapplyEditCommand(toImpl(command));
}
void WKViewSetDrawsTransparentBackground(WKViewRef viewRef, bool drawsTransparentBackground)
{
toImpl(viewRef)->page()->setDrawsTransparentBackground(drawsTransparentBackground);
}
bool WKViewDrawsTransparentBackground(WKViewRef viewRef)
{
return toImpl(viewRef)->page()->drawsTransparentBackground();
}
void WKViewSetCustomDropTarget(WKViewRef viewRef, IDropTarget* dropTarget)
{
return toImpl(viewRef)->setCustomDropTarget(dropTarget);
}