cocoawebview 0.3.14 → 0.3.15

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: db706b907aeae6b70140c4e44872ec376e19057817682475910eae632089fb88
4
- data.tar.gz: c8218931d32c079654dc6b3d6d82cd52b1fcb2532e171b6a7071006136082711
3
+ metadata.gz: a1ec109cf8255bd277ee378cfc3785086c5fb0706cfacb296dda79105e366731
4
+ data.tar.gz: 2f8e836e3658226d6368b897f13c6f7b875ea5151c3a754b48f1b1bd80690e50
5
5
  SHA512:
6
- metadata.gz: 826ace46cd74de6216fac45f63565c6e38ccd8df1374859d7027710c446fdb8141533316bab880ef28eefd88f9cb87863f9422b4163465b98e37748a00064840
7
- data.tar.gz: 368a5884b508fb1f74812c7ca7aa345f450be2a91935e694f0c5a88ade3c861465af0e61013dd01d685353238f952286ad2316f3d85528a56f501c025b81dab8
6
+ metadata.gz: 19b3abe6843ac1ec662d6390ad8efb261fbf73f809a3505646bdd3d2321e57ce0546a7a5c4275a65fcfcb0b9ca11a568e03a774815398e4bd5311b156a90ef7a
7
+ data.tar.gz: f10d376ef47bb04c5a1b7a8b6c4247d9d9a787ab7166da7c9da080e3f9ba2bb1e1c2aa51918b822a5e6e014abffb56894cdd136998e8e13a6a505c55c00c12e3
@@ -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);
14
+ VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_buttons, VALUE delta_y);
15
15
  VALUE webview_show(VALUE self);
16
16
  VALUE webview_hide(VALUE self);
17
17
  VALUE webview_eval(VALUE self, VALUE code);
@@ -120,17 +120,19 @@ VALUE webview_set_bg(VALUE self, VALUE r, VALUE g, VALUE b, VALUE a);
120
120
  BOOL showDevTool;
121
121
  BOOL shouldMoveTitleButtons;
122
122
  FileDropContainerView *fileDropView;
123
+ int deltaY;
123
124
  }
124
125
  - (void)setShouldMoveTitleButtons:(BOOL)flag;
125
126
  - (void)setDevTool:(BOOL)flag;
126
- - (id)initWithFrame:(NSRect)frame debug:(BOOL)flag style:(int)style moveTitleButtons:(BOOL)moveTitleButtons;
127
+ - (void)setDeltaY:(int)dy;
128
+ - (id)initWithFrame:(NSRect)frame debug:(BOOL)flag style:(int)style moveTitleButtons:(BOOL)moveTitleButtons deltaY:(int)dy;
127
129
  - (void)eval:(NSString*)code;
128
130
  - (void)setCocoaWebview:(VALUE)view;
129
131
  - (void)dragging;
130
132
  @end
131
133
 
132
134
  @implementation CocoaWebview
