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


C++ Parent函数代码示例

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


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

示例1: Parent

/*--------------------------------------------------------------------------*/
void PegGroup::Draw(void)
{
    #ifdef PEG_UNICODE
    PEGCHAR cTest[2] = {'E', '\0'};
    #else
    PEGCHAR cTest[] = "E";
    #endif

    if (Parent())
    {
        muColors[PCI_NORMAL] = Parent()->muColors[PCI_NORMAL];
    }
    BeginDraw();

    PegColor Color(muColors[PCI_NORMAL], muColors[PCI_NORMAL], CF_FILL);
    Rectangle(mClient, Color, 0);

    Color.Set(PCLR_LOWLIGHT, PCLR_LOWLIGHT, CF_NONE);
    
    Color.uForeground = PCLR_LOWLIGHT;
    SIGNED iTextLeft = mReal.wLeft + TextWidth(cTest, mpFont);
    SIGNED iTextRight = iTextLeft + TextWidth(mpText, mpFont) + 4;

    if(mpText)
    {
        Line(mReal.wLeft, mClient.wTop - 2, iTextLeft,
            mClient.wTop - 2, Color);
        Line(iTextRight, mClient.wTop - 2, mReal.wRight,
            mClient.wTop - 2, Color);
    }
    else
    {
        Line(mReal.wLeft, mClient.wTop - 2, mReal.wRight,
             mClient.wTop - 2, Color);
    }
    Line(mReal.wLeft, mClient.wTop - 1, mReal.wLeft,
        mReal.wBottom, Color);
    Line(mReal.wLeft + 1, mReal.wBottom - 1,
        mReal.wRight - 1, mReal.wBottom - 1, Color);
    Line(mReal.wRight - 1, mClient.wTop - 2,
        mReal.wRight - 1, mReal.wBottom - 1, Color);

    Color.uForeground = PCLR_HIGHLIGHT;
    if(mpText)
    {
        Line(mReal.wLeft + 1, mClient.wTop - 1, iTextLeft,
            mClient.wTop - 1, Color);
        Line(iTextRight, mClient.wTop - 1, mReal.wRight - 2,
            mClient.wTop - 1, Color);
    }
    else
    {
        Line(mReal.wLeft + 1, mClient.wTop - 1, mReal.wRight - 2,
             mClient.wTop - 1, Color);
    }
    Line(mReal.wLeft + 1, mClient.wTop, mReal.wLeft + 1,
        mReal.wBottom - 1, Color);
    Line(mReal.wLeft, mReal.wBottom, mReal.wRight,
        mReal.wBottom, Color);
    Line(mReal.wRight, mClient.wTop - 2, mReal.wRight,
        mReal.wBottom, Color);

    if(mpText)
    {
        if (mwStyle & AF_ENABLED)
        {
            Color.uForeground = muColors[PCI_NTEXT];
        }
        else
        {
            Color.uForeground = PCLR_LOWLIGHT;
        }
        PegPoint Put;
        Put.x = iTextLeft + 2;
        Put.y = mReal.wTop;

        DrawText(Put, mpText, Color, mpFont);
    }

    PegThing::Draw();       // to draw children
    EndDraw();
}
开发者ID:garyqinyu,项目名称:abv,代码行数:83,代码来源:pgroup.cpp

示例2: GetParent

 CTaxon1Node*          GetParent()
 {
     return static_cast<CTaxon1Node*>(Parent());
 }
开发者ID:swuecho,项目名称:igblast,代码行数:4,代码来源:cache.hpp

示例3: Parent

float IGradientModificationStrategy::QValue(int i, int j) {
    return Parent()->QValue(i, j);
}
开发者ID:rizar,项目名称:svs,代码行数:3,代码来源:newsvm.cpp

示例4: Parent

void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
{
    static wxFileName fn;                 // Remember path between saves during this session only.
    wxString          FullFileName;
    wxString          file_ext, mask;
    bool              fmt_is_jpeg = false;

    // First time path is set to the project path.
    if( !fn.IsOk() )
        fn = Parent()->Prj().GetProjectFullName();

    if( event.GetId() == ID_MENU_SCREENCOPY_JPEG )
        fmt_is_jpeg = true;

    if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
    {
        file_ext     = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
        mask         = wxT( "*." ) + file_ext;
        fn.SetExt( file_ext );

        FullFileName = EDA_FileSelector( _( "3D Image File Name:" ), fn.GetPath(),
                                         fn.GetFullName(), file_ext, mask, this,
                                         wxFD_SAVE | wxFD_OVERWRITE_PROMPT, true );

        if( FullFileName.IsEmpty() )
            return;

        fn = FullFileName;

        // Be sure the screen area destroyed by the file dialog is redrawn before making
        // a screen copy.
        // Without this call, under Linux the screen refresh is made to late.
        wxYield();
    }

    struct viewport_params
    {
        GLint originx;
        GLint originy;
        GLint x;
        GLint y;
    } viewport;

    // Be sure we have the latest 3D view (remember 3D view is buffered)
    Refresh();
    wxYield();

    // Build image from the 3D buffer
    wxWindowUpdateLocker noUpdates( this );
    glGetIntegerv( GL_VIEWPORT, (GLint*) &viewport );

    unsigned char*       pixelbuffer = (unsigned char*) malloc( viewport.x * viewport.y * 3 );
    unsigned char*       alphabuffer = (unsigned char*) malloc( viewport.x * viewport.y );
    wxImage image( viewport.x, viewport.y );

    glPixelStorei( GL_PACK_ALIGNMENT, 1 );
    glReadBuffer( GL_BACK_LEFT );
    glReadPixels( viewport.originx, viewport.originy,
                  viewport.x, viewport.y,
                  GL_RGB, GL_UNSIGNED_BYTE, pixelbuffer );
    glReadPixels( viewport.originx, viewport.originy,
                  viewport.x, viewport.y,
                  GL_ALPHA, GL_UNSIGNED_BYTE, alphabuffer );

    image.SetData( pixelbuffer );
    image.SetAlpha( alphabuffer );
    image = image.Mirror( false );
    wxBitmap bitmap( image );

    if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
    {
        if( wxTheClipboard->Open() )
        {
            wxBitmapDataObject* dobjBmp = new wxBitmapDataObject( bitmap );

            if( !wxTheClipboard->SetData( dobjBmp ) )
                wxMessageBox( _( "Failed to copy image to clipboard" ) );

            wxTheClipboard->Flush();    /* the data in clipboard will stay
                                         * available after the application exits */
            wxTheClipboard->Close();
        }
    }
    else
    {
        wxImage image = bitmap.ConvertToImage();

        if( !image.SaveFile( FullFileName,
                             fmt_is_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) )
            wxMessageBox( _( "Can't save file" ) );

        image.Destroy();
    }
}
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:94,代码来源:3d_canvas.cpp

示例5: Parent

INFO3D_VISU& EDA_3D_CANVAS::GetPrm3DVisu() const
{
    return Parent()->GetPrm3DVisu();
}
开发者ID:natsfr,项目名称:kicad,代码行数:4,代码来源:3d_draw_helper_functions.cpp

示例6: write_port

