Skip to content

Commit 90fee27

Browse files
committed
Merge pull request livecode#2769 from livecodeian/feature-browser_widget_callbacks
[[ BrowserWidget ]] Implementation of a web browser as a widget
2 parents 9f00bfc + f24a439 commit 90fee27

File tree

90 files changed

+13556
-237
lines changed

Some content is hidden

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

90 files changed

+13556
-237
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Name: do in widget
2+
3+
Type: command
4+
5+
Syntax: do <script> in <widget>
6+
7+
Summary: Executes a list of statements within a widget.
8+
9+
Introduced: 8.0
10+
11+
OS: mac,windows,linux,ios,android
12+
13+
Platforms: desktop,mobile
14+
15+
Example:
16+
// Use JavaScript to hide "myButton" in the page displayed in a browser widget.
17+
do "document.getElementById('myButton').hidden = 'hidden'" in widget "myBrowser"
18+
19+
Parameters:
20+
script (string): The code to execute within the widget.
21+
widget: A widget reference
22+
23+
Description:
24+
Use the <do in widget> command to execute statements in a widget. LiveCode sends a "OnDo" message with <script> as parameter to the widget, which can then handle that messages to run the code appropriately.
25+
26+
References: do (command), widget (object)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Name: go in widget
2+
3+
Type: command
4+
5+
Syntax: go { forward | forth | back[ward] } in <widget>
6+
7+
Summary: Navigates forward or backward in a widget.
8+
9+
Introduced: 8.0
10+
11+
OS: mac,windows,linux,ios,android
12+
13+
Platforms: desktop,mobile
14+
15+
Example:
16+
// Navigate to previous page in browser widget.
17+
go back in widget "myBrowser"
18+
19+
Example:
20+
// Return after previous call to "go back"
21+
go forward in widget "myBrowser"
22+
23+
Parameters:
24+
widget: A widget reference.
25+
26+
Description:
27+
Use the <go in widget> command to navigate within a widget. LiveCode sends a "OnGoBack" or "OnGoForward" message to the widget, which can then handle those messages to provide back / forward navigation.
28+
29+
References: widget (object)
30+
31+
Tags: navigation, widget
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Name: launch url in widget
2+
3+
Type: command
4+
5+
Syntax: launch url <url> in <widget>
6+
7+
Summary: Launches a url in a widget.
8+
9+
Introduced: 8.0
10+
11+
OS: mac,windows,linux,ios,android
12+
13+
Platforms: desktop,mobile
14+
15+
Example:
16+
launch url "http://www.livecode.com" in widget "myWebBrowser"
17+
18+
Parameters:
19+
url (string): The URL to launch. The supported url types will vary depending on the capabilities of the widget.
20+
widget: A widget reference.
21+
22+
Description:
23+
Use the <launch url> command to open a url within a widget. When <launch url in widget> is called, LiveCode sends a "OnLaunchURL" message to that widget with <url> as the parameter. The widget can then display the url in an appropriate manner.
24+
25+
References: launch url (command), launch document (command), URL (keyword), widget (object)
26+
27+
Tags: widget
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# New Browser Widget
2+
3+
This feature introduces a new embeddable browser implemented as a widget, making it much easier to use than the old revbrowser external.
4+
5+
To add a browser to your application, simply drag and drop the browser widget onto your stack and set the properties you need.
6+
7+
## Properties
8+
9+
* *browserUrl* - The URL of the page displayed in the browser.
10+
* *browserHtmltext* - The HTML source of the content displayed in the browser
11+
* *browserScrollbars* - Whether or not the browser displays scrollbars
12+
* *browserUserAgent* - The identifier sent by the browser when fetching web content.
13+
* *browserJavascriptHandlers* - A list of object script handlers that can be called by javascript code in the page loaded in the browser.
14+
15+
## Messages
16+
17+
* *browserDocumentLoadBegin pUrl* - sent when a new document has completed loading in the browser.
18+
* *browserDocumentLoadComplete pUrl* - sent when a new document has completed loading in the browser.
19+
* *browserDocumentLoadFailed pUrl, pError* - sent when a new document has failed to load in the browser.
20+
* *browserFrameDocumentLoadBegin pUrl* - sent when a new document has completed loading in a frame of the browser.
21+
* *browserFrameDocumentLoadComplete pUrl* - sent when a new document has completed loading in a frame of the browser.
22+
* *browserFrameDocumentLoadFailed pUrl, pError* - sent when a new document has failed to load in a frame of the browser.
23+
* *browserNavigateBegin pUrl* - sent when the browser begins navigation to a new page.
24+
* *browserNavigateComplete pUrl* - sent when the browser successfully navigates to a new page.
25+
* *browserNavigateFailed pUrl, pError* - sent when the browser has failed to navigate to a new page.

engine/engine-sources.gypi

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@
344344
'src/exec-interface-scrollbar.cpp',
345345
'src/exec-interface-stack.cpp',
346346
'src/exec-interface-vclip.cpp',
347+
'src/exec-interface-widget.cpp',
347348
'src/exec-keywords.cpp',
348349
'src/exec-legacy.cpp',
349350
'src/exec-logic.cpp',
@@ -566,17 +567,7 @@
566567

