ui/motif/stock.c

branch
newapi
changeset 176
bc63cb601f6d
parent 157
0b33b9396851
equal deleted inserted replaced
175:2cb06c231057 176:bc63cb601f6d
29 #include <stdio.h> 29 #include <stdio.h>
30 #include <stdlib.h> 30 #include <stdlib.h>
31 31
32 #include "stock.h" 32 #include "stock.h"
33 #include "../ui/properties.h" 33 #include "../ui/properties.h"
34 #include <ucx/map.h> 34 #include <cx/hash_map.h>
35 35
36 static UcxMap *stock_items; 36 static CxMap *stock_items;
37 37
38 void ui_stock_init() { 38 void ui_stock_init() {
39 stock_items = ucx_map_new(64); 39 stock_items = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 64);
40 40
41 ui_add_stock_item(UI_STOCK_NEW, "New", "Ctrl<Key>N", "Ctrl+N", NULL); 41 ui_add_stock_item(UI_STOCK_NEW, "New", "Ctrl<Key>N", "Ctrl+N", NULL);
42 ui_add_stock_item(UI_STOCK_OPEN, "Open", "Ctrl<Key>O", "Ctrl+O", NULL); 42 ui_add_stock_item(UI_STOCK_OPEN, "Open", "Ctrl<Key>O", "Ctrl+O", NULL);
43 ui_add_stock_item(UI_STOCK_SAVE, "Save", "Ctrl<Key>S", "Ctrl+S", NULL); 43 ui_add_stock_item(UI_STOCK_SAVE, "Save", "Ctrl<Key>S", "Ctrl+S", NULL);
44 ui_add_stock_item(UI_STOCK_SAVE_AS, "Save as ...", NULL, NULL, NULL); 44 ui_add_stock_item(UI_STOCK_SAVE_AS, "Save as ...", NULL, NULL, NULL);
59 i->label = label; 59 i->label = label;
60 i->accelerator = accelerator; 60 i->accelerator = accelerator;
61 i->accelerator_label = accelerator_label; 61 i->accelerator_label = accelerator_label;
62 // TODO: icon 62 // TODO: icon
63 63
64 ucx_map_cstr_put(stock_items, id, i); 64 cxMapPut(stock_items, id, i);
65 } 65 }
66 66
67 UiStockItem* ui_get_stock_item(char *id) { 67 UiStockItem* ui_get_stock_item(char *id) {
68 UiStockItem *item = ucx_map_cstr_get(stock_items, id); 68 UiStockItem *item = cxMapGet(stock_items, id);
69 if(item) { 69 if(item) {
70 char *label = uistr_n(id); 70 char *label = uistr_n(id);
71 if(label) { 71 if(label) {
72 item->label = label; 72 item->label = label;
73 } 73 }

mercurial