• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ChildAt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: if

status_t
BDragger::_DetermineRelationship()
{
	if (fTarget) {
		if (fTarget == Parent())
			fRelation = TARGET_IS_PARENT;
		else if (fTarget == ChildAt(0))
			fRelation = TARGET_IS_CHILD;
		else
			fRelation = TARGET_IS_SIBLING;
	} else {
		if (fRelation == TARGET_IS_PARENT)
			fTarget = Parent();
		else if (fRelation == TARGET_IS_CHILD)
			fTarget = ChildAt(0);
		else
			return B_ERROR;
	}

	if (fRelation == TARGET_IS_PARENT) {
		BRect bounds (Frame());
		BRect parentBounds (Parent()->Bounds());
		if (!parentBounds.Contains(bounds))
			MoveTo(parentBounds.right - bounds.Width(),
				parentBounds.bottom - bounds.Height());
	}

	return B_OK;
}
开发者ID:mariuz,项目名称:haiku,代码行数:29,代码来源:Dragger.cpp


示例2: TRACE

void NavigatorEditor::DetachedFromWindow(void)
{
	TRACE();
	while (ChildAt(0)!=NULL)
	{
		RemoveChild(ChildAt(0));
	}
}
开发者ID:Paradoxianer,项目名称:ProjectConceptor,代码行数:8,代码来源:NavigatorEditor.cpp


示例3: switch

void TMediaTabView::MessageReceived(BMessage* message)
{
	// Check for messages to switch the view
	bool buttonMsg = false;
	EChildID newView;
	switch (message->what)
	{
	case MEDIA_TAB_LIST_VIEW_MSG:
		newView = kElementsView;
		buttonMsg = true;
		break;
	case MEDIA_TAB_THUMBNAIL_VIEW_MSG:
		newView = kThumbnailView;
		buttonMsg = true;
		break;
	case MEDIA_TAB_ICON_VIEW_MSG:
		newView = kIconView;
		buttonMsg = true;
		break;
	}
	if (buttonMsg) {
		if (newView != fCurrentView) {
			// Protect this section of code.
			Looper()->Lock();

			DeactivateView(fCurrentView);
			fCurrentView = newView;
			ActivateView(fCurrentView);

			Looper()->Unlock();
		}

		return;
	}

	// Accept messages from the sorter object
	switch (message->what)
	{
	case SORTER_SELECT_MSG:
	case SORTER_INVOKE_MSG:
		if (fCurrentView == kElementsView)
			ChildAt(fCurrentView)->MessageReceived(message);
		return;

	// Some cue is adding an entry_ref to our browser
	// TODO: include the other two views in this. They can
	// have a new REF as well.
	case ADD_REF_MSG:
		if (fCurrentView == kElementsView)
			ChildAt(fCurrentView)->MessageReceived(message);
		return;
	}

	// Default handler
	BView::MessageReceived(message);
}
开发者ID:Barrett17,项目名称:UltraDV,代码行数:56,代码来源:TMediaTabView.cpp


示例4: BMailProtocolConfigView

