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


C++ GetArea函数代码示例

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


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

示例1: GetArea

QString MythUIText::cutDown(const QString &data, MythFontProperties *font,
                            bool multiline)
{
    int length = data.length();
    if (length == 0)
        return data;

    int maxwidth = GetArea().width();
    int maxheight = GetArea().height();
    int justification = Qt::AlignLeft | Qt::TextWordWrap;
    QFontMetrics fm(font->face());

    int margin = length - 1;
    int index = 0;
    int diff = 0;

    while (margin > 0)
    {
        if (multiline)
            diff = maxheight - fm.boundingRect(0, 0, maxwidth, maxheight,
                                               justification,
                                               data.left(index + margin + 1)
                                               ).height();
        else
            diff = maxwidth - fm.width(data, index + margin + 1);
        if (diff >= 0)
            index += margin;

        margin /= 2;

        if (index + margin >= length - 1)
            margin = (length - 1) - index;
    }

    if (index < length - 1)
    {
        QString tmpStr(data);
        tmpStr.truncate(index);
        if (index >= 3)
            tmpStr.replace(index - 3, 3, "...");
        return tmpStr;
    }

    return data;

}
开发者ID:footoflove,项目名称:libmythtv-ui,代码行数:46,代码来源:mythuitext.cpp

示例2: GetArea

/** \brief Return the first MythUIType at the given coordinates
 *
 *  \param p QPoint coordinates
 *  \param recursive Whether to perform a recursive search
 *  \param focusable Only consider widgets that are focusable.
 *
 *  \return The widget at these coordinates
 */
MythUIType *MythUIType::GetChildAt(const QPoint &p, bool recursive,
                                   bool focusable) const
{
    if (GetArea().contains(p))
    {
        if (!IsVisible() || !IsEnabled())
            return nullptr;

        if (m_ChildrenList.isEmpty())
            return nullptr;

        /* check all children */
        QList<MythUIType *>::const_iterator it;

        for (it = m_ChildrenList.end() - 1; it != m_ChildrenList.begin() - 1; --it)
        {
            if (!(*it))
                continue;

            // If this point doesn't fall within the child's area then move on
            // This requires that the area is actually accurate and in some
            // cases this still isn't true
            if (!(*it)->GetArea().contains(p - GetArea().topLeft()))
                continue;


            MythUIType *child = *it;

            if (recursive && (focusable && !child->CanTakeFocus()))
                child = child->GetChildAt(p - GetArea().topLeft(), recursive,
                                          focusable);

            if (child)
            {
                // NOTE: Assumes no selectible ui type will contain another
                // selectible ui type.
                if (focusable && !child->CanTakeFocus())
                    continue;

                return child;
            }
        }
    }

    return nullptr;
}
开发者ID:garybuhrmaster,项目名称:mythtv,代码行数:54,代码来源:mythuitype.cpp

示例3: GetArea

void InfoItem::Draw(HDC hDC,ePipeline* Pipe /*=Pipe*/){

    RECT rc = GetArea();
	COLORREF Oldcr = ::SetTextColor(hDC,RGB(0,255,0));
	::DrawText(hDC,m_Text.c_str(),m_Text.size(),&rc,DT_LEFT|DT_EXPANDTABS|
			DT_NOPREFIX|DT_VCENTER);	
	::SetTextColor(hDC,Oldcr);	
}
开发者ID:GMIS,项目名称:GMIS,代码行数:8,代码来源:WorldLog.cpp

示例4: GetPerimeter

std::string CTriangle::ToString() const
{
	std::stringstream stream;
	stream << "Triangle <<" << m_firstVertex.GetX() << "," << m_firstVertex.GetY() << ">";
	stream << "<" << m_secondVertex.GetX() << "," << m_secondVertex.GetY() << ">";
	stream << "<" << m_thirdVertex.GetX() << "," << m_thirdVertex.GetY() << ">>";
	stream << ", Perimeter=" << GetPerimeter() << ", Area=" << GetArea();
	return stream.str();
}
开发者ID:irina-yambatrova,项目名称:OOP,代码行数:9,代码来源:Triangle.cpp

示例5: GetDescription

string CIncomingFriendList :: GetDescription( )
{
	string Description;
	Description += GetAccount( ) + "\n";
	Description += ExtractStatus( GetStatus( ) ) + "\n";
	Description += ExtractArea( GetArea( ) ) + "\n";
	Description += ExtractLocation( GetLocation( ) ) + "\n\n";
	return Description;
}
开发者ID:RiseCakoPlusplus,项目名称:brtGHost,代码行数:9,代码来源:bnetprotocol.cpp

示例6: GetArea

/** \brief Return the first MythUIType which accepts focus found at the given
 *         coordinates
 *
 *  \param p QPoint coordinates
 *  \param recursive Whether to perform a recursive search
 *
 *  \return The widget at these coordinates
 */
