void UI_WINDOW::draw() { UI_GADGET *tmp; gr_reset_clip(); font::set_font(f_id); if (foreground_bmap_id >= 0) { gr_set_bitmap(foreground_bmap_id); gr_bitmap(x, y, GR_RESIZE_MENU); } if (flags & WIN_FILLED) { ui_draw_box_out(x, y, x+w-1, y+h-1); } if (flags & WIN_BORDER) { ui_draw_frame(x-BORDER_WIDTH, y-BORDER_WIDTH, x+w+BORDER_WIDTH-1, y+h+BORDER_WIDTH-1); } if (first_gadget) { tmp = first_gadget; do { if (!tmp->hidden) tmp->draw(); tmp = tmp->next; } while (tmp != first_gadget); } if (first_gadget) { tmp = first_gadget; do { if (!tmp->hidden && (tmp->kind == UI_KIND_BUTTON) && ((UI_BUTTON *) tmp)->button_down()){ tmp->draw(); } tmp = tmp->next; } while (tmp != first_gadget); } // draw all xstrs draw_xstrs(); // draw tooltips draw_tooltip(); // convenient debug code for showing mouse coords if(Cmdline_mouse_coords){ int mx, my; mouse_get_pos(&mx, &my); // mprintf(("MOUSE (%d, %d)\n", mx, my)); gr_set_color_fast(&Color_normal); gr_printf_no_resize(mx, my - 12, "%d %d", mx, my); } }
// Handle drawing of all children of the gadget. Since this the base of all other gadgets, // it doesn't have any look to it (kind of like a soul. Can you see someone's soul?) and thus // doesn't actually render itself. // void UI_GADGET::draw() { UI_GADGET *cur; // if hidden, hide children as well if (hidden){ return; } if (children) { cur = children; do { cur->draw(); cur = cur->next; } while (cur != children); } }