void KreogistCuteStyle::drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w) const { switch(element) { case CE_MenuItem: { const QStyleOptionMenuItem *_opt_menu_item= qstyleoption_cast<const QStyleOptionMenuItem *>(opt); if(_opt_menu_item != nullptr) { drawMenuItem(_opt_menu_item,p,w); } break; } case CE_TabBarTab: { const QStyleOptionTab *_opt_tab_item= qstyleoption_cast<const QStyleOptionTab *>(opt); if(_opt_tab_item != nullptr) { drawTabItem(_opt_tab_item,p,w); } break; } default: style->drawControl(element,opt,p,w); break; } }
void KNSaoStyle::drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w) const { //Initial the rendering hints. p->setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing, true); //Check out the element type switch(element) { //SAO style will repaint the menu item. case CE_MenuItem: { //Recast the menu style option as a menu item. //Check the pointer first. if(opt!=nullptr) { //Draw the menu item. drawMenuItem(qstyleoption_cast<const QStyleOptionMenuItem *>(opt), p, w); } break; } //For all the other controls, simply use fustion style to draw the control. default: m_fusionStyle->drawControl(element,opt,p,w); } }
void __fastcall__ drawMenu(char canReturn) { char i; for (i = 0; i < 198; ++i) { POKE(0x1000 + 242 + i, 32); POKE(0x9400 + 242 + i, 7); } if (!canReturn) { textcolor(TEXT_COLOR); cputsxy(3, 21, "down"); cputsxy(15, 21, "select"); textcolor(HILITE_COLOR); cputsxy(1, 21, "s"); cputsxy(8, 21, "return"); } menuSize = 4; if (stackDepth == 0 && !canReturn) { menuSize = 3; } // draw the menu for (i = 0; i < menuSize; ++i) { drawMenuItem(i); } textcolor(HILITE_COLOR); }
void __fastcall__ addToMusicVolume(char add) { char musicVolume = getMusicVolume() + add; musicVolume &= 15; enterNumberInMenuItem(caMenus[menu][1] + 13, musicVolume); drawMenuItem(item); setMusicVolume(musicVolume); }
void __fastcall__ addToEffectsVolume(char add) { char effectsVolume = getEffectsVolume() + add; effectsVolume &= 15; enterNumberInMenuItem(caMenus[menu][0] + 15, effectsVolume); drawMenuItem(item); setEffectsVolume(effectsVolume); playSound(SOUND_PISTOL); }
void CCustomStyle::drawControl(ControlElement control, const QStyleOption *option, QPainter *painter, const QWidget *widget ) const { switch(control) { case CE_MenuItem: { drawMenuItem(option, painter, widget); return; // 直接返回, 否则会被super::drawcontrol覆盖 } } QProxyStyle::drawControl(control, option, painter, widget); }
//disegna sfondo main menu e menu items void MenuMgr::drawMainMenu() { draw(1); //disegna sfondo main menu showingMainMenu = true; //disegna elementi menu principale) (selectedMenuItem == 0) ? drawMenuItem(0, true) : drawMenuItem(0, false); (selectedMenuItem == 1) ? drawMenuItem(1, true) : drawMenuItem(1, false); (selectedMenuItem == 2) ? drawMenuItem(2, true) : drawMenuItem(2, false); }
/* * drawListElement() is a local that draws a single list item */ static void drawListElement(Obj *obj, WINDOW *win, int idx, int y, int x, int start) { /* clear this line */ wmove(win, y+idx-start, x); waddnstr(win, rillyrillylongblankstring, obj->width); /* don't try to draw anything unless there's something to draw */ if (obj->item.list.items && idx < obj->item.list.nritems) switch (obj->item.list.kind) { default: /* we'll default to a checked item if the sky falls */ case LO_CHECK: drawCheckItem(obj, idx, win, x, y+idx-start); break; case LO_HIGHLIT: drawHighlitItem(obj, idx, win, x, y+idx-start); break; case LO_MENU: drawMenuItem(obj, idx, win, x, y+idx-start); break; } }
// returns 1 if should restart char __fastcall__ runMenu(char canReturn) { if (canReturn) { playSound(SOUND_STNMOV); } waitForEscReleased(); drawLogo(); // printCentered("akronyme analogiker", 0); // printCentered("presents", 1); enterNumberInMenuItem(caMenus[2][0] + 15, getEffectsVolume()); enterNumberInMenuItem(caMenus[2][1] + 13, getMusicVolume()); menu = 0; item = 0; stackDepth = 0; drawMenu(canReturn); while (menu != 255) { oldKeys = moveKeys; oldCtrlKeys = ctrlKeys; moveKeys = readInput(); ctrlKeys = getControlKeys(); if (keyPressed(KEY_FORWARD)) { char oldItem = item; --item; if (item == 255) item = menuSize-1; drawMenuItem(oldItem); drawMenuItem(item); playSound(SOUND_STNMOV); } if (keyPressed(KEY_BACK)) { char oldItem = item; ++item; if (item == menuSize) item = 0; drawMenuItem(oldItem); drawMenuItem(item); playSound(SOUND_STNMOV); } if (menu == 2) { if (keyPressed(KEY_MOVERIGHT) || ctrlKeyPressed(KEY_RETURN)) { if (item == 0) { addToEffectsVolume(1); } else if (item == 1) { addToMusicVolume(1); } } if (keyPressed(KEY_MOVELEFT)) { if (item == 0) { addToEffectsVolume(255); } else if (item == 1) { addToMusicVolume(255); } } } if (ctrlKeyPressed(KEY_ESC)) { if (stackDepth == 0) { if (canReturn) { playSound(SOUND_OOF); waitForEscReleased(); return 0; } } else { playSound(SOUND_OOF); --stackDepth; menu = menuStack[stackDepth]; item = itemStack[stackDepth]; drawMenu(canReturn); } } if (ctrlKeyPressed(KEY_RETURN)) { signed char next; if (menu == 1) episode = item; next = nextMenu[menu][item]; if (next == -66) { playSound(SOUND_OOF); return 0; } else if (next != -10) { playSound(SOUND_PISTOL); if (next >= 0) { if (next > menu) { menuStack[stackDepth] = menu; itemStack[stackDepth] = item; ++stackDepth; item = 0; } else { --stackDepth; item = itemStack[stackDepth]; } menu = next; drawMenu(canReturn); } else { next = (-next)-1; clearScreen(); waitForRaster(30); load_full_text_screen(textScreens[next]); setupBitmap(8 + 2); // multicolor red drawLogo(); drawMenu(canReturn); } } else if (menu == 3) { stopMusic(); playSound(SOUND_PISTOL); clearScreen(); waitForRaster(30); difficulty = item; return 1; } } } }