cocoawebview 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17ab44091cb53d27e1f18d689ffbcac46b653c94ad06e96335dc85b1fc82238c
4
- data.tar.gz: ec4604b5e8a24b9839c7ff8ee5213d2869b64043f0f2c9e4beafc57ee9324e97
3
+ metadata.gz: 1eaad92103199618abce2cb57159fe668e574ec4027c6f3b5f5a1d509630bc42
4
+ data.tar.gz: 95871ddbcef856aae806203c7b30eb42b23a7ff7769e88e0e1a297bda6df3a17
5
5
  SHA512:
6
- metadata.gz: 8b59a45780e4c7c93ad20e5ee3aaa191dd3991d4a887207cf052491e7e1748f6de17e771bcc0902b0d8cdb30ca681c76c4a72add3b31035e8aa35054602323cf
7
- data.tar.gz: 5add581b2a0cf749a41d66bd6eee0502b82fcf17b5b62fe87cefcdd9f933a07de48d9e9ec9ab17ba9a2df4eb5d0aa9f56aa99e31ccceed94e6bf1a45053b90c9
6
+ metadata.gz: efc2abd762985a17d26b50021e98cd4ee78d5db1d2080794376f09331643e0119cb901f7937bd581a9eae586428b77c70b23b3f61a018ec199c6cd8d56114c48
7
+ data.tar.gz: a77f8969e8b8f647487485cdf3b2098fff4e5f0cfe26b6f16da03776b5d5576990ee3b3b2755bd3f2db5ddc838d66b2ce89076151a0fd66f992db4863e4b042f
@@ -11,7 +11,7 @@ VALUE nsapp_initialize(VALUE self);
11
11
  VALUE nsapp_run(VALUE self);
12
12
  VALUE nsapp_exit(VALUE self);
13
13
 
14
- VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_buttons, VALUE delta_y);
14
+ VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_buttons, VALUE delta_y, VALUE hide_title_bar);
15
15
  VALUE webview_navigate(VALUE self, VALUE url);
16
16
  VALUE webview_show(VALUE self);
17
17
  VALUE webview_hide(VALUE self);
@@ -132,7 +132,7 @@ VALUE webview_increase_normal_level(VALUE self, VALUE delta);
132
132
  - (void)setShouldMoveTitleButtons:(BOOL)flag;
133
133
  - (void)setDevTool:(BOOL)flag;
134
134
  - (void)setDeltaY:(int)dy;
135
- - (id)initWithFrame:(NSRect)frame debug:(BOOL)flag style:(int)style moveTitleButtons:(BOOL)moveTitleButtons deltaY:(int)dy;
135
+ - (id)initWithFrame:(NSRect)frame debug:(BOOL)flag style:(int)style moveTitleButtons:(BOOL)moveTitleButtons deltaY:(int)dy hideTitleBar:(BOOL)hideTitleBar;
136
136
  - (void)eval:(NSString*)code;
137
137
  - (void)navigate:(NSString*)url;
138
138
  - (void)setCocoaWebview:(VALUE)view;
@@ -140,7 +140,7 @@ VALUE webview_increase_normal_level(VALUE self, VALUE delta);
140
140
  @end
141
141
 
142
142
  @implementation CocoaWebview
