bool NextClientFactory::reset(unsigned long /*changed*/) { // TODO Do not recreate decorations if it is not needed. Look at // ModernSystem for how to do that delete_pixmaps(); create_pixmaps(this); // For now just return true. return true; }
void menu_update_menu(menu_st *menulist) { int i; /* wipe all of the pixmaps */ for (i = 0; i < menulist->screen_items; i++) { menu_clear_pixmap(menulist, i); } if (get_current_font() != menulist->font) { int items; int h = menulist->height; GrDestroyGC(menulist->menu_gc); menulist->menu_gc = pz_get_gc(1); GrGetGCTextSize(menulist->menu_gc, "abcdefghijhlmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, GR_TFASCII, &menulist->width, &menulist->height, &menulist->base); /* add a 2px padding to the text */ menulist->height += 4; items = (int)menulist->h/menulist->height; if (menulist->height != h) { for (i = 0; i < menulist->screen_items; i++) GrDestroyWindow(menulist->pixmaps[i]); free(menulist->pixmaps); free(menulist->pixmap_pos); create_pixmaps(menulist, items); } menulist->screen_items = items; menulist->font = get_current_font(); if (menulist->sel > menulist->top_item + menulist->screen_items) menu_select_item(menulist, menulist->sel); } /* force the rest of the redraw */ menulist->scheme_no = appearance_get_color_scheme(); /* NOTE: if "color scheme" is anywhere other than on the first screen's worth of menu items, this doesn't work correctly, but that's not an issue right now */ menulist->init = 0; }
KWMThemeFactory::KWMThemeFactory() { create_pixmaps(); }
NextClientFactory::NextClientFactory() { create_pixmaps(this); }
LaptopClientFactory::LaptopClientFactory() { create_pixmaps(); }
/* menu initialization, make sure to do a menu_destroy when you are finished */ menu_st *menu_init(GR_WINDOW_ID menu_wid, char *title, int x, int y, int w, int h, menu_st *parent, item_st *items, int op) { menu_st *menulist; int i; menulist = (menu_st *)malloc(sizeof(menu_st)); if (!menulist) { return NULL; } /* starting with an empty slate */ if(items == NULL) { menulist->items = (item_st *)malloc(20 * sizeof(item_st)); menulist->num_items = 0; menulist->alloc_items = 20; } /* starting with a static menu */ else { menulist->items = items; for(i = 0; items[i].text != 0; i++) items[i].orig_pos = i; menulist->num_items = i; menulist->alloc_items = 0; } menulist->title = title; menulist->op = op; menulist->sel = 0; menulist->init = 0; menulist->timer = 0; menulist->top_item = 0; menulist->scheme_no = -1; menulist->scrollbar = 0; menulist->timer_step = 0; menulist->parent = parent; menulist->lastsel = -1; menulist->menu_gc = pz_get_gc(1); GrGetGCTextSize(menulist->menu_gc, "abcdefghijhlmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, GR_TFASCII, &menulist->width, &menulist->height, &menulist->base); /* add a 2px padding to the text */ menulist->height += 4; /* determine how many items can fit on a screen */ menulist->screen_items = (int)h/menulist->height; menulist->x = x; menulist->y = y; menulist->w = w; menulist->h = h; menulist->menu_wid = menu_wid; menulist->font = get_current_font(); create_pixmaps(menulist, menulist->screen_items); menulist->transition = GrNewPixmap(menulist->w*2, menulist->h, NULL); #if 0 Dprintf("Init::%d items per screen at %dpx\n\tbecause %d/%d == %d\n", menulist->screen_items, menulist->height, menulist->h, menulist->height, menulist->screen_items); #endif return menulist; }