SMTPConfigView::SMTPConfigView(MailAddonSettings& settings,
	BMailAccountSettings& accountSettings)
	:
	BMailProtocolConfigView(B_MAIL_PROTOCOL_HAS_AUTH_METHODS
		| B_MAIL_PROTOCOL_HAS_USERNAME | B_MAIL_PROTOCOL_HAS_PASSWORD
		| B_MAIL_PROTOCOL_HAS_HOSTNAME
#ifdef USE_SSL
		| B_MAIL_PROTOCOL_HAS_FLAVORS
#endif
		)
{
#if defined(USE_SSL) || defined(B_COLLECTING_CATKEYS)
	static const char* kUnencryptedStr = B_TRANSLATE_MARK("Unencrypted");
	static const char* kSSLStr = B_TRANSLATE_MARK("SSL");
	static const char* kSTARTTLSStr = B_TRANSLATE_MARK("STARTTLS");
#endif

#ifdef USE_SSL
	AddFlavor(B_TRANSLATE_NOCOLLECT(kUnencryptedStr));
	AddFlavor(B_TRANSLATE(kSSLStr));
	AddFlavor(B_TRANSLATE(kSTARTTLSStr));
#endif

	AddAuthMethod(B_TRANSLATE("None"), false);
	AddAuthMethod(B_TRANSLATE("ESMTP"));
	AddAuthMethod(B_TRANSLATE("POP3 before SMTP"), false);

	BTextControl *control = (BTextControl *)(FindView("host"));
	control->SetLabel(B_TRANSLATE("SMTP server:"));

	// Reset the dividers after changing one
	float widestLabel = 0;
	for (int32 i = CountChildren(); i-- > 0;) {
		if (BTextControl *text = dynamic_cast<BTextControl *>(ChildAt(i)))
			widestLabel = MAX(widestLabel,text->StringWidth(text->Label()) + 5);
	}
	for (int32 i = CountChildren(); i-- > 0;) {
		if (BTextControl *text = dynamic_cast<BTextControl *>(ChildAt(i)))
			text->SetDivider(widestLabel);
	}

	BMenuField *field = (BMenuField *)(FindView("auth_method"));
	field->SetDivider(widestLabel);

	SetTo(settings);

	fFileView = new BMailFileConfigView(B_TRANSLATE("Destination:"), "path",
		false, BPrivate::default_mail_out_directory().Path());
	fFileView->SetTo(&settings.Settings(), NULL);
	AddChild(fFileView);
	float w, h;
	BMailProtocolConfigView::GetPreferredSize(&w, &h);
	fFileView->MoveBy(0, h - 10);
	GetPreferredSize(&w, &h);
	ResizeTo(w, h);
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:56,代码来源:ConfigView.cpp


示例5:

void
ThemeInterfaceView::PopulateThemeList()
{
	int i;
	BControl *c;
	for (i = 0; ChildAt(i); i++) {
		c = dynamic_cast<BControl *>(ChildAt(i));
		if (c)
			c->SetEnabled(false);
	}
	thread_id tid = spawn_thread(_ThemeListPopulatorTh, "ThemeListPopulator", 
		B_LOW_PRIORITY, this);
	resume_thread(tid);
}
开发者ID:HaikuArchives,项目名称:HaikuThemeManager,代码行数:14,代码来源:ThemeInterfaceView.cpp


示例6: ClientRect

void CSettingsGroup::FrameResized(float width, float height)
{
	CBox::FrameResized(width, height);

	BRect clientRect = ClientRect();

	float ypos = clientRect.top+dist;
	float columnWidth = (clientRect.Width() - numColumns*dist - dist) / numColumns;
	
	for(int32 i=0 ; i<CountChildren() ; i++) {
		BView *child = ChildAt(i);
		
		float childWidth, childHeight;
		
		child->GetPreferredSize(&childWidth, &childHeight);
		
		int32 column = i%numColumns;
		
		child->MoveTo(clientRect.left+column*(columnWidth+dist)+dist, ypos);
		child->ResizeTo(columnWidth, childHeight);
		
		if(((i+1)%numColumns) == 0)
			ypos += childHeight+dist;
	}
}
开发者ID:HaikuArchives,项目名称:TaskManager,代码行数:25,代码来源:SettingsView.cpp


示例7: Invalidate

void
PackagesView::FrameResized(float width, float height)
{
    if (CountChildren() == 0)
        Invalidate();

    BScrollBar* scrollBar = ScrollBar(B_VERTICAL);
    if (scrollBar == NULL)
        return;

    float virtualHeight = 0.0;

    int32 count = CountChildren();
    if (count > 0) {
        BView* child = ChildAt(count - 1);
        virtualHeight = child->Frame().bottom;
    }

    if (height > virtualHeight) {
        scrollBar->SetRange(0.0f, 0.0f);
        scrollBar->SetValue(0.0f);
    } else {
        scrollBar->SetRange(0.0f, virtualHeight - height);
        scrollBar->SetProportion(height / virtualHeight);
    }

    scrollBar->SetSteps(15, height);
}
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:28,代码来源:PackageViews.cpp


示例8: ChildAt

void TMediaTabView::ActivateView(EChildID which)
{
	// Give the view the control buttons
	BView* view = ChildAt(which);

	BPoint pt = view->Bounds().LeftBottom();
	// Get the target button position. Slightly different for the
	// different view types.
	if (which == kElementsView)
		pt.y -= kScrollHeight;
	else {
		pt.x++;
		pt.y -= kScrollHeight + 1;
	}

	for (int i = 0; i < 3; i++) {
		view->AddChild(fbuttons[i]);
		fbuttons[i]->MoveTo(pt);
		pt.x += kScrollHeight;
	}

	// Make sure it is visible
	if (view->IsHidden())
		view->Show();
}
开发者ID:Barrett17,项目名称:UltraDV,代码行数:25,代码来源:TMediaTabView.cpp


示例9: Looper

/*!	Since we have set a mouse event mask, we don't want to forward all
	mouse downs to the slider - instead, we only invoke it, which causes a
	message to our target. Within the VolumeWindow, this will actually
	cause the window to close.
	Also, we need to mask out the dragger in this case, or else dragging
	us will also cause a volume update.
*/
void
VolumeControl::MouseDown(BPoint where)
{
	// Ignore clicks on the dragger
	int32 viewToken;
	if (Bounds().Contains(where) && Looper()->CurrentMessage() != NULL
		&& Looper()->CurrentMessage()->FindInt32("_view_token",
				&viewToken) == B_OK
		&& viewToken != _get_object_token_(this))
		return;

	// TODO: investigate why this does not work as expected (the dragger
	// frame seems to be off)
#if 0
	if (BView* dragger = ChildAt(0)) {
		if (!dragger->IsHidden() && dragger->Frame().Contains(where))
			return;
	}
#endif

	if (!IsEnabled() || !Bounds().Contains(where)) {
		Invoke();
		return;
	}

	BSlider::MouseDown(where);
}
开发者ID:yunxiaoxiao110,项目名称:haiku,代码行数:34,代码来源:VolumeControl.cpp


示例10: AddChild

status_t
BBox::SetLabel(BView *viewLabel)
{
	if (viewLabel != NULL) {
		if (viewLabel == this || viewLabel->Window() != NULL || viewLabel->Parent() != NULL) return B_ERROR;
		AddChild(viewLabel, ChildAt(0));
		if (viewLabel->Parent() != this) return B_ERROR;
		viewLabel->SetResizingMode(B_FOLLOW_NONE);
	} else if (fLabelView == NULL) {
		return B_OK;
	}

	if (fLabelView != NULL) {
		BView *view = fLabelView;
		fLabelView = NULL;

		view->RemoveSelf();
		delete view;
	}

	fLabelView = viewLabel;
	ReAdjustLabel();

	return B_OK;
}
开发者ID:D-os,项目名称:BeFree,代码行数:25,代码来源:Box.cpp


示例11: Bounds

void CollapsableBox::SetValue(int32 new_value)
{
	if (new_value != Value()) {
		BRect r = Bounds();
		
		if (!new_value)
			ResizeTo(r.Width(), m_collapsed_rect.Height());
		else
			ResizeTo(r.Width(), m_expanded_rect.Height());
		
		BView *child;
		
		child = ChildAt(0);
		while (child) {
			if (new_value)
				child->Show();
			else
				child->Hide();
			child = child->NextSibling();
		};
			
		Invalidate();
		BControl::SetValue(new_value);
		Invoke();
	};
	
}
开发者ID:diversys,项目名称:sanity,代码行数:27,代码来源:CollapsableBox.cpp


示例12: DisplayRecord

void MainView::DisplayRecord(Record *record, XFileMode mode) 
{
	Field * child = NULL;
	BString data;
	
	if ( (child = (Field *)ChildAt(0)) != NULL ) {
  		while ( child ) {
  			if(mode == DATA_MODE) {
	  			if(child->IsDataField()) {
	  				if(record->GetDataByFieldName(child->GetName(), data)) {
	  					printf("has data\n");
	  				}
	  				child->SetData(data);
	  			}	
  			}
	  		else if(mode == DESIGN_MODE)
	  		{
	  			data.SetTo(child->GetName());
	  			child->SetData(data);
	  		}
	  		child = (Field *) child->NextSibling();
  		}
  		
	}
}
开发者ID:brennanos,项目名称:XFile-Haiku,代码行数:25,代码来源:MainView.cpp


示例13: selectFieldByPoint

void MainView::selectFieldByPoint(const BPoint& point)
{
	bool selected = false;
	Field * child = NULL;
	
	selected_fields.MakeEmpty();
	
	if ( (child = (Field *)ChildAt(0)) != NULL ) {
  		while ( child ) {
			if(selected == false && child->Frame().Contains(point)) {
				child->SetSelected(true);
				selected_fields.AddItem(child);
				selected = true;
			}
			else {
				child->SetSelected(false);
			}
			child->Invalidate();
			child = (Field *)child->NextSibling();
  		}
	}
	if(selected_fields.CountItems() > 0) {
		getSelBounds(sel_bounds);
	}
}
开发者ID:brennanos,项目名称:XFile-Haiku,代码行数:25,代码来源:MainView.cpp


示例14: switch

void
SetupWindow::MessageReceived(BMessage* msg)
{
	bool success;

	switch (msg->what) {
		case M_OK:
			Lock();
			success = ((SetupView*)ChildAt(0))->CheckSetup();
			Unlock();
			if (success) {
				fResult = B_NO_ERROR;
				release_sem(fExitSem);
			}
			break;

		case M_CANCEL:
			fResult = B_ERROR;
			release_sem(fExitSem);
			break;

		default:
			BWindow::MessageReceived(msg);
			break;
	}
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:26,代码来源:SetupWindow.cpp


示例15:

// _FindIcon
IconButton*
IconOptionsControl::_FindIcon(int32 index) const
{
	if (BView* view = ChildAt(index))
		return dynamic_cast<IconButton*>(view);
	return NULL;
}
开发者ID:stippi,项目名称:Clockwerk,代码行数:8,代码来源:IconOptionsControl.cpp


示例16: MessageReceived

	virtual void MessageReceived(BMessage* message)
	{
		switch (message->what) {
		case MSG_TEST_OPEN_FILE_PANEL:
			{
				BFilePanel* panel = new BFilePanel();
				panel->Show();
			}
			break;
		case MSG_TEST_SAVE_FILE_PANEL:
			{
				BFilePanel* panel = new BFilePanel(B_SAVE_PANEL);
				panel->Show();
			}
			break;
		case MSG_TOGGLE_LOOK:
			{
				BControlLook* temp = fControlLook;
				fControlLook = be_control_look;
				be_control_look = temp;
				_InvalidateChildrenAndView(ChildAt(0));
			}
			break;

		default:
			BWindow::MessageReceived(message);
		}
	}
开发者ID:mmanley,项目名称:Antares,代码行数:28,代码来源:Look.cpp


示例17: SetHighColor

void TTextControl::AttachedToWindow(void)
{
	const char	*string;
	BTextView	*text;

	SetHighColor(0, 0, 0);
	BTextControl::AttachedToWindow();
	SetFontName("Erich");

	SetDivider(StringWidth(fLabel) + 6);
	text = (BTextView *)ChildAt(0);
	text->SetFontName("Erich");

	if (fRecord) {
		if (fIncoming)
			SetEnabled(FALSE);
		switch (fCommand) {
			case SUBJECT_FIELD:
				string = fRecord->FindString("Subject");
				if (fRecord->Error() == B_NO_ERROR)
					SetText(string);
				break;

			case TO_FIELD:
				string = fRecord->FindString("Name");
				if (fRecord->Error() == B_NO_ERROR)
					SetText(string);
				break;
		}
	}
}
开发者ID:ErisBlastar,项目名称:spellswell,代码行数:31,代码来源:Header.cpp


示例18: printf

void TScrollViewComponent::FrameMoved(BPoint screenPoint)		
{
	printf("TScrollViewComponent::FrameMoved....\n");
	Invalidate();
	BView *child; 
   	if ( child = ChildAt(0) ) 
   	{
   		child->Invalidate();
   		child->FrameResized(0,0);
		BRect AFrame = this->Frame();
		BRect AFrame2 = child->Frame();
		printf("TScrollViewComponent::FrameMoved Getting ScrollBar\n");
		BScrollBar *truc = this->ScrollBar(B_HORIZONTAL);
		AFrame2 = truc->Frame();
		FPropertyList->SetPropertyValue(PROP_BOTTOM,FloatToStr(AFrame.bottom -2 -((AFrame2.bottom - AFrame2.top))));
		truc = this->ScrollBar(B_VERTICAL);		
		AFrame2 = truc->Frame();
		FPropertyList->SetPropertyValue(PROP_RIGHT,FloatToStr(AFrame.right -2 - ((AFrame2.right-AFrame2.left))));
		FPropertyList->SetPropertyValue(PROP_TOP,FloatToStr(AFrame.top + 2));
		FPropertyList->SetPropertyValue(PROP_LEFT,FloatToStr(AFrame.left + 2));
   	}
   	BScrollView::FrameMoved(screenPoint);
//	FrameMovedComponent(FInternalComponent);
//	FInternalComponent->FrameMovedComponent(FInternalComponent);
}
开发者ID:HaikuArchives,项目名称:BeBuilder,代码行数:25,代码来源:ScrollViewComponent.cpp


示例19: RemoveChild

void
BScrollView::SetTarget(BView *target)
{
	if (fTarget == target)
		return;

	if (fTarget != NULL) {
		fTarget->TargetedByScrollView(NULL);
		RemoveChild(fTarget);

		// we are not supposed to delete the view
	}

	fTarget = target;
	if (fHorizontalScrollBar != NULL)
		fHorizontalScrollBar->SetTarget(target);
	if (fVerticalScrollBar != NULL)
		fVerticalScrollBar->SetTarget(target);

	if (target != NULL) {
		target->MoveTo(BorderSize(fBorder), BorderSize(fBorder));
		target->TargetedByScrollView(this);

		AddChild(target, ChildAt(0));
			// This way, we are making sure that the target will
			// be added top most in the list (which is important
			// for unarchiving)
	}
}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:29,代码来源:ScrollView.cpp


示例20: switch

void IppSetupDlg::MessageReceived(BMessage *msg)
{
	bool success;

	switch (msg->what) {
	case M_OK:
		Lock();
		success = ((IppSetupView *)ChildAt(0))->UpdateViewData();
		Unlock();
		if (success) {
			result = B_NO_ERROR;
			release_sem(semaphore);
		}
		break;

	case M_CANCEL:
		result = B_ERROR;
		release_sem(semaphore);
		break;

	default:
		BWindow::MessageReceived(msg);
		break;
	}
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:25,代码来源:IppSetupDlg.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Chip_Clock_EnablePeriphClock函数代码示例发布时间:2022-05-30
下一篇:
C++ Child函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap