cocoawebview 1.0.0 → 1.0.1
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 +4 -4
- data/ext/cocoawebview/cocoawebview.m +30 -0
- data/lib/cocoawebview/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1f7e2c2321811e76b897163649af68cfe612b4fbb983573e2022af73f5a5aa68
|
|
4
|
+
data.tar.gz: 0a62a450993d8e3c30f3248d5762828cf7c31c1670f942ef062901cc7989857d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c3466fe4d4d6de9fcb6c9e57522ee244f9253d3ab36059244046e60096a64e1486ca814cec295f63a50370478f8f0d1ab6be2d3313162c701572de84f98f8cab
|
|
7
|
+
data.tar.gz: 64e8c7763867cb6642d754103fc04d4628f3b4bd34085ee45ae675906cec8f5b5e9fc03c2ca79d807581a984c8e2a14c1117373c3cb08b2283e37bf01f180a84
|
|
@@ -14,6 +14,8 @@ VALUE nsapp_exit(VALUE self);
|
|
|
14
14
|
|
|
15
15
|
VALUE nsmenu_initialize(VALUE self);
|
|
16
16
|
VALUE nsmenu_new_menu_item(VALUE self);
|
|
17
|
+
VALUE nsmenu_menu_item_set_target(VALUE self, VALUE menu_item, VALUE target);
|
|
18
|
+
VALUE nsmenu_menu_item_set_action(VALUE self, VALUE menu_item, VALUE action);
|
|
17
19
|
VALUE nsmenu_new_separator_item(VALUE self);
|
|
18
20
|
VALUE nsmenu_create_menu_item(VALUE self, VALUE title, VALUE tag, VALUE key);
|
|
19
21
|
VALUE nsmenu_new_menu(VALUE self);
|
|
@@ -365,6 +367,8 @@ Init_cocoawebview(void)
|
|
|
365
367
|
rb_mNSMenuClass = rb_define_class_under(rb_mCocoawebview, "NSMenu", rb_cObject);
|
|
366
368
|
rb_define_method(rb_mNSMenuClass, "initialize", nsmenu_initialize, 0);
|
|
367
369
|
rb_define_method(rb_mNSMenuClass, "new_menu", nsmenu_new_menu, 0);
|
|
370
|
+
rb_define_method(rb_mNSMenuClass, "set_menu_item_action", nsmenu_menu_item_set_action, 2);
|
|
371
|
+
rb_define_method(rb_mNSMenuClass, "set_menu_item_target", nsmenu_menu_item_set_target, 2);
|
|
368
372
|
rb_define_method(rb_mNSMenuClass, "new_menu_item", nsmenu_new_menu_item, 0);
|
|
369
373
|
rb_define_method(rb_mNSMenuClass, "new_separator", nsmenu_new_separator_item, 0);
|
|
370
374
|
rb_define_method(rb_mNSMenuClass, "create_menu_item", nsmenu_create_menu_item, 3);
|
|
@@ -432,6 +436,32 @@ VALUE nsmenu_initialize(VALUE self) {
|
|
|
432
436
|
return self;
|
|
433
437
|
}
|
|
434
438
|
|
|
439
|
+
VALUE nsmenu_menu_item_set_target(VALUE self, VALUE menu_item, VALUE target) {
|
|
440
|
+
NSMenuItem *item_ns;
|
|
441
|
+
TypedData_Get_Struct(menu_item, NSMenuItem, &menu_obj_type, item_ns);
|
|
442
|
+
|
|
443
|
+
if (NIL_P(target)) {
|
|
444
|
+
item_ns.target = nil;
|
|
445
|
+
} else {
|
|
446
|
+
id target_ns;
|
|
447
|
+
TypedData_Get_Struct(target, void, &menu_obj_type, target_ns);
|
|
448
|
+
item_ns.target = target_ns;
|
|
449
|
+
}
|
|
450
|
+
return Qnil;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
VALUE nsmenu_menu_item_set_action(VALUE self, VALUE menu_item, VALUE action) {
|
|
454
|
+
NSMenuItem *item_ns;
|
|
455
|
+
const char *action_c = StringValueCStr(action);
|
|
456
|
+
NSString *action_ns = [[NSString alloc] initWithCString:action_c encoding:NSUTF8StringEncoding];
|
|
457
|
+
|
|
458
|
+
TypedData_Get_Struct(menu_item, NSMenuItem, &menu_obj_type, item_ns);
|
|
459
|
+
|
|
460
|
+
item_ns.action = NSSelectorFromString(action_ns);
|
|
461
|
+
|
|
462
|
+
return Qnil;
|
|
463
|
+
}
|
|
464
|
+
|
|
435
465
|
VALUE nsmenu_new_separator_item(VALUE self) {
|
|
436
466
|
NSMenuItem *menuItem = [NSMenuItem separatorItem];
|
|
437
467
|
// Wrap the Objective-C pointer into a Ruby object
|
data/lib/cocoawebview/version.rb
CHANGED