567568
# Native layers
568569
'src/native-layer.h',
569-
'src/native-layer-android.h',
570-
'src/native-layer-ios.h',
571-
'src/native-layer-mac.h',
572-
'src/native-layer-win32.h',
573-
'src/native-layer-x11.h',
574570
'src/native-layer.cpp',
575-
'src/native-layer-android.cpp',
576-
'src/native-layer-ios.mm',
577-
'src/native-layer-mac.mm',
578-
'src/native-layer-win32.cpp',
579-
'src/native-layer-x11.cpp',
580571
],
581572

582573
# Sources that are only for desktop mode
@@ -605,6 +596,20 @@
605596
'src/platform-surface.cpp',
606597
'src/platform-window.cpp',
607598

599+
# Group "Native Layer"
600+
'src/native-layer.cpp',
601+
'src/native-layer.h',
602+
'src/native-layer-android.cpp',
603+
'src/native-layer-android.h',
604+
'src/native-layer-ios.h',
605+
'src/native-layer-ios.mm',
606+
'src/native-layer-mac.h',
607+
'src/native-layer-mac.mm',
608+
'src/native-layer-win32.cpp',
609+
'src/native-layer-win32.h',
610+
'src/native-layer-x11.cpp',
611+
'src/native-layer-x11.h',
612+
608613
# Group "Desktop - Linux"
609614
'src/lnxans.h',
610615
'src/lnxaudio.h',
@@ -842,6 +847,7 @@
842847
'src/srvtheme.cpp',
843848
'src/srvspec.cpp',
844849
'src/srvstack.cpp',
850+
'src/native-layer-srv.cpp',
845851
],
846852

847853
# Java sources for Android
@@ -895,6 +901,8 @@
895901
'src/java/com/runrev/android/nativecontrol/NativeControlModule.java',
896902
'src/java/com/runrev/android/nativecontrol/ScrollerControl.java',
897903
'src/java/com/runrev/android/nativecontrol/VideoControl.java',
904+
905+
'src/java/com/runrev/android/libraries/LibBrowser.java',
898906
],
899907

900908
# AIDL sources for Android
@@ -933,6 +941,8 @@
933941
'src/module-canvas.cpp',
934942
'src/module-engine.cpp',
935943
'src/module-resources.cpp',
944+
945+
'src/module-browser.cpp',
936946
],
937947

938948
# Engine LCB files containing syntax
@@ -946,7 +956,7 @@
946956
# Other engine LCB files
947957
'engine_other_lcb_files':
948958
[
949-
959+
'src/browser.lcb',
950960
],
951961
},
952962

@@ -987,6 +997,7 @@
987997
[
988998
'src/dskmac.cpp',
989999
'src/srvmac.cpp',
1000+
'src/native-layer-mac.mm',
9901001
],
9911002
},
9921003
],
@@ -1000,6 +1011,11 @@
10001011
['exclude', '(^|/)linux-'],
10011012
['exclude', '-x11\.cpp$'],
10021013
],
1014+
1015+
'sources!':
1016+
[
1017+
'src/native-layer-x11.cpp',
1018+
],
10031019
},
10041020
],
10051021
[
@@ -1016,6 +1032,7 @@
10161032
'sources!':
10171033
[
10181034
'src/srvwindows.cpp',
1035+
'src/native-layer-win32.cpp',
10191036
],
10201037
},
10211038
],
@@ -1035,6 +1052,11 @@
10351052
[
10361053
['exclude', '-android\.cpp$'],
10371054
],
1055+
1056+
'sources!':
1057+
[
1058+
'src/native-layer-android.cpp',
1059+
],
10381060
},
10391061
],
10401062
[
@@ -1044,6 +1066,11 @@
10441066
[
10451067
['exclude', '-ios\.(mm|cpp)$'],
10461068
],
1069+
1070+
'sources!':
1071+
[
1072+
'src/native-layer-ios.mm',
1073+
],
10471074
},
10481075
],
10491076
[

engine/kernel-mode-template.gypi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
'../libfoundation/libfoundation.gyp:libFoundation',
77
'../libgraphics/libgraphics.gyp:libGraphics',
88
'../libscript/libscript.gyp:libScript',
9+
10+
'../libbrowser/libbrowser.gyp:libbrowser',
911
],
1012

1113
'conditions':

engine/kernel.gypi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
'../libgraphics/libgraphics.gyp:libGraphics',
1313
'../libscript/libscript.gyp:libScript',
1414

15+
'../libbrowser/libbrowser.gyp:libbrowser',
16+
1517
'../thirdparty/libgif/libgif.gyp:libgif',
1618
'../thirdparty/libjpeg/libjpeg.gyp:libjpeg',
1719
'../thirdparty/libopenssl/libopenssl.gyp:libopenssl',

0 commit comments

Comments
 (0)