MythUIType *MythUIType::GetChildAt(const QPoint &p, bool recursive,
                                   bool focusable) const
{
    if (GetArea().contains(p))
    {
        if (!IsVisible() || !IsEnabled())
            return NULL;

        if (m_ChildrenList.isEmpty())
            return NULL;

        /* check all children */
        QList<MythUIType *>::const_iterator it;

        for (it = m_ChildrenList.end() - 1; it != m_ChildrenList.begin() - 1; --it)
        {
            if (!(*it))
                continue;

            MythUIType *child = NULL;


            if ((*it)->GetArea().contains(p - GetArea().topLeft()))
                child = *it;

            if (!child && recursive)
                child = (*it)->GetChildAt(p - GetArea().topLeft(), recursive,
                                          focusable);

            if (child)
            {
                // NOTE: Assumes no selectible ui type will contain another
                // selectible ui type.
                if (focusable && !child->CanTakeFocus())
                    continue;

                return child;
            }
        }
    }

    return NULL;
}
开发者ID:gdenning,项目名称:mythtv,代码行数:51,代码来源:mythuitype.cpp

示例7: GetArea

void MythUISimpleText::DrawSelf(MythPainter *p, int xoffset, int yoffset,
                                int alphaMod, QRect clipRect)
{
    QRect area = GetArea().toQRect();
    area.translate(xoffset, yoffset);

    int alpha = CalcAlpha(alphaMod);

    p->SetClipRect(clipRect);
    p->DrawText(area, m_Message, m_Justification, m_Font, alpha, area);
}
开发者ID:tomhughes,项目名称:mythtv,代码行数:11,代码来源:mythuisimpletext.cpp

示例8: GetArea

void CMemoryView::CTitle::Draw(HDC hDC,ePipeline* Pipe ){
	//输出文字
    RECT rc = GetArea();
	
	COLORREF Oldcr = ::SetTextColor(hDC,RGB(0,0,0));
	tstring s = Format1024(_T("%s		(%3d) "),m_Text.c_str(),m_ChildList.size());
	::DrawText(hDC,s.c_str(),s.size(),&rc,DT_LEFT|DT_EXPANDTABS|
		DT_NOPREFIX|DT_VCENTER);
	
	::SetTextColor(hDC,Oldcr);
	
}
开发者ID:GMIS,项目名称:GMIS,代码行数:12,代码来源:MemoryView.cpp

示例9: visible

void Damage::DrawAreas () {
    BoxObj visible(0, 0, _canvas->Width() - 1, _canvas->Height() - 1);
    BoxObj b, *a;
    Iterator i;

    for (FirstArea(i); !Done(i); Next(i)) {
        a = GetArea(i);
        b = *a - visible;
	_output->ClearRect(_canvas, b._left, b._bottom, b._right, b._top);
	_graphic->DrawClipped(_canvas, b._left, b._bottom, b._right, b._top);
    }
}    
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:12,代码来源:damage.c

示例10: Show

void MythUIScrollBar::CalculatePosition(void)
{
    if (m_maximum > 0)
        Show();
    else
    {
        Hide();
        return;
    }

    MythUIType *slider = GetChild("slider");

    if (!slider)
    {
        LOG(VB_GENERAL, LOG_ERR, "Slider element doesn't exist");
        return;
    }

    float percentage = (float)m_sliderPosition / m_maximum;
    float relativeSize = (float)m_pageStep / (m_maximum + m_pageStep);

    MythRect newSliderArea = slider->GetArea();
    MythRect fillArea = GetArea();
    QPoint endPos(newSliderArea.left(), newSliderArea.top());

    if (m_layout == LayoutHorizontal)
    {
        int width = qMax((int)(fillArea.width() * relativeSize + 0.5),
                         m_sliderArea.width());
        newSliderArea.setWidth(width);
        endPos.setX((int)((fillArea.width() - width) * percentage + 0.5));
    }
    else
    {
        int height = qMax((int)(fillArea.height() * relativeSize + 0.5),
                          m_sliderArea.height());
        newSliderArea.setHeight(height);
        endPos.setY((int)((fillArea.height() - height) * percentage + 0.5));
    }

    slider->SetArea(newSliderArea);
    slider->SetPosition(endPos);

    if (m_hideDelay > 0)
    {
        if (m_timerId)
            killTimer(m_timerId);
        m_timerId = startTimer(m_hideDelay);

        AdjustAlpha(1, 10, 0, 255);
    }
}
开发者ID:JGunning,项目名称:OpenAOL-TV,代码行数:52,代码来源:mythuiscrollbar.cpp

示例11: FillRect