133
- - (id)initWithFrame:(NSRect)frame debug:(BOOL)flag style:(int)style moveTitleButtons:(BOOL)moveTitleButtons{
135
+ - (id)initWithFrame:(NSRect)frame debug:(BOOL)flag style:(int)style moveTitleButtons:(BOOL)moveTitleButtons deltaY:(int)dy {
134
136
  self = [super initWithContentRect:frame
135
137
  styleMask:style
136
138
  backing:NSBackingStoreBuffered
@@ -139,6 +141,7 @@ VALUE webview_set_bg(VALUE self, VALUE r, VALUE g, VALUE b, VALUE a);
139
141
  [self center];
140
142
  [self setTitle:@"My Custom Window"];
141
143
  [self setDevTool:flag];
144
+ [self setDeltaY:dy];
142
145
  [self setTitlebarAppearsTransparent: YES];
143
146
  [self setTitleVisibility:NSWindowTitleHidden];
144
147
  [self addWebViewToWindow:self];
@@ -154,6 +157,10 @@ VALUE webview_set_bg(VALUE self, VALUE r, VALUE g, VALUE b, VALUE a);
154
157
  return self;
155
158
  }
156
159
 
160
+ - (void)setDeltaY:(int)dy {
161
+ deltaY = dy;
162
+ }
163
+
157
164
  - (void)setShouldMoveTitleButtons:(BOOL)flag {
158
165
  shouldMoveTitleButtons = flag;
159
166
  }
@@ -167,15 +174,15 @@ VALUE webview_set_bg(VALUE self, VALUE r, VALUE g, VALUE b, VALUE a);
167
174
  - (void)moveWindowButtonsForWindow:(NSWindow *)window {
168
175
  //Close Button
169
176
  NSButton *closeButton = [window standardWindowButton:NSWindowCloseButton];
170
- [closeButton setFrameOrigin:NSMakePoint(closeButton.frame.origin.x + 10, closeButton.frame.origin.y - 10)];
177
+ [closeButton setFrameOrigin:NSMakePoint(closeButton.frame.origin.x + 10, closeButton.frame.origin.y - deltaY)];
171
178
 
172
179
  //Minimize Button
173
180
  NSButton *minimizeButton = [window standardWindowButton:NSWindowMiniaturizeButton];
174
- [minimizeButton setFrameOrigin:NSMakePoint(minimizeButton.frame.origin.x + 10, minimizeButton.frame.origin.y - 10)];
181
+ [minimizeButton setFrameOrigin:NSMakePoint(minimizeButton.frame.origin.x + 10, minimizeButton.frame.origin.y - deltaY)];
175
182
 
176
183
  //Zoom Button
177
184
  NSButton *zoomButton = [window standardWindowButton:NSWindowZoomButton];
178
- [zoomButton setFrameOrigin:NSMakePoint(zoomButton.frame.origin.x + 10, zoomButton.frame.origin.y - 10)];
185
+ [zoomButton setFrameOrigin:NSMakePoint(zoomButton.frame.origin.x + 10, zoomButton.frame.origin.y - deltaY)];
179
186
  }
180
187
 
181
188
  - (void)close {
@@ -291,7 +298,7 @@ Init_cocoawebview(void)
291
298
 
292
299
  /* CocoaWebview */
293
300
  rb_mCocoaWebviewClass = rb_define_class_under(rb_mCocoawebview, "CocoaWebview", rb_cObject);
294
- rb_define_method(rb_mCocoaWebviewClass, "initialize", webview_initialize, 3);
301
+ rb_define_method(rb_mCocoaWebviewClass, "initialize", webview_initialize, 4);
295
302
  rb_define_method(rb_mCocoaWebviewClass, "show", webview_show, 0);
296
303
  rb_define_method(rb_mCocoaWebviewClass, "hide", webview_hide, 0);
297
304
  rb_define_method(rb_mCocoaWebviewClass, "eval", webview_eval, 1);
@@ -325,7 +332,7 @@ VALUE nsapp_exit(VALUE self) {
325
332
  [[NSApplication sharedApplication] terminate:nil];
326
333
  }
327
334
 
328
- VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_buttons) {
335
+ VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_buttons, VALUE delta_y) {
329
336
  rb_iv_set(self, "@var", rb_hash_new());
330
337
  rb_iv_set(self, "@bindings", rb_hash_new());
331
338
  BOOL flag = NO;
@@ -342,7 +349,8 @@ VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_
342
349
  c_move_title_buttons = NO;
343
350
  }
344
351
  int c_style = NUM2INT(style);
345
- CocoaWebview *webview = [[CocoaWebview alloc] initWithFrame:NSMakeRect(100, 100, 400, 500) debug:flag style:c_style moveTitleButtons:c_move_title_buttons];
352
+ int c_delta_y = NUM2INT(delta_y);
353
+ CocoaWebview *webview = [[CocoaWebview alloc] initWithFrame:NSMakeRect(100, 100, 400, 500) debug:flag style:c_style moveTitleButtons:c_move_title_buttons deltaY:c_delta_y];
346
354
 
347
355
  [webview setReleasedWhenClosed:NO];
348
356
  [webview setCocoaWebview:self];
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cocoawebview
4
- VERSION = "0.3.14"
4
+ VERSION = "0.3.15"
5
5
  end
data/lib/cocoawebview.rb CHANGED
@@ -28,7 +28,7 @@ module CocoaWebview
28
28
  class CocoaWebview
29
29
  attr_accessor :callback
30
30
 
31
- def self.create(debug: false, min: true, resize: true, close: true, move_title_buttons: false, &block)
31
+ def self.create(debug: false, min: true, resize: true, close: true, move_title_buttons: false, delta_y: 10, &block)
32
32
  style = NSWindowStyleMaskTitled | NSWindowStyleMaskFullSizeContentView
33
33
 
34
34
  style = style | NSWindowStyleMaskMiniaturizable if min
@@ -37,7 +37,7 @@ module CocoaWebview
37
37
 
38
38
  style &= ~NSWindowStyleMaskFullScreen
39
39
 
40
- webview = new(debug, style, move_title_buttons)
40
+ webview = new(debug, style, move_title_buttons, delta_y)
41
41
  webview.callback = block
42
42
  webview
43
43
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoawebview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.14
4
+ version: 0.3.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommy Jeff
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-07-08 00:00:00.000000000 Z
10
+ date: 2025-07-09 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: Webview ruby binding for macOS
13
13
  email: