/* =============== Rankings_DrawName =============== */ void Rankings_DrawName( void* self ) { menufield_s* f; int length; f = (menufield_s*)self; // strip color codes Q_CleanStr( f->field.buffer ); length = strlen( f->field.buffer ); if( f->field.cursor > length ) { f->field.cursor = length; } // show beginning of long names /* if( Menu_ItemAtCursor( f->generic.parent ) != f ) { if( f->field.scroll > 0 ) { f->field.cursor = 0; f->field.scroll = 0; } } */ MenuField_Draw( f ); }
void Menu_Draw(menuframework_s *menu) { int i; menucommon_s *itemptr; // draw menu for (i=0; i<menu->nitems; i++) { itemptr = (menucommon_s*)menu->items[i]; if (itemptr->flags & QMF_HIDDEN) { continue; } if (itemptr->ownerdraw) { // total subclassing, owner draws everything itemptr->ownerdraw(itemptr); } else { switch (itemptr->type) { case MTYPE_RADIOBUTTON: RadioButton_Draw((menuradiobutton_s*)itemptr); break; case MTYPE_FIELD: MenuField_Draw((menufield_s*)itemptr); break; case MTYPE_SLIDER: Slider_Draw((menuslider_s*)itemptr); break; case MTYPE_SPINCONTROL: SpinControl_Draw((menulist_s*)itemptr); break; case MTYPE_ACTION: Action_Draw((menuaction_s*)itemptr); break; case MTYPE_BITMAP: Bitmap_Draw((menubitmap_s*)itemptr); break; case MTYPE_TEXT: Text_Draw((menutext_s*)itemptr); break; case MTYPE_SCROLLLIST: ScrollList_Draw((menulist_s*)itemptr); break; case MTYPE_PTEXT: PText_Draw((menutext_s*)itemptr); break; case MTYPE_BTEXT: BText_Draw((menutext_s*)itemptr); break; case MTYPE_BUTTON: Button_Draw((menubutton_s*)itemptr); break; default: trap_Error(va("Menu_Draw: unknown type %d", itemptr->type)); } } #ifndef NDEBUG if (uis.debug) { int x; int y; int w; int h; if (!(itemptr->flags & QMF_INACTIVE)) { x = itemptr->left; y = itemptr->top; w = itemptr->right - itemptr->left + 1; h = itemptr->bottom - itemptr->top + 1; if (itemptr->flags & QMF_HASMOUSEFOCUS) { SCR_DrawRect(x, y, w, h, 1.0f, colorYellow); } else { SCR_DrawRect(x, y, w, h, 1.0f, colorWhite); } } } #endif } itemptr = Menu_ItemAtCursor(menu); if (itemptr && itemptr->statusbar) { itemptr->statusbar((void *) itemptr); } }