当前位置: 首页>>代码示例>>C++>>正文


C++ drawItem函数代码示例

本文整理汇总了C++中drawItem函数的典型用法代码示例。如果您正苦于以下问题:C++ drawItem函数的具体用法?C++ drawItem怎么用?C++ drawItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了drawItem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: drawItem

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));

                }
            }
        }
    }

}
开发者ID:ElegantCodeFTW,项目名称:GUI,代码行数:33,代码来源:ProcessorList.cpp

示例2: drawCanvas

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
	{
开发者ID:OpenGanesh,项目名称:oom,代码行数:56,代码来源:canvas.cpp

示例3: drawItem

Boolean DrawHandler::draw(IListBoxDrawItemEvent& event, DrawFlag& flag)
{
  if(event.isSelected())
  {
    flag = drewSelected;
    return drawItem(event, true);
  }
    else
      return drawItem(event, false);
}
开发者ID:OS2World,项目名称:DEV-SAMPLES-CPP-OS2-CPP-Class_Lib,代码行数:10,代码来源:LISTDHDR.CPP

示例4: onDraw

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    
  }
}
开发者ID:Sowhat2112,项目名称:KreyosFirmware,代码行数:59,代码来源:today.c

示例5: drawItem

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);
}
开发者ID:bekasov,项目名称:SoftPixelEngine,代码行数:33,代码来源:spGUIListGadget.cpp

示例6: line

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();
}
开发者ID:Gira-X,项目名称:minitube,代码行数:31,代码来源:channelitemdelegate.cpp

示例7: drawItem

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());
}
开发者ID:Th30n,项目名称:into-the-dungeon,代码行数:26,代码来源:ItemRenderSystem.cpp

示例8: p

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 ) );

}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:27,代码来源:xQGanttBarViewPort.cpp

示例9: p

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();
}
开发者ID:Karmiska,项目名称:Darkness,代码行数:27,代码来源:AssetDecodePopup.cpp

示例10: onEditCanceled

/*
 * 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();
}
开发者ID:BackupTheBerlios,项目名称:sfsipua-svn,代码行数:33,代码来源:OutBarCtrl.cpp

示例11: colorGroup

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 );
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:47,代码来源:popupmenueditor.cpp

示例12: draw

/*!
    \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);
}
开发者ID:Distrotech,项目名称:qt3d,代码行数:69,代码来源:billboarditem3d.cpp

示例13: restoreRect

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);
}
开发者ID:megaboy,项目名称:scummvm,代码行数:8,代码来源:menu.cpp

示例14: drawDestinationItems

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 );
}
开发者ID:fruitsamples,项目名称:QuickDraw_FX,代码行数:8,代码来源:main.c

示例15: scrollMenu

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);
}
开发者ID:JaydenD,项目名称:project,代码行数:9,代码来源:menu.cpp


注:本文中的drawItem函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。