// Update
void
ColorSlider::Update(int depth)
{
	// depth: 0 = onscreen only, 1 = bitmap 1, 2 = bitmap 0
	if (depth == 2) {
		write_port(fUpdatePort, MSG_UPDATE, NULL, 0);
		return;
	}

	if (!Parent())
		return;
	
	fBgBitmap->Lock();

//	BRect r(fBgView->Bounds());
	BRect r(Bounds());
	BRect bounds(r);
	if (fOrientation == B_VERTICAL) {
//		r.OffsetBy(-8.0, -2.0);
		r.InsetBy(6.0, 3.0);
//		bounds.Set(-8.0, -2.0, r.right - 8.0, r.bottom - 2.0);
//		bounds.OffsetBy(8.0, 2.0);
	} else {
//		r.OffsetBy(-2.0, -2.0);
//		bounds.Set(-2.0, -2.0, r.right - 2.0, r.bottom - 2.0);
//		bounds.OffsetBy(2.0, 2.0);
	}

	fBgBitmap->Unlock();

	rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR);
	rgb_color shadow = tint_color(background, B_DARKEN_1_TINT);
	rgb_color darkShadow = tint_color(background, B_DARKEN_3_TINT);
	rgb_color light = tint_color(background, B_LIGHTEN_MAX_TINT);

	if (depth >= 1) {

		fBgBitmap->Lock();
	

		// frame
		stroke_frame(fBgView, r, shadow, shadow, light, light);
		r.InsetBy(1.0, 1.0);
		stroke_frame(fBgView, r, darkShadow, darkShadow, background, background);

		if (fOrientation == B_VERTICAL) {
			// clear area left and right from slider
			fBgView->SetHighColor( background );
			fBgView->FillRect( BRect(bounds.left, bounds.top, bounds.left + 5.0, bounds.bottom) );
			fBgView->FillRect( BRect(bounds.right - 5.0, bounds.top, bounds.right, bounds.bottom) );
		}
/*
		// marker
		if (fOrientation == B_VERTICAL) {
			// clear area left and right from slider
			fBgView->SetHighColor( background );
			fBgView->FillRect( BRect(bounds.left, bounds.top, bounds.left + 5.0, bounds.bottom) );
			fBgView->FillRect( BRect(bounds.right - 5.0, bounds.top, bounds.right, bounds.bottom) );
			// draw the triangle markers
			fBgView->SetHighColor( 0, 0, 0 );
			float value = Value();
			fBgView->StrokeLine( BPoint(bounds.left, value - 2.0), BPoint(bounds.left + 5.0, value + 3.0));
			fBgView->StrokeLine( BPoint(bounds.left, value + 8.0));
			fBgView->StrokeLine( BPoint(bounds.left, value - 2.0));
	
			fBgView->StrokeLine( BPoint(bounds.right, value - 2.0), BPoint(bounds.right - 5.0, value + 3.0));
			fBgView->StrokeLine( BPoint(bounds.right, value + 8.0));
			fBgView->StrokeLine( BPoint(bounds.right, value - 2.0));
		} else {
			r.InsetBy(1.0, 1.0);
			float value = (Value() / 255.0) * (bounds.Width() - 4.0);
			if (value - 2 > r.left) {
				fBgView->SetHighColor( 255, 255, 255 );
				fBgView->StrokeLine( BPoint(value - 2, bounds.top + 2.0),
									 BPoint(value - 2, bounds.bottom - 2.0));
			}
			if (value - 1 > r.left) {
				fBgView->SetHighColor( 0, 0, 0 );
				fBgView->StrokeLine( BPoint(value - 1, bounds.top + 2.0),
									 BPoint(value - 1, bounds.bottom - 2.0));
			}
			if (value + 1 < r.right) {
				fBgView->SetHighColor( 0, 0, 0 );
				fBgView->StrokeLine( BPoint(value + 1, bounds.top + 2.0),
									 BPoint(value + 1, bounds.bottom - 2.0));
			}
			if (value + 2 < r.right) {
				fBgView->SetHighColor( 255, 255, 255 );
				fBgView->StrokeLine( BPoint(value + 2, bounds.top + 2.0),
									 BPoint(value + 2, bounds.bottom - 2.0));
			}
		}*/

		fBgView->Sync();

		fBgBitmap->Unlock();
	} else
		r.InsetBy(1.0, 1.0);

//.........这里部分代码省略.........
开发者ID:stippi,项目名称:Clockwerk,代码行数:101,代码来源:ColorSlider.cpp

示例7: SetViewColor

void IconsView::AttachedToWindow() {
	if( Parent() )
		SetViewColor( Parent()->ViewColor() );
	else
		SetViewColor( 255, 255, 255 );
}
开发者ID:louisdem,项目名称:beos-begadu,代码行数:6,代码来源:Description.cpp

示例8: SetViewColor

void
_MediaSlider_::AttachedToWindow()
{
	SetViewColor(Parent()->ViewColor());
}
开发者ID:HaikuArchives,项目名称:VirtualBeLive,代码行数:5,代码来源:MediaSlider.cpp

示例9: getPayload

void FarDlgNode::BeforeLoad()
{
  getPayload().setDialog(Parent()->getPayload().getDialog());
}
开发者ID:Release,项目名称:filecopyex3,代码行数:4,代码来源:FarNode.cpp

