File tree Expand file tree Collapse file tree 5 files changed +35
-1
lines changed Expand file tree Collapse file tree 5 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ namespace nw.currentWindowInternal {
23
23
24
24
interface Functions {
25
25
static void close(optional boolean force);
26
+ static void setShadow(boolean shadow);
26
27
static void showDevToolsInternal(optional ShowDevToolsCallback callback);
27
28
static void closeDevTools();
28
29
static void setBadgeLabel(DOMString badge);
Original file line number Diff line number Diff line change @@ -621,6 +621,17 @@ bool NwCurrentWindowInternalGetTitleInternalFunction::RunNWSync(base::ListValue*
621
621
return true ;
622
622
}
623
623
624
+ bool NwCurrentWindowInternalSetShadowFunction::RunAsync () {
625
+ #if defined(OS_MACOSX)
626
+ EXTENSION_FUNCTION_VALIDATE (args_);
627
+ bool shadow;
628
+ EXTENSION_FUNCTION_VALIDATE (args_->GetBoolean (0 , &shadow));
629
+ AppWindow* window = getAppWindow (this );
630
+ SetShadowOnWindow (window->GetNativeWindow (), shadow);
631
+ #endif
632
+ return true ;
633
+ }
634
+
624
635
bool NwCurrentWindowInternalSetTitleInternalFunction::RunNWSync (base::ListValue* response, std::string* error) {
625
636
EXTENSION_FUNCTION_VALIDATE (args_);
626
637
std::string title;
Original file line number Diff line number Diff line change @@ -120,6 +120,19 @@ class NwCurrentWindowInternalSetMenuFunction : public NWSyncExtensionFunction {
120
120
DISALLOW_COPY_AND_ASSIGN (NwCurrentWindowInternalSetMenuFunction);
121
121
};
122
122
123
+ class NwCurrentWindowInternalSetShadowFunction : public AsyncExtensionFunction {
124
+ public:
125
+ NwCurrentWindowInternalSetShadowFunction (){}
126
+
127
+ protected:
128
+ ~NwCurrentWindowInternalSetShadowFunction () override {}
129
+ void SetShadowOnWindow (NSWindow *window, bool shadow);
130
+
131
+ // ExtensionFunction:
132
+ bool RunAsync () override ;
133
+ DECLARE_EXTENSION_FUNCTION (" nw.currentWindowInternal.setShadow" , UNKNOWN)
134
+ };
135
+
123
136
class NwCurrentWindowInternalSetBadgeLabelFunction : public AsyncExtensionFunction {
124
137
public:
125
138
NwCurrentWindowInternalSetBadgeLabelFunction (){}
Original file line number Diff line number Diff line change 8
8
#import < Appkit/NSDocktile.h>
9
9
#import < Appkit/NSImageView.h>
10
10
#import < Appkit/NSProgressIndicator.h>
11
+ #import < Appkit/NSWindow.h>
11
12
12
13
@interface NWProgressBar : NSProgressIndicator
13
14
@end
@@ -44,7 +45,11 @@ - (void)drawRect:(NSRect)dirtyRect {
44
45
@end
45
46
46
47
namespace extensions {
47
-
48
+
49
+ void NwCurrentWindowInternalSetShadowFunction::SetShadowOnWindow (NSWindow *window, bool shadow) {
50
+ window.hasShadow = shadow;
51
+ }
52
+
48
53
bool NwCurrentWindowInternalSetBadgeLabelFunction::RunAsync () {
49
54
EXTENSION_FUNCTION_VALIDATE (args_);
50
55
std::string badge;
Original file line number Diff line number Diff line change @@ -379,6 +379,10 @@ nw_binding.registerCustomHook(function(bindingsAPI) {
379
379
return this ;
380
380
} ;
381
381
382
+ NWWindow . prototype . setShadow = function ( shadow ) {
383
+ currentNWWindowInternal . setShadow ( shadow ) ;
384
+ }
385
+
382
386
NWWindow . prototype . showDevTools = function ( frm , callback ) {
383
387
var id = '' ;
384
388
if ( typeof frm === 'string' )
You can’t perform that action at this time.
0 commit comments