143
- - (id)initWithFrame:(NSRect)frame debug:(BOOL)flag style:(int)style moveTitleButtons:(BOOL)moveTitleButtons deltaY:(int)dy {
143
+ - (id)initWithFrame:(NSRect)frame debug:(BOOL)flag style:(int)style moveTitleButtons:(BOOL)moveTitleButtons deltaY:(int)dy hideTitleBar:(BOOL)hideTitleBar{
144
144
  self = [super initWithContentRect:frame
145
145
  styleMask:style
146
146
  backing:NSBackingStoreBuffered
@@ -150,8 +150,12 @@ VALUE webview_increase_normal_level(VALUE self, VALUE delta);
150
150
  [self setTitle:@"My Custom Window"];
151
151
  [self setDevTool:flag];
152
152
  [self setDeltaY:dy];
153
- [self setTitlebarAppearsTransparent: YES];
154
- [self setTitleVisibility:NSWindowTitleHidden];
153
+ if (hideTitleBar) {
154
+ [self setTitlebarAppearsTransparent: YES];
155
+ [self setTitleVisibility:NSWindowTitleHidden];
156
+ } else {
157
+ [self setTitlebarAppearsTransparent: NO];
158
+ }
155
159
  [self addWebViewToWindow:self];
156
160
  [self setShouldMoveTitleButtons:moveTitleButtons];
157
161
  if (moveTitleButtons) {
@@ -316,7 +320,7 @@ Init_cocoawebview(void)
316
320
 
317
321
  /* CocoaWebview */
318
322
  rb_mCocoaWebviewClass = rb_define_class_under(rb_mCocoawebview, "CocoaWebview", rb_cObject);
319
- rb_define_method(rb_mCocoaWebviewClass, "initialize", webview_initialize, 4);
323
+ rb_define_method(rb_mCocoaWebviewClass, "initialize", webview_initialize, 5);
320
324
  rb_define_method(rb_mCocoaWebviewClass, "show", webview_show, 0);
321
325
  rb_define_method(rb_mCocoaWebviewClass, "hide", webview_hide, 0);
322
326
  rb_define_method(rb_mCocoaWebviewClass, "eval", webview_eval, 1);
@@ -351,7 +355,7 @@ VALUE nsapp_exit(VALUE self) {
351
355
  [[NSApplication sharedApplication] terminate:nil];
352
356
  }
353
357
 
354
- VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_buttons, VALUE delta_y) {
358
+ VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_buttons, VALUE delta_y, VALUE hide_title_bar) {
355
359
  rb_iv_set(self, "@var", rb_hash_new());
356
360
  rb_iv_set(self, "@bindings", rb_hash_new());
357
361
  BOOL flag = NO;
@@ -367,9 +371,15 @@ VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_
367
371
  } else {
368
372
  c_move_title_buttons = NO;
369
373
  }
374
+ BOOL c_hide_title_bar = NO;
375
+ if (hide_title_bar == Qtrue) {
376
+ c_hide_title_bar = YES;
377
+ } else {
378
+ c_hide_title_bar = NO;
379
+ }
370
380
  int c_style = NUM2INT(style);
371
381
  int c_delta_y = NUM2INT(delta_y);
372
- CocoaWebview *webview = [[CocoaWebview alloc] initWithFrame:NSMakeRect(100, 100, 400, 500) debug:flag style:c_style moveTitleButtons:c_move_title_buttons deltaY:c_delta_y];
382
+ CocoaWebview *webview = [[CocoaWebview alloc] initWithFrame:NSMakeRect(100, 100, 400, 500) debug:flag style:c_style moveTitleButtons:c_move_title_buttons deltaY:c_delta_y hideTitleBar:c_hide_title_bar];
373
383
 
374
384
  [webview setReleasedWhenClosed:NO];
375
385
  [webview setCocoaWebview:self];
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cocoawebview
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7.0"
5
5
  end
data/lib/cocoawebview.rb CHANGED
@@ -32,16 +32,18 @@ module CocoaWebview
32
32
  class CocoaWebview
33
33
  attr_accessor :callback
34
34
 
35
- def self.create(debug: false, min: true, resize: true, close: true, move_title_buttons: false, delta_y: 10, &block)
35
+ def self.create(debug: false, min: true, resize: true, close: true, move_title_buttons: false, delta_y: 10, hide_title_bar: true, &block)
36
36
  style = NSWindowStyleMaskTitled | NSWindowStyleMaskFullSizeContentView
37
37
 
38
38
  style = style | NSWindowStyleMaskMiniaturizable if min
39
39
  style = style | NSWindowStyleMaskResizable if resize
40
40
  style = style | NSWindowStyleMaskClosable if close
41
41
 
42
- style &= ~NSWindowStyleMaskFullScreen
42
+ if hide_title_bar
43
+ style &= ~NSWindowStyleMaskFullScreen
44
+ end
43
45
 
44
- webview = new(debug, style, move_title_buttons, delta_y)
46
+ webview = new(debug, style, move_title_buttons, delta_y, hide_title_bar)
45
47
  webview.callback = block
46
48
  webview
47
49
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoawebview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommy Jeff