blob: 1cf73503fa71721c611f2bd3df75ca2ee501b95e [file] [log] [blame]
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BrowserWindow_h
#define BrowserWindow_h
#include "BrowserView.h"
#include <string>
class BrowserWindow {
public:
static BrowserWindow* create()
{
return new BrowserWindow;
}
void createWindow(int x, int y, int width, int height);
void showWindow();
void goToURL(const std::wstring& url);
bool handleMessage(const MSG*);
const BrowserView& view() const { return m_browserView; }
HWND window() const { return m_window; }
private:
BrowserWindow();
static LRESULT CALLBACK BrowserWindowWndProc(HWND, UINT, WPARAM, LPARAM);
// Message handlers.
LRESULT wndProc(HWND, UINT, WPARAM, LPARAM);
void onCreate(LPCREATESTRUCT);
void onDestroy();
void onNCDestroy();
void onSize(int width, int height);
LRESULT onCommand(int commandID, bool& handled);
HWND m_window;
HWND m_rebarWindow;
HWND m_comboBoxWindow;
BrowserView m_browserView;
};
#endif // BrowserWindow_h