void CLogicView::CRefItem::Draw(HDC hDC, ePipeline* Pipe){
	FillRect(hDC,GetArea(),SS.crTaskMassBk);
	if(m_State & SPACE_FOCUSED){
		DrawEdge(hDC,GetArea(),RGB(192,192,255));
	}
	
	COLORREF crOld = SetTextColor(hDC,SS.crBrainViewItemText);
	
	RECT rc = GetArea();
	rc.right  = rc.left + 80;
	rc.bottom = rc.top  + 18;
	rc.left +=2;
	
	//被引用名
	::DrawText(hDC,m_RefName.c_str(),m_RefName.size(),&rc,DT_END_ELLIPSIS|DT_LEFT|DT_SINGLELINE|DT_VCENTER);
	
	//引用者名
	rc.left = rc.right; rc.right +=100 ;
	::DrawText(hDC,m_WhoRef.c_str(),m_WhoRef.size(),&rc,DT_END_ELLIPSIS|DT_LEFT|DT_SINGLELINE|DT_VCENTER);	
	
	SetTextColor(hDC,crOld);
};
开发者ID:GMIS,项目名称:GMIS,代码行数:22,代码来源:LogicView.cpp

示例12: GetArea

void CGFrameArea::Update (void)

//	Update
//
//	Update the area

	{
	for (int i = 0; i < GetAreaCount(); i++)
		{
		AGArea *pArea = GetArea(i);
		pArea->Update();
		}
	}
开发者ID:bmer,项目名称:Alchemy,代码行数:13,代码来源:CGFrameArea.cpp

示例13: GetRadius

std::string CCircle::ToString() const
{
	std::stringstream ss;
	ss << std::fixed << std::setprecision(2) << "circle <" << 
		m_center.GetPosition().first << ", " << 
		m_center.GetPosition().second << ">, R = " << 
		GetRadius() << ", S = " << 
		GetArea() << ", P = " << 
		GetPerimeter() << ", " << 
		m_outlineColor << ", " << 
		m_fillColor;
	return ss.str();
}
开发者ID:dlxgit,项目名称:OOP,代码行数:13,代码来源:CCircle.cpp

示例14: SetFadeIn

void CBaseJungle::Init()
{
	//---------------------------------------------------------------------------
	//初期化
	//---------------------------------------------------------------------------
	SetFadeIn();

	Sint32 col1 =  0xF0408080;
	Sint32 col2 =  0xF0808040;
	pGame->pBg->SetSkyColor(50,col1,col2);

	viiSub::SetScroll_l( GetTargetPlayer()->x , GetTargetPlayer()->y );

	//---------------------------------------------------------------------------
	//ファイル初期化
	//---------------------------------------------------------------------------
//	LoadTexture( enTexPageSoldier , "HoundData\\enemychara\\common\\ene_soldier.bmp",0xff00ff00);
//	UploadTexture();

	//---------------------------------------------------------------------------
	//エリア初期化
	//---------------------------------------------------------------------------

	switch(GetArea( )){
	case enAreaSeq01:
		LoadConfig( "HoundData\\[email protected]" );
		viiSub::SetScroll_l( GetTargetPlayer()->x , GetTargetPlayer()->y );
//		viiMus::ReadBGM( 0,"HoundData\\bgm\\A\\A3_Bgm1.ogg");
		viiMus::PlayBGM(enSoundBgm1,enMusicBgmStageA);
//		LoadConfig( "HoundData\\[email protected]" );
//		LoadConfig( "HoundData\\[email protected]" );
//		LoadConfig( "HoundData\\[email protected]" );
//		LoadConfig( "HoundData\\[email protected]" );
		break;

	case enAreaSeq02:
		break;

	case enAreaSeq03:
		break;

	case enAreaSeq04:
		break;

	case enAreaSeq05:
		break;
	}

	InitEnemies();

}
开发者ID:programmerMOT,项目名称:gunhound,代码行数:51,代码来源:CBaseJungle.cpp

示例15: GetArea

void BOARD::ConvertBrdLayerToPolygonalContours( PCB_LAYER_ID aLayer, SHAPE_POLY_SET& aOutlines )
{
    // convert tracks and vias:
    for( TRACK* track = m_Track; track != NULL; track = track->Next() )
    {
        if( !track->IsOnLayer( aLayer ) )
            continue;

        track->TransformShapeWithClearanceToPolygon( aOutlines, 0 );
    }

    // convert pads
    for( MODULE* module = m_Modules; module != NULL; module = module->Next() )
    {
        module->TransformPadsShapesWithClearanceToPolygon( aLayer, aOutlines, 0 );

        // Micro-wave modules may have items on copper layers
        module->TransformGraphicShapesWithClearanceToPolygonSet( aLayer, aOutlines, 0 );
    }

    // convert copper zones
    for( int ii = 0; ii < GetAreaCount(); ii++ )
    {
        ZONE_CONTAINER* zone = GetArea( ii );
        PCB_LAYER_ID        zonelayer = zone->GetLayer();

        if( zonelayer == aLayer )
            zone->TransformSolidAreasShapesToPolygonSet( aOutlines );
    }

    // convert graphic items on copper layers (texts)
    for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
    {
        if( !item->IsOnLayer( aLayer ) )
            continue;

        switch( item->Type() )
        {
        case PCB_LINE_T:
            ( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon( aOutlines, 0 );
            break;

        case PCB_TEXT_T:
            ( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet( aOutlines, 0 );
            break;

        default:
            break;
        }
    }
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:51,代码来源:board_items_to_polygon_shape_transform.cpp


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