Reviewed by Maciej.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
Updated to include the right path.
* wtf/FastMalloc.h: #include Platform.h, since we use Platform macros.
WebCore:
Reviewed by Maciej.
Some Widget refactoring.
* WebCore.vcproj/WebCore/WebCore.vcproj:
* bridge/mac/FrameMac.mm:
* bridge/win/FrameWin.cpp:
(WebCore::FrameWin::runJavaScriptAlert):
(WebCore::FrameWin::runJavaScriptConfirm):
* bridge/win/PageWin.cpp:
(WebCore::Page::Page):
(WebCore::rootWindowForFrame):
* html/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::translate):
* page/FrameView.cpp:
(WebCore::FrameView::isFrameView):
* page/Page.h:
(WebCore::Page::setInstanceHandle):
(WebCore::Page::instanceHandle):
* platform/GraphicsContext.h:
* platform/ScrollView.h:
* platform/Widget.h:
* platform/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::translate):
(WebCore::GraphicsContext::origin):
* platform/mac/WidgetMac.mm:
(WebCore::Widget::clearFocus):
* platform/win/ResourceLoaderWin.cpp:
(WebCore::initializeOffScreenResourceLoaderWindow):
* platform/win/ScreenWin.cpp:
(WebCore::monitorInfo):
* platform/win/ScrollViewWin.cpp:
(WebCore::ScrollView::updateContents):
(WebCore::ScrollView::visibleWidth):
(WebCore::ScrollView::visibleHeight):
(WebCore::ScrollView::visibleContentRect):
(WebCore::ScrollView::viewportToContents):
(WebCore::ScrollView::contentsToViewport):
(WebCore::ScrollView::scrollBy):
(WebCore::ScrollView::updateScrollInfo):
(WebCore::ScrollView::updateScrollBars):
* platform/win/SharedTimerWin.cpp:
(WebCore::initializeOffScreenTimerWindow):
* platform/win/TemporaryLinkStubs.cpp:
(FrameView::updateBorder):
(ScrollView::paint):
(GraphicsContext::clip):
* platform/win/WidgetWin.cpp:
(WebCore::Widget::Widget):
(WebCore::Widget::parentWindow):
(WebCore::Widget::setParentWindow):
(WebCore::Widget::frameGeometry):
(WebCore::Widget::hasFocus):
(WebCore::Widget::setFocus):
(WebCore::Widget::show):
(WebCore::Widget::hide):
(WebCore::Widget::setFrameGeometry):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16515
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-09-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ Updated to include the right path.
+ * wtf/FastMalloc.h: #include Platform.h, since we use Platform macros.
+
2006-09-20 Anders Carlsson <acarlsson@apple.com>
Reviewed by Dave Hyatt.
<Tool
Name="VCPreBuildEventTool"
Description="Constructing generated files..."
- CommandLine="bash build-generated-files.sh "$(ConfigurationName)" "$(WebKitOutputDir)"

"$(WebkitOutputDir)\bin\dftables_debug.exe" "$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\chartables.c"

mkdir 2>NUL "$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore"

xcopy /y /d "$(ProjectDir)\..\..\API\JSBase.h" "$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\API\JSContextRef.h" "$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\API\JSObjectRef.h" "$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\API\JSStringRef.h" "$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\API\JSValueRef.h" "$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\API\JavaScriptCore.h" "$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore"
"
+ CommandLine="set PATH=%PATH%;%SystemDrive%\cygwin\bin

bash build-generated-files.sh "$(ConfigurationName)" "$(WebKitOutputDir)"

"$(WebkitOutputDir)\bin\dftables_debug.exe" "$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\chartables.c"

mkdir 2>NUL "$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore"

xcopy /y /d "$(ProjectDir)\..\..\API\JSBase.h" "$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\API\JSContextRef.h" "$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\API\JSObjectRef.h" "$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\API\JSStringRef.h" "$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\API\JSValueRef.h" "$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\API\JavaScriptCore.h" "$(WebKitOutputDir)\include\JavaScriptCore\JavaScriptCore"
"
/>
<Tool
Name="VCCustomBuildTool"
#ifndef KXMLCORE_FAST_MALLOC_H
#define KXMLCORE_FAST_MALLOC_H
+#include "Platform.h"
#include <stdlib.h>
#include <new>
+2006-09-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Maciej.
+
+ Some Widget refactoring.
+
+ * WebCore.vcproj/WebCore/WebCore.vcproj:
+ * bridge/mac/FrameMac.mm:
+ * bridge/win/FrameWin.cpp:
+ (WebCore::FrameWin::runJavaScriptAlert):
+ (WebCore::FrameWin::runJavaScriptConfirm):
+ * bridge/win/PageWin.cpp:
+ (WebCore::Page::Page):
+ (WebCore::rootWindowForFrame):
+ * html/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::translate):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::isFrameView):
+ * page/Page.h:
+ (WebCore::Page::setInstanceHandle):
+ (WebCore::Page::instanceHandle):
+ * platform/GraphicsContext.h:
+ * platform/ScrollView.h:
+ * platform/Widget.h:
+ * platform/cairo/GraphicsContextCairo.cpp:
+ (WebCore::GraphicsContext::translate):
+ (WebCore::GraphicsContext::origin):
+ * platform/mac/WidgetMac.mm:
+ (WebCore::Widget::clearFocus):
+ * platform/win/ResourceLoaderWin.cpp:
+ (WebCore::initializeOffScreenResourceLoaderWindow):
+ * platform/win/ScreenWin.cpp:
+ (WebCore::monitorInfo):
+ * platform/win/ScrollViewWin.cpp:
+ (WebCore::ScrollView::updateContents):
+ (WebCore::ScrollView::visibleWidth):
+ (WebCore::ScrollView::visibleHeight):
+ (WebCore::ScrollView::visibleContentRect):
+ (WebCore::ScrollView::viewportToContents):
+ (WebCore::ScrollView::contentsToViewport):
+ (WebCore::ScrollView::scrollBy):
+ (WebCore::ScrollView::updateScrollInfo):
+ (WebCore::ScrollView::updateScrollBars):
+ * platform/win/SharedTimerWin.cpp:
+ (WebCore::initializeOffScreenTimerWindow):
+ * platform/win/TemporaryLinkStubs.cpp:
+ (FrameView::updateBorder):
+ (ScrollView::paint):
+ (GraphicsContext::clip):
+ * platform/win/WidgetWin.cpp:
+ (WebCore::Widget::Widget):
+ (WebCore::Widget::parentWindow):
+ (WebCore::Widget::setParentWindow):
+ (WebCore::Widget::frameGeometry):
+ (WebCore::Widget::hasFocus):
+ (WebCore::Widget::setFocus):
+ (WebCore::Widget::show):
+ (WebCore::Widget::hide):
+ (WebCore::Widget::setFrameGeometry):
+
2006-09-22 Anders Carlsson <acarlsson@apple.com>
Reviewed by Tim H.
>
<Tool
Name="VCPreBuildEventTool"
- CommandLine="bash build-generated-files.sh "$(ConfigurationName)" "$(WebKitOutputDir)"
"
+ CommandLine="set PATH=%PATH%;%SystemDrive%\cygwin\bin

bash build-generated-files.sh "$(ConfigurationName)" "$(WebKitOutputDir)"
"
/>
<Tool
Name="VCCustomBuildTool"
return selector;
}
-
-bool FrameView::isFrameView() const
-{
- return true;
-}
-
FrameMac::FrameMac(Page* page, Element* ownerElement)
: Frame(page, ownerElement)
, _bridge(nil)
text.replace('\\', backslashAsCurrencySymbol());
UChar nullChar = 0;
text += String(&nullChar, 1);
- MessageBox(view()->windowHandle(), text.characters(), L"JavaScript Alert", MB_OK);
+ MessageBox(view()->containingWindow(), text.characters(), L"JavaScript Alert", MB_OK);
}
bool FrameWin::runJavaScriptConfirm(String const& message)
text.replace('\\', backslashAsCurrencySymbol());
UChar nullChar = 0;
text += String(&nullChar, 1);
- return MessageBox(view()->windowHandle(), text.characters(), L"JavaScript Alert", MB_OKCANCEL) == IDOK;
+ return MessageBox(view()->containingWindow(), text.characters(), L"JavaScript Alert", MB_OKCANCEL) == IDOK;
}
// FIXME: This needs to be unified with the keyPress method on FrameMac
namespace WebCore {
-Page::Page(HWND hwnd)
-: m_windowHandle(hwnd)
-, m_frameCount(0)
-, m_widget(0)
+Page::Page()
+: m_frameCount(0)
, m_dragCaretController(0, true)
{
init();
FrameView* frameView = frame->view();
if (!frameView)
return 0;
- HWND frameWnd = frameView->windowHandle();
+ HWND frameWnd = frameView->containingWindow();
if (!frameWnd)
return 0;
return GetAncestor(frameWnd, GA_ROOT);
GraphicsContext* c = drawingContext();
if (!c)
return;
- c->translate(FloatSize(tx, ty));
+ c->translate(tx, ty);
}
void CanvasRenderingContext2D::setStrokeColor(const String& color)
virtual void redirectionTimerFired(Timer<Frame>*);
virtual bool isLoadTypeReload() = 0;
+ virtual KURL originalRequestURL() const = 0;
public:
void loadDone();
void reparseConfiguration();
private:
- virtual KURL originalRequestURL() const = 0;
void childBegin();
void submitFormAgain();
d = 0;
}
+bool FrameView::isFrameView() const
+{
+ return true;
+}
+
void FrameView::clearPart()
{
m_frame = 0;
#if PLATFORM(WIN)
typedef struct HWND__* HWND;
+typedef struct HINSTANCE__* HINSTANCE;
#endif
namespace WebCore {
WebCorePageBridge* bridge() const { return m_bridge; }
#endif
-#if PLATFORM(WIN_OS)
- Page(HWND);
- HWND windowHandle() const { return m_windowHandle; }
+#if PLATFORM(WIN)
+ Page();
+ // The global DLL or application instance used for all windows.
+ static void setInstanceHandle(HINSTANCE instanceHandle) { s_instanceHandle = instanceHandle; }
+ static HINSTANCE instanceHandle() { return s_instanceHandle; }
#endif
private:
RefPtr<Frame> m_mainFrame;
int m_frameCount;
- mutable Widget* m_widget;
String m_groupName;
mutable SelectionController m_dragCaretController;
WebCorePageBridge* m_bridge;
#endif
-#if PLATFORM(WIN_OS)
- HWND m_windowHandle;
+#if PLATFORM(WIN)
+ static HINSTANCE s_instanceHandle;
#endif
};
void scale(const FloatSize&);
void rotate(float angleInRadians);
- void translate(const FloatSize&);
-
+ void translate(int x, int y);
+ IntPoint origin();
+
void concatCTM(const AffineTransform&);
#ifdef SVG_SUPPORT
// (like Windows), we need this method in order to do the scroll ourselves.
void wheelEvent(PlatformWheelEvent&);
-#if __APPLE__
+#if PLATFORM(MAC)
NSView* getDocumentView() const;
#endif
#if PLATFORM(WIN)
ScrollView();
~ScrollView();
+
+ virtual void paint(GraphicsContext*, const IntRect&);
+
private:
void updateScrollBars();
IntSize maximumScroll() const;
#endif
#if PLATFORM(WIN)
-typedef struct HWND__ *HWND;
-typedef struct HINSTANCE__ *HINSTANCE;
+typedef struct HWND__* HWND;
#endif
#if PLATFORM(GDK)
virtual void paint(GraphicsContext*, const IntRect&);
- virtual IntRect frameGeometry() const;
virtual void setFrameGeometry(const IntRect&);
+ virtual IntRect frameGeometry() const;
virtual int baselinePosition(int height) const; // relative to the top of the widget
- virtual IntPoint mapFromGlobal(const IntPoint&) const;
-
bool hasFocus() const;
- void setFocus();
- void clearFocus();
+ virtual void setFocus();
+ virtual void clearFocus();
virtual bool checksDescendantsForFocus() const;
virtual FocusPolicy focusPolicy() const;
void setCursor(const Cursor&);
Cursor cursor();
- void show();
- void hide();
+ virtual void show();
+ virtual void hide();
virtual void populate() {}
virtual bool isFrameView() const;
#if PLATFORM(WIN)
- Widget(HWND);
- HWND windowHandle() const;
- void setWindowHandle(HWND);
- // The global DLL or application instance used for all WebCore windows.
- static HINSTANCE instanceHandle;
+ IntRect convertToContainingWindow(const IntRect&) const;
+ IntPoint convertToContainingWindow(const IntPoint&) const;
+ IntPoint convertFromContainingWindow(const IntPoint&) const;
+
+ void setContainingWindow(HWND);
+ HWND containingWindow() const;
+
+ void setParent(Widget*);
+ Widget* parent() const;
#endif
#if PLATFORM(GDK)
- Widget(GdkDrawable* drawable);
- virtual void setDrawable(GdkDrawable* drawable);
- GdkDrawable* drawable() const;
+ Widget(GdkDrawable* drawable);
+ virtual void setDrawable(GdkDrawable* drawable);
+ GdkDrawable* drawable() const;
#endif
-
#if PLATFORM(QT)
QWidget* parentWidget() const;
virtual void setParentWidget(QWidget*);
void setQWidget(QWidget*);
#endif
-
#if PLATFORM(MAC)
Widget(NSView* view);
return result;
}
+void GraphicsContext::translate(int x, int y)
+{
+ cairo_t* context = m_data->context;
+ cairo_translate(context, x, y);
+}
+
HDC GraphicsContext::getWindowsContext()
{
cairo_surface_t* surface = cairo_get_target(platformContext());
return hdc;
}
+IntPoint GraphicsContext::origin()
+{
+ cairo_matrix_t matrix;
+ cairo_t* context = m_data->context;
+ cairo_get_matrix(context, &matrix);
+ return IntPoint(matrix.x0, matrix.y0);
+}
+
void GraphicsContext::releaseWindowsContext()
{
cairo_surface_t* surface = cairo_get_target(platformContext());
cairo_surface_mark_dirty(surface);
}
-}
+} // namespace WebCore
#endif // PLATFORM(CAIRO)
{
if (!hasFocus())
return;
+ // FIXME: This probably shouldn't be the Widget's responsibility
FrameMac::clearDocumentFocus(this);
}
#include "DocLoader.h"
#include "Frame.h"
#include "Document.h"
+#include "Page.h"
#include <windows.h>
#include <wininet.h>
memset(&wcex, 0, sizeof(WNDCLASSEX));
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.lpfnWndProc = ResourceLoaderWndProc;
- wcex.hInstance = Widget::instanceHandle;
+ wcex.hInstance = Page::instanceHandle();
wcex.lpszClassName = kResourceLoaderWindowClassName;
RegisterClassEx(&wcex);
transferJobWindowHandle = CreateWindow(kResourceLoaderWindowClassName, 0, 0, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
- HWND_MESSAGE, 0, Widget::instanceHandle, 0);
+ HWND_MESSAGE, 0, Page::instanceHandle(), 0);
loadStatusMessage = RegisterWindowMessage(L"com.apple.WebKit.ResourceLoaderLoadStatus");
}
#include "IntRect.h"
#include "FloatRect.h"
+#include "Frame.h"
#include "Page.h"
#include <windows.h>
static MONITORINFOEX monitorInfo(const Page* page)
{
- HMONITOR monitor = MonitorFromWindow(page->windowHandle(), MONITOR_DEFAULTTOPRIMARY);
+ HMONITOR monitor = MonitorFromWindow(page->mainFrame()->view()->containingWindow(), MONITOR_DEFAULTTOPRIMARY);
MONITORINFOEX info;
info.cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo(monitor, &info);
RECT dirtyRect = RECT(adjustedDirtyRect);
#if PAINT_FLASHING_DEBUG
- HDC dc = GetDC(windowHandle());
+ HDC dc = GetDC(containingWindow());
FillRect(dc, &dirtyRect, (HBRUSH)GetStockObject(BLACK_BRUSH));
- ReleaseDC(windowHandle(), dc);
+ ReleaseDC(containingWindow(), dc);
#endif
- InvalidateRect(windowHandle(), &dirtyRect, true);
+ InvalidateRect(containingWindow(), &dirtyRect, true);
if (now)
- UpdateWindow(windowHandle());
+ UpdateWindow(containingWindow());
}
int ScrollView::visibleWidth() const
{
RECT bounds;
- GetClientRect(windowHandle(), &bounds);
+ GetClientRect(containingWindow(), &bounds);
return (bounds.right - bounds.left);
}
int ScrollView::visibleHeight() const
{
RECT bounds;
- GetClientRect(windowHandle(), &bounds);
+ GetClientRect(containingWindow(), &bounds);
return (bounds.bottom - bounds.top);
}
FloatRect ScrollView::visibleContentRect() const
{
RECT bounds;
- GetClientRect(windowHandle(), &bounds);
+ GetClientRect(containingWindow(), &bounds);
FloatRect contentRect = bounds;
contentRect.move(m_data->scrollOffset);
return contentRect;
IntPoint ScrollView::viewportToContents(const IntPoint& contentsPoint)
{
POINT point = contentsPoint;
- MapWindowPoints(GetAncestor(windowHandle(), GA_ROOT), windowHandle(), &point, 1);
+ MapWindowPoints(GetAncestor(containingWindow(), GA_ROOT), containingWindow(), &point, 1);
return IntPoint(point) + scrollOffset();
}
IntPoint ScrollView::contentsToViewport(const IntPoint& viewportPoint)
{
POINT point = viewportPoint - scrollOffset();
- MapWindowPoints(windowHandle(), GetAncestor(windowHandle(), GA_ROOT), &point, 1);
+ MapWindowPoints(containingWindow(), GetAncestor(containingWindow(), GA_ROOT), &point, 1);
return point;
}
return;
if (!m_data->hasStaticBackground)
// FIXME: This could be made more efficient by passing a valid clip rect for only the document content.
- ScrollWindowEx(windowHandle(), -scrollDelta.width(), -scrollDelta.height(), 0, 0, 0, 0, SW_INVALIDATE);
+ ScrollWindowEx(containingWindow(), -scrollDelta.width(), -scrollDelta.height(), 0, 0, 0, 0, SW_INVALIDATE);
else
- InvalidateRect(windowHandle(), 0, true);
+ InvalidateRect(containingWindow(), 0, true);
}
}
si.nMax = max;
si.nPage = pageSize;
si.nPos = current;
- SetScrollInfo(windowHandle(), type, &si, TRUE);
- GetScrollInfo(windowHandle(), type, &si);
+ SetScrollInfo(containingWindow(), type, &si, TRUE);
+ GetScrollInfo(containingWindow(), type, &si);
return si.nPos;
}
updateScrollInfo(SB_VERT, scroll.height(), contentsHeight() - 1, height()));
if (m_data->hScrollBarMode != ScrollBarAuto || m_data->suppressScrollBars)
- ShowScrollBar(windowHandle(), SB_HORZ, (m_data->hScrollBarMode != ScrollBarAlwaysOff) && !m_data->suppressScrollBars);
+ ShowScrollBar(containingWindow(), SB_HORZ, (m_data->hScrollBarMode != ScrollBarAlwaysOff) && !m_data->suppressScrollBars);
if (m_data->vScrollBarMode != ScrollBarAuto || m_data->suppressScrollBars)
- ShowScrollBar(windowHandle(), SB_VERT, (m_data->vScrollBarMode != ScrollBarAlwaysOff) && !m_data->suppressScrollBars);
+ ShowScrollBar(containingWindow(), SB_VERT, (m_data->vScrollBarMode != ScrollBarAlwaysOff) && !m_data->suppressScrollBars);
}
}
#include "config.h"
#include "SharedTimer.h"
+#include "Page.h"
#include "SystemTime.h"
#include "Widget.h"
#include <wtf/Assertions.h>
memset(&wcex, 0, sizeof(WNDCLASSEX));
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.lpfnWndProc = TimerWindowWndProc;
- wcex.hInstance = Widget::instanceHandle;
+ wcex.hInstance = Page::instanceHandle();
wcex.lpszClassName = kTimerWindowClassName;
RegisterClassEx(&wcex);
timerWindowHandle = CreateWindow(kTimerWindowClassName, 0, 0,
- CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, HWND_MESSAGE, 0, Widget::instanceHandle, 0);
+ CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, HWND_MESSAGE, 0, Page::instanceHandle(), 0);
timerFiredMessage = RegisterWindowMessage(L"com.apple.WebKit.TimerFired");
}
#include "PlatformScrollBar.h"
#include "ScrollBar.h"
#include "JavaAppletWidget.h"
+#include "Page.h"
#include "Path.h"
#include "PlatformMouseEvent.h"
#include "CookieJar.h"
} while (0)
void FrameView::updateBorder() { notImplemented(); }
-bool FrameView::isFrameView() const { notImplemented(); return 0; }
Widget::FocusPolicy PopUpButton::focusPolicy() const { notImplemented(); return NoFocus; }
void PopUpButton::populate() { notImplemented(); }
}
+HINSTANCE Page::s_instanceHandle = 0;
+
void Widget::setEnabled(bool) { }
void Widget::paint(GraphicsContext*,IntRect const&) { }
void Widget::setIsSelected(bool) { }
void ScrollView::removeChild(Widget*) { }
void ScrollView::scrollPointRecursively(int x, int y) { }
bool ScrollView::inWindow() const { return true; }
+void ScrollView::paint(GraphicsContext*, const IntRect&) { };
void ScrollView::wheelEvent(PlatformWheelEvent&) { }
void GraphicsContext::setShadow(IntSize const&,int,Color const&) { }
void GraphicsContext::setAlpha(float) { }
void GraphicsContext::setCompositeOperation(CompositeOperator) { }
void GraphicsContext::clip(const Path&) { }
-void GraphicsContext::translate(const FloatSize&) { }
void GraphicsContext::rotate(float) { }
void GraphicsContext::scale(const FloatSize&) { }
namespace WebCore {
-HINSTANCE Widget::instanceHandle = 0;
-
class WidgetPrivate
{
public:
- HWND windowHandle;
+ HWND containingWindow;
Font font;
WidgetClient* client;
};
Widget::Widget()
: data(new WidgetPrivate)
{
- data->windowHandle = 0;
+ data->containingWindow = 0;
data->client = 0;
}
-Widget::Widget(HWND hWnd)
- : data(new WidgetPrivate)
-{
- data->windowHandle = hWnd;
-}
-
Widget::~Widget()
{
delete data;
}
-HWND Widget::windowHandle() const
+HWND Widget::containingWindow() const
{
- return data->windowHandle;
+ return data->containingWindow;
}
-void Widget::setWindowHandle(HWND hWnd)
+void Widget::setContainingWindow(HWND hWnd)
{
- data->windowHandle = hWnd;
+ data->containingWindow = hWnd;
}
void Widget::setClient(WidgetClient* c)
IntRect Widget::frameGeometry() const
{
RECT frame;
- if (GetWindowRect(data->windowHandle, &frame)) {
- if (HWND parent = GetParent(data->windowHandle))
- MapWindowPoints(NULL, parent, (LPPOINT)&frame, 2);
+ if (GetWindowRect(data->containingWindow, &frame)) {
+ if (HWND containingWindow = GetParent(data->containingWindow))
+ MapWindowPoints(NULL, containingWindow, (LPPOINT)&frame, 2);
return frame;
}
bool Widget::hasFocus() const
{
- return (data->windowHandle == GetForegroundWindow());
+ return (data->containingWindow == GetForegroundWindow());
}
void Widget::setFocus()
{
- SetFocus(data->windowHandle);
+ SetFocus(data->containingWindow);
}
void Widget::clearFocus()
void Widget::show()
{
- ShowWindow(data->windowHandle, SW_SHOWNA);
+ ShowWindow(data->containingWindow, SW_SHOWNA);
}
void Widget::hide()
{
- ShowWindow(data->windowHandle, SW_HIDE);
+ ShowWindow(data->containingWindow, SW_HIDE);
}
void Widget::setFrameGeometry(const IntRect &rect)
{
- MoveWindow(data->windowHandle, rect.x(), rect.y(), rect.width(), rect.height(), false);
-}
-
-IntPoint Widget::mapFromGlobal(const IntPoint &p) const
-{
- POINT point = p;
- ScreenToClient(data->windowHandle, &point);
- return point;
+ MoveWindow(data->containingWindow, rect.x(), rect.y(), rect.width(), rect.height(), false);
}
}
if (FAILED(hr))
return hr;
- Page* page = new Page(windowHandle);
+ Page* page = new Page();
Frame* frame = new FrameWin(page, 0, this);
// FIXME: This is one-time initialization, but it gets the value of the setting from the
d->frameView = frameView;
frameView->deref(); // FrameViews are created with a refcount of 1. Release this ref, since we've assigned it to a RefPtr
d->frame->setView(frameView);
- d->frameView->setWindowHandle(windowHandle);
+ d->frameView->setContainingWindow(windowHandle);
return S_OK;
}