cocoawebview 0.2.3 → 0.2.5

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: 6c80c17f0587af34667682432b333f7843f65dac96f707883cf8b5a287d42320
4
- data.tar.gz: 0b14d8bc43ad02263f5afe91f187f6f0fb86427dffd429ec0106c11aa25892dd
3
+ metadata.gz: 6fff092b9157198789bcbabb8503718b360a642edb6172324637c5f449f3fec7
4
+ data.tar.gz: d620a9315c261e03e70568ed591683aba789a1fff86684588e64901519d9c7de
5
5
  SHA512:
6
- metadata.gz: dcd142915acc1e77d6c09b897b89d9eb341dc32317ef7363a1e960f08c84951b11fc87468cc59d62affbd89cfbcc8d0dfea808c484effddd6f93b670ed3d8eba
7
- data.tar.gz: 77fff479d4d46be2216718ee8a2dc899b58daace4b48d98b82ff182d2a3b1f859ab524cbf08ba5ffc9d48edb712bd3fe821553d34cc9aca59fcee935dbe9dcb1
6
+ metadata.gz: 2815a0ae33f5f7a18a15fab267e435c41c279aa1dea86816d8ad0e7a4c13e4c545e4104efb6d50133a12b4ec65e02a11bf41e1dcd53d5d1f517b006ad17d9baf
7
+ data.tar.gz: 5cc3b1bfb804aa27f4852d5e866662ec93da3fcccec597b9fd281ee7c57d2b5d4fa683773a6d9d1bf8f522b679178ed20d6e643cfa23fec48f1d106fd6df6654
@@ -9,6 +9,7 @@ NSApplication *application = nil;
9
9
 
10
10
  VALUE nsapp_initialize(VALUE self);
11
11
  VALUE nsapp_run(VALUE self);
12
+ VALUE nsapp_exit(VALUE self);
12
13
 
13
14
  VALUE webview_initialize(VALUE self, VALUE debug, VALUE style);
14
15
  VALUE webview_show(VALUE self);
@@ -20,6 +21,7 @@ VALUE webview_set_pos(VALUE self, VALUE x, VALUE y);
20
21
  VALUE webview_get_pos(VALUE self);
21
22
  VALUE webview_dragging(VALUE self);
22
23
  VALUE webview_set_title(VALUE self, VALUE title);
24
+ VALUE webview_center(VALUE self);
23
25
 
24
26
  @interface AppDelegate : NSObject <NSApplicationDelegate> {
25
27
  VALUE app;
@@ -169,6 +171,7 @@ Init_cocoawebview(void)
169
171
  rb_mNSAppClass = rb_define_class_under(rb_mCocoawebview, "NSApp", rb_cObject);
170
172
  rb_define_method(rb_mNSAppClass, "initialize", nsapp_initialize, 0);
171
173
  rb_define_method(rb_mNSAppClass, "run", nsapp_run, 0);
174
+ rb_define_method(rb_mNSAppClass, "exit", nsapp_exit, 0);
172
175
 
173
176
  /* CocoaWebview */
174
177
  rb_mCocoaWebviewClass = rb_define_class_under(rb_mCocoawebview, "CocoaWebview", rb_cObject);
@@ -182,6 +185,7 @@ Init_cocoawebview(void)
182
185
  rb_define_method(rb_mCocoaWebviewClass, "get_pos", webview_get_pos, 0);
183
186
  rb_define_method(rb_mCocoaWebviewClass, "dragging", webview_dragging, 0);
184
187
  rb_define_method(rb_mCocoaWebviewClass, "set_title", webview_set_title, 1);
188
+ rb_define_method(rb_mCocoaWebviewClass, "center", webview_center, 0);
185
189
  }
186
190
 
187
191
  VALUE nsapp_initialize(VALUE self) {
@@ -197,6 +201,10 @@ VALUE nsapp_run(VALUE self) {
197
201
  [application run];
198
202
  }
199
203
 
204
+ VALUE nsapp_exit(VALUE self) {
205
+ [[NSApplication sharedApplication] terminate:nil];
206
+ }
207
+
200
208
  VALUE webview_initialize(VALUE self, VALUE debug, VALUE style) {
201
209
  rb_iv_set(self, "@var", rb_hash_new());
202
210
  rb_iv_set(self, "@bindings", rb_hash_new());
@@ -323,3 +331,11 @@ VALUE webview_set_title(VALUE self, VALUE title) {
323
331
  NSString *title_str = [[NSString alloc] initWithCString:c_title encoding:NSUTF8StringEncoding];
324
332
  [webview setTitle:title_str];
325
333
  }
334
+
335
+ VALUE webview_center(VALUE self) {
336
+ VALUE wrapper = rb_ivar_get(self, rb_intern("@webview"));
337
+ CocoaWebview *webview;
338
+ TypedData_Get_Struct(wrapper, CocoaWebview, &cocoawebview_obj_type, webview);
339
+
340
+ [webview center];
341
+ }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cocoawebview
4
- VERSION = "0.2.3"
4
+ VERSION = "0.2.5"
5
5
  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.2.3
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommy Jeff