Skip to content

Commit cd519a5

Browse files
committed
initial commit
0 parents  commit cd519a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3175
-0
lines changed

.clang-format

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
BasedOnStyle: Mozilla
3+
ColumnLimit: 120
4+
AlignAfterOpenBracket: Align
5+
BinPackArguments: false
6+
SortIncludes: false
7+
FixNamespaceComments: true # add commend at end:
8+
NamespaceIndentation: None #intend content of namespace

.editorconfig

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
2+
3+
# All files
4+
[*.{c,cpp,cxx,h,hpp,hxx}]
5+
indent_style = space
6+
charset = utf-8-bom
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.build.mac
2+
.DS_Store
3+
output
4+
build
5+
.build.mac
6+
/cmake-build-debug/

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "CefViewCore"]
2+
path = CefViewCore
3+
url = https://github.com/CefView/CefViewCore.git

CMakeLists.txt

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#
2+
# The main config file for CocoaCef
3+
#
4+
cmake_minimum_required(VERSION 3.19)
5+
project(CocoaCefView)
6+
7+
# Only generate Debug and Release configuration types.
8+
set(CMAKE_CONFIGURATION_TYPES Debug Release)
9+
10+
# Set proejct architecture
11+
if ((NOT DEFINED TARGET_ARCH) OR (TARGET_ARCH STREQUAL "") OR (NOT ${TARGET_ARCH} MATCHES "(x86_64|arm64)"))
12+
message(FATAL_ERROR "++++++++++ INVALID FLAG TARGET_ARCH=" ${TARGET_ARCH} ", valid values:x86_64|arm64")
13+
endif()
14+
set(PROJECT_ARCH ${TARGET_ARCH})
15+
16+
# Use folders in the resulting project files.
17+
set_property(GLOBAL PROPERTY OS_FOLDERS ON)
18+
19+
# C standard
20+
set(CMAKE_C_STANDARD_REQUIRED ON)
21+
set(CMAKE_C_STANDARD 11)
22+
23+
# C++ standard
24+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
25+
set(CMAKE_CXX_STANDARD 11)
26+
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11)
27+
28+
# Config the CEF
29+
###############################################################
30+
# Disable the sandbox
31+
if ((NOT DEFINED USE_SANDBOX) OR (USE_SANDBOX STREQUAL "")
32+
OR (${USE_SANDBOX} MATCHES "(FALSE|false|0|OFF)"))
33+
option(USE_SANDBOX "Enable CEF Sandbox" OFF)
34+
elseif(${USE_SANDBOX} MATCHES "(TRUE|true|1|null|ON)")
35+
option(USE_SANDBOX "Enable CEF Sandbox" ON)
36+
add_definitions(-DCEF_USE_SANDBOX)
37+
else()
38+
message(FATAL_ERROR "++++++++++ INVALID FLAG USE_SANDBOX=" ${USE_SANDBOX}, ", valid values:FALSE|false|0|OFF|TRUE|true|1|null|ON")
39+
endif()
40+
###############################################################
41+
42+
set(CMAKE_SUPPRESS_REGENERATION TRUE)
43+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/$<CONFIG>/bin)
44+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/$<CONFIG>/bin)
45+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/$<CONFIG>/lib)
46+
47+
48+
# Include CefViewCore
49+
add_subdirectory(CefViewCore)
50+
51+
# Config CocoaCefView target
52+
###############################################################
53+
add_subdirectory(src)
54+
55+
# Config the Demo project
56+
###############################################################
57+
if ((NOT DEFINED BUILD_DEMO) OR (BUILD_DEMO STREQUAL "")
58+
OR (${BUILD_DEMO} MATCHES "(FALSE|false|0|OFF)"))
59+
option(BUILD_DEMO "Build the demo" OFF)
60+
elseif(${BUILD_DEMO} MATCHES "(TRUE|true|1|null|ON)")
61+
option(BUILD_DEMO "Build the demo" ON)
62+
else()
63+
message(FATAL_ERROR "++++++++++ INVALID FLAG BUILD_DEMO=" ${BUILD_DEMO})
64+
endif()
65+
if (BUILD_DEMO)
66+
add_subdirectory(demo/CocoaCefViewDemo)
67+
endif()
68+
###############################################################

