static void move_link_children(Button *b, struct hchiledat *hcd) { while(b) { b->root = hcd->root; b->flags = (b->flags & ~(MB_ROOTISWNDO)) | hcd->orflags; scale_button(b,&hcd->menu_scale); move_link_children(b->children,hcd); b->x += hcd->dx; b->y += hcd->dy; if(b->flags & MB_GHANG) b->group = hcd->group; b = b->next; } }
void mb_hang_chiles_oset(Button *m,SHORT xoset, SHORT yoset) { struct hchiledat hcd; Button *child; if(m == NULL || (child = m->children) == NULL) return; hcd.orflags = m->flags & MB_ROOTISWNDO; hcd.menu_scale = m->root->w.W_screen->menu_scale; scale_button(child,&hcd.menu_scale); hcd.dx = xoset + (m->x - child->x); hcd.dy = yoset + (m->y - child->y); hcd.root = m->root; hcd.group = m->group; move_link_children(child,&hcd); }
void reloadButtons () { int i; static char *button_imgs[BUTTONS_NUM][2] = {{"mount-white", "mount-green-pressed"}, {"unmount-white", "unmount-red-pressed"}, {"eject-white", "eject-red-pressed"}}; static int button_contexts[BUTTONS_NUM] = { MOUNT_CONTEXT, UNMOUNT_CONTEXT, EJECT_CONTEXT}; int btn_size = (AppState.tileWidth - 15) / 2; for ( i = 0 ; i < BUTTONS_NUM ; ++i){ if (AppState.buttons[i] == NULL) AppState.buttons[i] = safecalloc (1, sizeof(struct button_t)); else free_button_resources (AppState.buttons[i]); load_button (AppState.buttons[i], button_imgs[i], Scr.image_manager ); AppState.buttons[i]->context = button_contexts[i]; LOCAL_DEBUG_OUT ("button[%d].size = %dx%d, image %dx%d", i, AppState.buttons[i]->width, AppState.buttons[i]->height, AppState.buttons[i]->pressed.image?AppState.buttons[i]->pressed.image->width:0, AppState.buttons[i]->pressed.image?AppState.buttons[i]->pressed.image->height:0); scale_button (AppState.buttons[i], btn_size, btn_size, Scr.asv); } }