void ProcessorList::drawItems(Graphics& g) { totalHeight = yBuffer; category = baseItem->getName(); drawItem(g, baseItem); if (baseItem->isOpen()) { for (int n = 0; n < baseItem->getNumSubItems(); n++) { setViewport(g, baseItem->hasSubItems()); category = baseItem->getSubItem(n)->getName(); drawItem(g, baseItem->getSubItem(n)); if (baseItem->getSubItem(n)->isOpen()) { for (int m = 0; m < baseItem->getSubItem(n)->getNumSubItems(); m++) { setViewport(g, baseItem-> getSubItem(n)-> getSubItem(m)-> hasSubItems()); drawItem(g, baseItem->getSubItem(n)->getSubItem(m)); } } } } }
void HiRes1Engine::drawItems() { Common::List<Item>::iterator item; uint dropped = 0; for (item = _state.items.begin(); item != _state.items.end(); ++item) { // Skip items not in this room if (item->room != _state.room) continue; if (item->state == IDI_ITEM_DROPPED) { // Draw dropped item if in normal view if (getCurRoom().picture == getCurRoom().curPicture) drawItem(*item, _itemOffsets[dropped++]); } else { // Draw fixed item if current view is in the pic list Common::Array<byte>::const_iterator pic; for (pic = item->roomPictures.begin(); pic != item->roomPictures.end(); ++pic) { if (*pic == getCurRoom().curPicture) { drawItem(*item, item->position); break; } } } } }
void Canvas::draw(QPainter& p, const QRect& rect)/*{{{*/ { // printf("draw canvas %x virt %d\n", this, virt()); int x = rect.x(); int y = rect.y(); int w = rect.width(); int h = rect.height(); int x2 = x + w; if (virt()) { //printf("If virt() code running\n"); drawCanvas(p, rect); //--------------------------------------------------- // draw Canvas Items //--------------------------------------------------- iCItem to(_items.lower_bound(x2)); // Draw items from other parts behind all others. // Only for items with events (not Composer parts). QList<CItem*> sortedByZValue; // Draw items from other parts behind all others. // Only for items with events (not Composer parts). for (iCItem i = _items.begin(); i != to; ++i) { sortedByZValue.append(i->second); } PartZIndex = m_PartZIndex; qSort(sortedByZValue.begin(), sortedByZValue.end(), Canvas::smallerZValue); foreach(CItem* ci, sortedByZValue) { if (!ci->event().empty() && ci->part() != _curPart) { drawItem(p, ci, rect); } else if (!ci->isMoving() && (ci->event().empty() || ci->part() == _curPart)) { drawItem(p, ci, rect); } } to = _moving.lower_bound(x2); for (iCItem i = _moving.begin(); i != to; ++i) { drawItem(p, i->second, rect); } drawTopItem(p,rect); } else {
Boolean DrawHandler::draw(IListBoxDrawItemEvent& event, DrawFlag& flag) { if(event.isSelected()) { flag = drewSelected; return drawItem(event, true); } else return drawItem(event, false); }
static void onDraw(tContext *pContext) { char buf[30]; GrContextForegroundSet(pContext, ClrBlack); #if defined(PRODUCT_W002) || defined(PRODUCT_W004) GrRectFill(pContext, &client_clip); #else GrRectFill(pContext, &fullscreen_clip); #endif GrContextForegroundSet(pContext, ClrWhite); if (state == WALK) { #if defined(PRODUCT_W002) || defined(PRODUCT_W004) sprintf(buf, "%d", ped_get_steps()); drawItem(pContext, 0, ICON_STEPS, "Step Taken", buf); sprintf(buf, "%02d:%02d", ped_get_time() / 60, ped_get_time() % 60); drawItem(pContext, 1, ICON_TIME, "Walk Time", buf); uint16_t cals = ped_get_calorie() / 100 / 1000; sprintf(buf, "%d", cals); drawItem(pContext, 2, ICON_CALORIES, "Calories", buf); uint16_t dist = ped_get_distance() / 100; sprintf(buf, "%dm", dist); drawItem(pContext, 3, ICON_DISTANCE, "Distance", buf); #else sprintf(buf, "%d", ped_get_steps()); drawItem(pContext, 0, ICON_STEPS, "Steps", buf); uint16_t cals = ped_get_calorie() / 100 / 1000; sprintf(buf, "%d", cals); drawItem(pContext, 1, ICON_CALORIES, "Calories", buf); uint16_t dist = ped_get_distance() / 100; sprintf(buf, "%dm", dist); drawItem(pContext, 2, ICON_DISTANCE, "Distance", buf); sprintf(buf, "%02d:%02d", ped_get_time() / 60, ped_get_time() % 60); drawItem(pContext, 3, ICON_TIME, "Active", buf); #endif // draw progress #if defined(PRODUCT_W002) || defined(PRODUCT_W004) #else uint16_t goal = window_readconfig()->goal_steps; uint32_t steps = ped_get_steps(); if (steps < goal) window_progress(pContext, 5 + 4 * LINEMARGIN, steps * 100 / goal); else window_progress(pContext, 5 + 4 * LINEMARGIN, 100); sprintf(buf, "%d%% of %d", (uint16_t)(steps * 100 / goal), goal); GrContextForegroundSet(pContext, ClrWhite); GrStringDrawCentered(pContext, buf, -1, LCD_WIDTH/2, 148, 0); #endif } }
void GUIListGadget::draw() { if (!isVisible_ || isValidated_ || !setupClipping()) return; GlbRenderSys->draw2DRectangle(Rect_, Color_); /* Draw all item entries */ s32 ItemPos = 0; for (std::list<GUIListItem*>::iterator it = ItemList_.begin(); it != ItemList_.end(); ++it) { drawItem(*it, ItemPos); ItemPos += (*it)->getItemSize(); } /* Draw all column entries */ s32 ColumnPos = 0; for (std::list<GUIListColumn*>::iterator it = ColumnList_.begin(); it != ColumnList_.end(); ++it) { drawColumn(*it, ColumnPos); ColumnPos += (*it)->getColumnSize(); } /* Update scrollbar ranges */ HorzScroll_.setRange(ColumnPos); VertScroll_.setRange(ItemPos + COLUMN_HEIGHT); drawChildren(); GlbRenderSys->setClipping(true, dim::point2di(VisRect_.Left, VisRect_.Top), VisRect_.getSize()); drawFrame(Rect_, 0, false); }
void ChannelItemDelegate::paintChannel(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { YTChannel *channel = index.data(ChannelModel::DataObjectRole).value<YTChannelPointer>().data(); if (!channel) return; painter->save(); painter->translate(option.rect.topLeft()); const QRect line(0, 0, option.rect.width(), option.rect.height()); // const bool isActive = index.data( ActiveItemRole ).toBool(); // const bool isHovered = index.data(ChannelsModel::HoveredItemRole ).toBool(); // const bool isSelected = option.state & QStyle::State_Selected; QPixmap thumbnail = channel->getThumbnail(); if (thumbnail.isNull()) { channel->loadThumbnail(); painter->restore(); return; } QString name = channel->getDisplayName(); drawItem(painter, line, thumbnail, name); int notifyCount = channel->getNotifyCount(); if (notifyCount > 0) paintBadge(painter, line, QString::number(notifyCount)); painter->restore(); }
void ItemRenderSystem::drawItem(SDL_Surface *display, GameObject item) { EntityManager &em = EntityManager::instance(); SpaceComponent *sc = em.getComponentForEntity<SpaceComponent>(item); if (!sc || !sc->is_active) { return; } bool explored = CArea::area_control.GetTile( sc->pos.x * TILE_SIZE, sc->pos.y * TILE_SIZE)->is_explored; if (!explored && CArea::area_control.GetMap(0,0)->fow_on) { return; //dont render if not visible } ItemComponent *ic = em.getComponentForEntity<ItemComponent>(item); if (ic->useType == ItemComponent::USE_TYPE_TRAP) { TrapComponent *trap = em.getComponentForEntity<TrapComponent>(item); if (!trap->is_visible) { return; // don't render invisible traps } } drawItem(display, ic, sc->pos.x * TILE_SIZE - CCamera::camera_control.GetX(), sc->pos.y * TILE_SIZE - CCamera::camera_control.GetY()); }
void xQGanttBarViewPort::update(int x1, int y1, int x2, int y2) ////////////////////////////////////////////////////////// { QPainter p(this); // QTime time1 = QTime::currentTime(); if(_drawGrid) drawGrid(&p, x1, y1, x2, y2); // QTime time2 = QTime::currentTime(); // printf("%d msec for drawing grid.\n", time1.msecsTo( time2 ) ); // drawContents(&p, x1, y1, x2, y2); drawItem(_toplevelitem, &p, QRect(x1, y1, x2 - x1, y2 - y1)); // time1 = QTime::currentTime(); // printf("%d msec for drawing contents.\n", time2.msecsTo( time1 ) ); if(_drawHeader) drawHeader(&p, x1, y1, x2, y2); // time2 = QTime::currentTime();< // printf("%d msec for drawing header.\n", time1.msecsTo( time2 ) ); }
void AssetDecodePopup::paintEvent(QPaintEvent *) { QStyleOption opt; opt.init(this); QPainter p(this); //style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); itemMutex.lock(); QBrush brush; brush.setColor(QColor(51, 51, 51)); brush.setStyle(Qt::BrushStyle::SolidPattern); p.fillRect(0, 0, width(), height(), brush); QPen pen; pen.setColor(QColor(41, 41, 41)); p.setPen(pen); p.drawRect(0, 0, width()-1, height()-1); int yPos = 2; for (const auto& item : m_items) { drawItem(item.displayFilename, item.status, QRect(2, yPos, width() - 5, SingleItemHeight), item.progress); yPos += SingleItemHeight; } itemMutex.unlock(); }
/* * Rename a folder or an item */ void CNOutBarCtrl::renameUI() { onEditCanceled(); int obj = HITOBJ(lastHit); int i = HITINDEX(lastHit); DWORD flags = WS_VISIBLE | WS_CHILD | ES_CENTER; const char *text = ""; editCtrl = new CNOutBarEdit(this, obj, i); if (obj == HT_FOLDER) { text = folders[i]->text; editCtrl->Create(flags, CRect(0, 0, 0, 0), this, 1); editCtrl->ModifyStyleEx(0, WS_EX_CLIENTEDGE, SWP_FRAMECHANGED); } else if (obj == HT_ITEM) { CClientDC dc(this); drawItem(&dc, i, TRUE); text = folders[selFolder]->items[i]->text; editCtrl->Create(flags | WS_BORDER, CRect(0, 0, 0, 0), this, 1); } editCtrl->SetFont(CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT))); editCtrl->SetWindowText(text); editCtrl->SetFocus(); editCtrl->SetSel(0, -1); resizeEditCtrl(); }
void PopupMenuEditor::drawItems( QPainter * p ) { int flags = 0; int idx = 0; QColorGroup enabled = colorGroup(); QColorGroup disabled = palette().disabled(); QRect focus; QRect rect( borderSize, borderSize, width() - borderSize * 2, 0 ); PopupMenuEditorItem * i = itemList.first(); while ( i ) { if ( i->isVisible() ) { rect.setHeight( itemHeight( i ) ); if ( idx == currentIndex ) focus = rect; if ( i->action()->isEnabled() ) { flags = QStyle::Style_Enabled; p->setPen( enabled.buttonText() ); } else { flags = QStyle::Style_Default; p->setPen( disabled.buttonText() ); } drawItem( p, i, rect, flags ); rect.moveBy( 0, rect.height() ); } i = itemList.next(); idx++; } // Draw the "add item" and "add separator" items p->setPen( darkBlue ); rect.setHeight( itemHeight( &addItem ) ); if ( idx == currentIndex ) focus = rect; drawItem( p, &addItem, rect, QStyle::Style_Default ); rect.moveBy( 0, rect.height() ); idx++; rect.setHeight( itemHeight( &addSeparator ) ); if ( idx == currentIndex ) focus = rect; drawItem( p, &addSeparator, rect, QStyle::Style_Default ); idx++; if ( hasFocus() && !draggedItem ) drawWinFocusRect( p, focus ); }
/*! \internal This replaces the standard draw() as used in Item3D. In this instance all drawing carried out using \a painter follows the standard sequence. However, after the transforms for the item have been applied, a QGraphicsBillboardTransform is applied to the model-view matrix. After the current item is drawn the model-view matrix from immediately before the billboard transform being applied will be restored so child items are not affected by it. */ void BillboardItem3D::draw(QGLPainter *painter) { // Bail out if this item and its children have been disabled. if (!isEnabled()) return; if (!isInitialized()) initialize(painter); if (!m_bConnectedToOpenGLContextSignal) { QOpenGLContext* pOpenGLContext = QOpenGLContext::currentContext(); if (pOpenGLContext) { bool Ok = QObject::connect(pOpenGLContext, SIGNAL(aboutToBeDestroyed()), this, SLOT(handleOpenglContextIsAboutToBeDestroyed()), Qt::DirectConnection); Q_UNUSED(Ok); // quell compiler warning Q_ASSERT(Ok); m_bConnectedToOpenGLContextSignal = true; } } //Setup picking int prevId = painter->objectPickId(); painter->setObjectPickId(objectPickId()); //Setup effect (lighting, culling, effects etc) const QGLLightParameters *currentLight = 0; QMatrix4x4 currentLightTransform; drawLightingSetup(painter, currentLight, currentLightTransform); bool viewportBlend, effectBlend; drawEffectSetup(painter, viewportBlend, effectBlend); drawCullSetup(); //Local and Global transforms drawTransformSetup(painter); //After all of the other transforms, apply the billboard transform to //ensure forward facing. painter->modelViewMatrix().push(); QGraphicsBillboardTransform bill; bill.setPreserveUpVector(m_preserveUpVector); bill.applyTo(const_cast<QMatrix4x4 *>(&painter->modelViewMatrix().top())); //Drawing drawItem(painter); //Pop the billboard transform from the model-view matrix stack so that it //is not applied to child items. painter->modelViewMatrix().pop(); //Draw children drawChildren(painter); //Cleanup drawTransformCleanup(painter); drawLightingCleanup(painter, currentLight, currentLightTransform); drawEffectCleanup(painter, viewportBlend, effectBlend); drawCullCleanup(); //Reset pick id. painter->setObjectPickId(prevId); }
void MenuSystem::scrollSavegames(int delta) { int newPos = CLIP<int>(_savegameListTopIndex + delta, 0, _savegames.size() - 1); _savegameListTopIndex = newPos; restoreRect(80, 92, 440, 140); setSavegameCaptions(); for (int i = 1; i <= 7; i++) drawItem((ItemID)(kItemIdSavegame1 + i - 1), false); }
void drawDestinationItems() { int i; for (i = 0; i < numBItems; i++) drawItem( bItem[i].rect.left, bItem[i].rect.top, &bItem[i].label, true, settings.bItem == i + 1 ); }
void scrollMenu(MenuItem* itms, Adafruit_ST7735* tft, uint8_t curPos, uint8_t newPos){ MenuItem curItm = itms[curPos], newItm = itms[newPos]; tft->fillRect(0, curItm.position * MENU_SCALE, 128, MENU_SCALE, 0); drawItem(&curItm, tft); tft->fillRect(0, newItm.position * MENU_SCALE, 128, MENU_SCALE, MENU_HIGHLIGHTED); tft->setCursor(0, newItm.position * MENU_SCALE+MENU_SCALE/4); tft->print(newItm.name); }
void MenuSystem::setCfgText(bool value, bool active) { if (_cfgText != value) { Item *item = getItem(kItemIdToggleText); _cfgText = value; restoreRect(item->rect.left, item->rect.top, item->rect.width() + 1, item->rect.height() - 2); setItemCaption(item, _vm->getSysString(_cfgText ? kStrTextOn : kStrTextOff)); drawItem(kItemIdToggleText, true); } }
void MenuSystem::setCfgVoices(bool value, bool active) { if (_cfgVoices != value) { Item *item = getItem(kItemIdToggleVoices); _cfgVoices = value; restoreRect(item->rect.left, item->rect.top, item->rect.width() + 1, item->rect.height() - 2); setItemCaption(item, _vm->getSysString(_cfgVoices ? kStrVoicesOn : kStrVoicesOff)); drawItem(kItemIdToggleVoices, true); } }
void MenuSystem::enableItem(ItemID id) { Item *item = getItem(id); if (item) { item->enabled = true; drawItem(id, false); _currItemID = kItemIdNone; Common::Point mousePos = _vm->_system->getEventManager()->getMousePos(); handleMouseMove(mousePos.x, mousePos.y); } }
void ItemRenderSystem::render(SDL_Surface *display) { EntityManager &em = EntityManager::instance(); std::vector<GameObject> items; em.getEntitiesWithComponent<ItemComponent>(items); std::vector<GameObject>::iterator it = items.begin(); for (; it != items.end(); ++it) { drawItem(display, *it); } }
void ItemWindow::draw(bool cursor, bool infowinText) { SelectableWindow::draw(cursor); if(infowinText && m_pos < m_inventory->nbItems()) m_infoWindow->drawTextScaled(m_inventory->getItem(m_pos)->description()); else m_infoWindow->drawTextScaled(" "); for(u8 i = 0 ; i < m_inventory->nbItems() ; i++) { drawItem(i); } }
void drawArithmeticItems() { int i; Boolean listEnabled; listEnabled = (gCurrentExample / 10 == arithmeticID); for (i = 0; i < numAItems; i++) drawItem( aItem[i].rect.left, aItem[i].rect.top, &aItem[i].label, listEnabled, settings.aItem == i + 1 ); }
void drawPaintBucketItems() { int i; Boolean listEnabled; listEnabled = false; for (i = 0; i < numPItems; i++) drawItem( pItem[i].rect.left, pItem[i].rect.top, &pItem[i].label, listEnabled, settings.pItem == i + 1 ); }
void drawColorizeItems() { int i; Boolean listEnabled; listEnabled = (gCurrentExample / 10 == colorizationID || gCurrentExample / 10 == customID); for (i = 0; i < numCItems; i++) drawItem( cItem[i].rect.left, cItem[i].rect.top, &cItem[i].label, listEnabled, settings.cItem == i + 1 ); }
void drawMenu(MenuItem* itms, Adafruit_ST7735* tft, uint8_t numItems){ tft->fillScreen(0); tft->fillRect(0, itms[0].position * MENU_SCALE, 128, MENU_SCALE, MENU_HIGHLIGHTED); tft->setCursor(0, itms[0].position * MENU_SCALE+MENU_SCALE/4); tft->print(itms[0].name); if (numItems > 1){ for (uint8_t i = 1; i < numItems; i++){ drawItem(&itms[i], tft); } } }
void drawDitherItems() { int i; Boolean listEnabled; listEnabled = (gCurrentExample / 10 == ditherID || gCurrentExample / 10 == customID); for (i = 0; i < numDItems; i++) drawItem( dItem[i].rect.left, dItem[i].rect.top, &dItem[i].label, listEnabled, settings.dItem == i + 1 ); }
void drawMappingItems() { int i; Boolean listEnabled; listEnabled = (gCurrentExample / 10 == searchProcID || gCurrentExample / 10 == customID); for (i = 0; i < numMItems; i++) drawItem( mItem[i].rect.left, mItem[i].rect.top, &mItem[i].label, listEnabled, settings.mItem == i + 1 ); }
void drawLassoToolItems() { int i; Boolean listEnabled; listEnabled = false; for (i = 0; i < numLItems; i++) drawItem( lItem[i].rect.left, lItem[i].rect.top, &lItem[i].label, listEnabled, settings.lItem == i + 1 ); }
void TouchScreenMenu::drawItem(TouchScreenMenuItem *item, bool pressed){ if(item==NULL) return; int index = 0; while(1){ if(strcmp(_items[index].getText(),item->getText())==0){ drawItem(index,pressed); return; } index++; } }
void CommandWindow::draw(bool cursor) { SelectableWindow::draw(cursor); for(u8 i = 0 ; i < m_itemMax ; i++) { if(!m_horizontal && !m_centered) { drawItem(i); } else { drawHorizontalCenteredItem(i); } } }