struct menulist *new_ml() { struct menulist *ret = (struct menulist *) malloc(sizeof(struct menulist)); GrGetScreenInfo(&ret->screen_info); ret->gc = pz_get_gc(1); GrSetGCUseBackground(ret->gc, GR_FALSE); GrSetGCForeground(ret->gc, BLACK); GrSetGCBackground(ret->gc, BLACK); ret->wid = pz_new_window(0, HEADER_TOPLINE + 1, ret->screen_info.cols, ret->screen_info.rows - (HEADER_TOPLINE + 1), itunes_do_draw, itunes_do_keystroke); GrSelectEvents(ret->wid, GR_EVENT_MASK_EXPOSURE|GR_EVENT_MASK_KEY_DOWN|GR_EVENT_MASK_KEY_UP|GR_EVENT_MASK_TIMER); GrGetGCTextSize(ret->gc, "M", -1, GR_TFASCII, &ret->gr_width, &ret->gr_height, &ret->gr_base); ret->gr_height += 4; GrMapWindow(ret->wid); ret->itunes_menu = ttk_new_menu_widget (0, ttk_menufont, ret->wid->w, ret->wid->h); ttk_window_set_title (ret->wid, "Music"); ret->init = 0; ret->prevml = NULL; return ret; }
static TWindow *remove_tracks (ttk_menu_item *item) { TWindow *ret = ttk_new_window(); ret->data = 0x12345678; ttk_window_set_title (ret, _("Really Delete These Tracks?")); remove_tracks_menu[0].flags = 0; remove_tracks_menu[1].flags = TTK_MENU_ICON_EXE; remove_tracks_menu[0].data = remove_tracks_menu[1].data = item->data; ttk_add_widget (ret, ttk_new_menu_widget (remove_tracks_menu, ttk_textfont, item->menuwidth, item->menuheight)); ttk_set_popup (ret); return ret; }
static TWindow *browser_delete (ttk_menu_item *item) { TWindow *ret = ttk_new_window(); ret->data = 0x12345678; ttk_window_set_title (ret, _("Really Delete?")); delete_menu[0].flags = 0; delete_menu[1].flags = TTK_MENU_ICON_EXE; delete_menu[0].data = delete_menu[1].data = item->data; ttk_add_widget (ret, ttk_new_menu_widget (delete_menu, ttk_textfont, item->menuwidth, item->menuheight)); ttk_set_popup (ret); return ret; }
static TWindow *browser_execute(ttk_menu_item *item) { TWindow *ret = ttk_new_window(); ret->data = 0x12345678; ttk_window_set_title(ret, _("Execute")); execute_menu[0].data = execute_menu[1].data = execute_menu[2].data = item->data; ttk_add_widget(ret, ttk_new_menu_widget(execute_menu, ttk_menufont, item->menuwidth, item->menuheight)); ttk_set_popup(ret); return ret; }
static TWindow *new_settings_slider_window (char *title, int setting, int slider_min, int slider_max) { int tval = pz_get_int_setting (pz_global_config, setting); TWindow *win = ttk_new_window(); TWidget *slider = ttk_new_slider_widget (0, 0, ttk_screen->w * 3 / 5, slider_min, slider_max, &tval, 0); ttk_slider_set_callback (slider, slider_set_setting, setting); ttk_window_set_title (win, title); ttk_add_widget (win, slider); win->data = 0x12345678; ttk_set_popup (win); return win; }