示例10: pushParent

void RenderTreeUpdater::pushParent(Element& element, Style::Change changeType)
{
    m_parentStack.append(Parent(element, changeType));

    updateBeforeOrAfterPseudoElement(element, BEFORE);
}
开发者ID:edcwconan,项目名称:webkit,代码行数:6,代码来源:RenderTreeUpdater.cpp

示例11: SetViewColor

void
ConnectionOptionsView::AttachedToWindow()
{
	SetViewColor(Parent()->ViewColor());
	fDialOnDemand->SetTarget(this);
}
开发者ID:mariuz,项目名称:haiku,代码行数:6,代码来源:ConnectionOptionsAddon.cpp

示例12: Parent

// ----------------------------------------------------------------------------
//
// ----------------------------------------------------------------------------
void ConfigGroup::SetDirty()
{
  m_bDirty = TRUE;
  if ( Parent() != NULL )             // propagate upwards
    Parent()->SetDirty();
}
开发者ID:TimofonicJunkRoom,项目名称:plucker,代码行数:9,代码来源:fileconf.cpp

示例13: Parent

void
PowerStatusView::Draw(BRect updateRect)
{
	bool drawBackground = Parent() == NULL
		|| (Parent()->Flags() & B_DRAW_ON_CHILDREN) == 0;
	if (drawBackground)
		FillRect(updateRect, B_SOLID_LOW);

	float aspect = Bounds().Width() / Bounds().Height();
	bool below = aspect <= 1.0f;

	font_height fontHeight;
	GetFontHeight(&fontHeight);
	float baseLine = ceilf(fontHeight.ascent);

	char text[64];
	_SetLabel(text, sizeof(text));

	float textHeight = ceilf(fontHeight.descent + fontHeight.ascent);
	float textWidth = StringWidth(text);
	bool showLabel = fShowLabel && text[0];

	BRect iconRect;

	if (fShowStatusIcon) {
		iconRect = Bounds();
		if (showLabel) {
			if (below)
				iconRect.bottom -= textHeight + 4;
			else
				iconRect.right -= textWidth + 4;
		}

		// make a square
		iconRect.bottom = min_c(iconRect.bottom, iconRect.right);
		iconRect.right = iconRect.bottom;

		if (iconRect.Width() + 1 >= kMinIconWidth
			&& iconRect.Height() + 1 >= kMinIconHeight) {
			_DrawBattery(iconRect);
		} else {
			// there is not enough space for the icon
			iconRect.Set(0, 0, -1, -1);
		}
	}

	if (showLabel) {
		BPoint point(0, baseLine);

		if (iconRect.IsValid()) {
			if (below) {
				point.x = (iconRect.Width() - textWidth) / 2;
				point.y += iconRect.Height() + 2;
			} else {
				point.x = iconRect.Width() + 2;
				point.y += (iconRect.Height() - textHeight) / 2;
			}
		} else {
			point.x = (Bounds().Width() - textWidth) / 2;
			point.y += (Bounds().Height() - textHeight) / 2;
		}

		if (drawBackground)
			SetHighColor(ui_color(B_CONTROL_TEXT_COLOR));
		else {
			SetDrawingMode(B_OP_OVER);
			rgb_color c = Parent()->LowColor();
			if (c.red + c.green + c.blue > 128 * 3)
				SetHighColor(0, 0, 0);
			else
				SetHighColor(255, 255, 255);
		}

		DrawString(text, point);
	}
}
开发者ID:RTOSkit,项目名称:haiku,代码行数:76,代码来源:PowerStatusView.cpp

示例14: SetViewColor

void
IPCPView::AttachedToWindow()
{
	SetViewColor(Parent()->ViewColor());
	fIsEnabled->SetTarget(this);
}
开发者ID:mariuz,项目名称:haiku,代码行数:6,代码来源:IPCPAddon.cpp

示例15: AttachedToWindow

void ArpTwoStateButton::AttachedToWindow()
{
	inherited::AttachedToWindow();
	if( Parent() ) SetViewColor( Parent()->ViewColor() );
}
开发者ID:HaikuArchives,项目名称:Sequitur,代码行数:5,代码来源:ArpTwoStateButton.cpp


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