Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Initial commit
  • Loading branch information
sjlamerton committed Jan 16, 2013
0 parents commit 207e5b9
Show file tree
Hide file tree
Showing 9 changed files with 1,155 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
# Build folder
build/
29 changes: 29 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,29 @@
# Author: Steven Lamerton
# Copyright: (c) 2013 Steven Lamerton
# Licence: wxWindows licence

# Required to find the webview library
cmake_minimum_required(VERSION 2.8.8)

project(wxwebviewchromium)

# Set the module path so we can find FindCEF
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})

# Find CEF
find_package(CEF)
include_directories(${CEF_INCLUDE_DIR})

if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()

# Find wxWidgets
find_package(wxWidgets COMPONENTS webview core base REQUIRED)
include(${wxWidgets_USE_FILE})

# Addwxwebviewchromium to a simple library so we can use it in all samples
add_library(wvc STATIC webview_chromium.cpp webview_chromium.h)


add_subdirectory(sample)
40 changes: 40 additions & 0 deletions FindCEF.cmake
@@ -0,0 +1,40 @@
# Author: Steven Lamerton
# Copyright: (c) 2013 Steven Lamerton
# Licence: wxWindows licence

# Find module for the Chromium Embedded Framework

include(SelectLibraryConfigurations)
include(FindPackageHandleStandardArgs)

set(CEF_ROOT_DIR "" CACHE PATH "CEF root directory")

find_path(CEF_INCLUDE_DIR "include/cef_version.h"
HINTS ${CEF_ROOT_DIR})

# On Windows find the dll_wrapper
if(WIN32)
find_library(CEF_WRAPPER_LIBRARY_RELEASE NAMES libcef_dll_wrapper
HINTS "${CEF_ROOT_DIR}/lib"
PATH_SUFFIXES "Release")
find_library(CEF_WRAPPER_LIBRARY_DEBUG NAMES libcef_dll_wrapper
HINTS "${CEF_ROOT_DIR}/lib"
PATH_SUFFIXES "Debug")
select_library_configurations(CEF_WRAPPER)
endif()

# Find the library itself
find_library(CEF_LIBRARY_RELEASE NAMES libcef
HINTS "${CEF_ROOT_DIR}/lib"
PATH_SUFFIXES "Release")
find_library(CEF_LIBRARY_DEBUG NAMES libcef
HINTS "${CEF_ROOT_DIR}/lib"
PATH_SUFFIXES "Debug")
select_library_configurations(CEF)

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(CEF DEFAULT_MSG
CEF_INCLUDE_DIR)

mark_as_advanced(CEF_INCLUDE_DIR)
53 changes: 53 additions & 0 deletions LICENSE
@@ -0,0 +1,53 @@
wxWindows Library Licence, Version 3.1
======================================

Copyright (C) 1998-2005 Julian Smart, Robert Roebling et al

Everyone is permitted to copy and distribute verbatim copies
of this licence document, but changing it is not allowed.

WXWINDOWS LIBRARY LICENCE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public Licence as published by
the Free Software Foundation; either version 2 of the Licence, or (at
your option) any later version.

This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
General Public Licence for more details.

You should have received a copy of the GNU Library General Public Licence
along with this software, usually in a file named COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA.

EXCEPTION NOTICE

1. As a special exception, the copyright holders of this library give
permission for additional uses of the text contained in this release of
the library as licenced under the wxWindows Library Licence, applying
either version 3.1 of the Licence, or (at your option) any later version of
the Licence as published by the copyright holders of version
3.1 of the Licence document.

2. The exception is that you may use, copy, link, modify and distribute
under your own terms, binary object code versions of works based
on the Library.

3. If you copy code from files distributed under the terms of the GNU
General Public Licence or the GNU Library General Public Licence into a
copy of this library, as this licence permits, the exception does not
apply to the code that you add in this way. To avoid misleading anyone as
to the status of such modified files, you must delete this exception
notice from such code and/or adjust the licensing conditions notice
accordingly.

4. If you write modifications of your own for this library, it is your
choice whether to permit this exception to apply to your modifications.
If you do not wish that, you must delete the exception notice from such
code and/or adjust the licensing conditions notice accordingly.


9 changes: 9 additions & 0 deletions sample/CMakeLists.txt
@@ -0,0 +1,9 @@
# Author: Steven Lamerton
# Copyright: (c) 2013 Steven Lamerton
# Licence: wxWindows licence

# Set up the exe
add_executable(simple WIN32 simple.cpp simple.h)
target_link_libraries(simple wvc ${wxWidgets_LIBRARIES}
debug ${CEF_LIBRARY_DEBUG} debug ${CEF_WRAPPER_LIBRARY_DEBUG}
optimized ${CEF_LIBRARY_RELEASE} optimized ${CEF_WRAPPER_LIBRARY_RELEASE})
29 changes: 29 additions & 0 deletions sample/simple.cpp
@@ -0,0 +1,29 @@
/////////////////////////////////////////////////////////////////////////////
// Author: Steven Lamerton
// Copyright: (c) 2013 Steven Lamerton
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////

#include <wx/menu.h>
#include <wx/msgdlg.h>
#include <wx/sharedptr.h>
#include <wx/webview.h>

#include "simple.h"
#include "../webview_chromium.h"

bool SimpleApp::OnInit()
{
SimpleFrame *frame = new SimpleFrame();
frame->Show(true);

return true;
}

SimpleFrame::SimpleFrame() : wxFrame(NULL, wxID_ANY, "wxWebViewChromium")
{
wxWebView::RegisterFactory(wxWebViewBackendChromium, wxSharedPtr<wxWebViewFactory>
(new wxWebViewFactoryChromium));
wxWebView* webview = wxWebView::New(this, wxID_ANY, "http://www.whatismybrowser.com/",
wxDefaultPosition, wxDefaultSize, wxWebViewBackendChromium);
}
21 changes: 21 additions & 0 deletions sample/simple.h
@@ -0,0 +1,21 @@
#ifndef _SIMPLE_H_
#define _SIMPLE_H_

#include <wx/app.h>
#include <wx/frame.h>

class SimpleApp : public wxApp
{
public:
virtual bool OnInit();
};

class SimpleFrame : public wxFrame
{
public:
SimpleFrame();
};

IMPLEMENT_APP(SimpleApp)

#endif

0 comments on commit 207e5b9

Please sign in to comment.