CefViewCore

Submodule CefViewCore added at 7f0f2cb

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 CefView
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# CocoaCefView
2+
3+
CocoaCefView provides a NSView based and CEF backed webview UI element for the consumers.
4+
5+
6+
## Build status
7+
| triplets | status |
8+
|---|---|
9+
| macOS-x64 | [![Build status](https://ci.appveyor.com/api/projects/status/dfs8896yuqxw2asx?svg=true)](https://ci.appveyor.com/project/tishion/cocoacefview) |

demo/CocoaCefViewDemo/AppDelegate.h

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//
2+
// AppDelegate.h
3+
// CocoaCefDemo
4+
//
5+
// Created by Sheen Tian on 2020/6/15.
6+
//
7+
8+
#import <Cocoa/Cocoa.h>
9+
10+
@interface AppDelegate : NSObject<NSApplicationDelegate>
11+
12+
@end

demo/CocoaCefViewDemo/AppDelegate.m

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// AppDelegate.m
3+
// CocoaCefDemo
4+
//
5+
// Created by Sheen Tian on 2020/6/15.
6+
//
7+
8+
#import "AppDelegate.h"
9+
10+
#import "CefDemoView.h"
11+
12+
@interface AppDelegate ()
13+
14+
@property(weak) IBOutlet CefDemoView *cefDemoView;
15+
@property(weak) IBOutlet NSWindow *window;
16+
@end
17+
18+
@implementation AppDelegate
19+
20+
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
21+
// Insert code here to initialize your application
22+
NSLog(@"applicationDidFinishLaunching");
23+
}
24+
25+
- (void)applicationWillTerminate:(NSNotification *)aNotification {
26+
// Insert code here to tear down your application
27+
NSLog(@"applicationWillTerminate");
28+
}
29+
30+
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender {
31+
NSLog(@"applicationShouldTerminateAfterLastWindowClosed");
32+
return YES;
33+
}
34+
35+
-(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
36+
NSLog(@"applicationShouldTerminate");
37+
return NSTerminateNow;
38+
}
39+
40+
- (IBAction)onChangeBGColorBtnClicked:(id)sender {
41+
[_cefDemoView changeBackgroundColor];
42+
}
43+
44+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"images": [
3+
{
4+
"idiom": "mac",
5+
"scale": "1x",
6+
"size": "16x16"
7+
},
8+
{
9+
"idiom": "mac",
10+
"scale": "2x",
11+
"size": "16x16"
12+
},
13+
{
14+
"idiom": "mac",
15+
"scale": "1x",
16+
"size": "32x32"
17+
},
18+
{
19+
"idiom": "mac",
20+
"scale": "2x",
21+
"size": "32x32"
22+
},
23+
{
24+
"idiom": "mac",
25+
"scale": "1x",
26+
"size": "128x128"
27+
},
28+
{
29+
"idiom": "mac",
30+
"scale": "2x",
31+
"size": "128x128"
32+
},
33+
{
34+
"idiom": "mac",
35+
"scale": "1x",
36+
"size": "256x256"
37+
},
38+
{
39+
"idiom": "mac",
40+
"scale": "2x",
41+
"size": "256x256"
42+
},
43+
{
44+
"idiom": "mac",
45+
"scale": "1x",
46+
"size": "512x512"
47+
},
48+
{
49+
"idiom": "mac",
50+
"scale": "2x",
51+
"size": "512x512"
52+
}
53+
],
54+
"info": {
55+
"author": "xcode",
56+
"version": 1
57+
}
58+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info": {
3+
"author": "xcode",
4+
"version": 1
5+
}
6+
}

0 commit comments

Comments
 (0)