ui/cocoa/menu.m

changeset 19
f8f22eb0b575
parent 15
7a36f91c22f7
child 20
2dda1ad6dc7a
equal deleted inserted replaced
18:06be29a56f8b 19:f8f22eb0b575
30 #import <stdlib.h> 30 #import <stdlib.h>
31 #import <string.h> 31 #import <string.h>
32 32
33 #import "menu.h" 33 #import "menu.h"
34 #import "window.h" 34 #import "window.h"
35 #import "stock.h"
35 36
36 @implementation UiMenuDelegate 37 @implementation UiMenuDelegate
37 38
38 - (UiMenuDelegate*) init { 39 - (UiMenuDelegate*) init {
39 items = NULL; 40 items = NULL;
111 112
112 NSMenuItem *item = [currentMenu addItemWithTitle:str 113 NSMenuItem *item = [currentMenu addItemWithTitle:str
113 action:@selector(handleEvent:) keyEquivalent:@""]; 114 action:@selector(handleEvent:) keyEquivalent:@""];
114 [item setTarget:event]; 115 [item setTarget:event];
115 116
116 //[delegate addItem: item]; 117 currentItemIndex++;
118 }
119
120 void ui_menuitem_st(char *stockid, ui_callback f, void *data) {
121 EventWrapper *event = [[EventWrapper alloc]initWithData:data callback:f];
122 UiStockItem *si = ui_get_stock_item(stockid);
123
124 NSMenuItem *item = [currentMenu addItemWithTitle:si->label
125 action:@selector(handleEvent:) keyEquivalent:si->keyEquivalent];
126 [item setTarget:event];
127
117 currentItemIndex++; 128 currentItemIndex++;
118 } 129 }
119 130
120 void ui_checkitem(char *label, ui_callback f, void *data) { 131 void ui_checkitem(char *label, ui_callback f, void *data) {
121 EventWrapper *event = [[EventWrapper alloc]initWithData:data callback:f]; 132 EventWrapper *event = [[EventWrapper alloc]initWithData:data callback:f];

mercurial