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


C++ BView::Parent方法代码示例

本文整理汇总了C++中BView::Parent方法的典型用法代码示例。如果您正苦于以下问题:C++ BView::Parent方法的具体用法?C++ BView::Parent怎么用?C++ BView::Parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BView的用法示例。


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

示例1: KeyFilter

filter_result
AutoTextControlFilter::Filter(BMessage* msg, BHandler** target)
{
	int32 rawchar, mod;
	msg->FindInt32("raw_char", &rawchar);
	msg->FindInt32("modifiers", &mod);

	BView* view = dynamic_cast<BView*>(*target);
	if (view != NULL || view->Name() != NULL && strcmp("_input_", view->Name()))
		return B_DISPATCH_MESSAGE;
	
	AutoTextControl* text = dynamic_cast<AutoTextControl*>(view->Parent());
	if (!text || text != fBox)
		return B_DISPATCH_MESSAGE;

	fCurrentMessage = msg;
	filter_result result = KeyFilter(rawchar, mod);
	fCurrentMessage = NULL;

	if (fBox->fCharLimit && result == B_DISPATCH_MESSAGE) {
		// See to it that we still allow shortcut keys
		if (mod & B_COMMAND_KEY)
			return B_DISPATCH_MESSAGE;

		// We don't use strlen() because it is not UTF-8 aware, which can
		// affect how many characters can be typed.
		if (isprint(rawchar) && 
				(uint32)BString(text->Text()).CountChars() == text->fCharLimit)
			return B_SKIP_MESSAGE;
	}

	return result;
}
开发者ID:HaikuArchives,项目名称:Filer,代码行数:33,代码来源:AutoTextControl.cpp

示例2: Tool_Thread

int32 ToolTip::Tool_Thread(){
   BPoint loc;
   BPoint oldloc;
   ulong button;
   int32 count = 0;
   BView *v = NULL;
   
   // Wait until the BApplication becomes valid, in case
   // someone creates this as a global variable.
   while(!be_app_messenger.IsValid()){
      snooze(200000);
   }
   
   // while the app is valid, run. This is a 
   // easy way to let the thread natually die
	while(be_app_messenger.IsValid()){
		if(ttWin->Lock()){
			ttWin->ChildAt(0)->GetMouse(&loc, &button);
			ttWin->ConvertToScreen(&loc);
			if((loc == oldloc) && !button){
				if(count == 5){
					if(ttWin->IsHidden()){
						BPoint tr = loc;
						v = FindView(tr);
						const char *tip = NULL;
						while(v && (tip = GetTip(v)) == NULL){
							v = v->Parent();
						}
						if(tip){
							if(tip && strcmp(tip,"")){
								ttWin->Tip(loc,tip);
							}else{
								//ttWin->Tip(loc,"whats up with the No tip haven tool?");
							}
						}
					}
				}else{
					count++;
				}
			}else{
				count = 0;
				if(!(ttWin->IsHidden())){
					ttWin->Bye();
				}
			}
			oldloc = loc;
			ttWin->Unlock();
			//snooze(250000);
			snooze(150000);
		}else{
			snooze(1000000);
		}
	}
	return B_OK;
}
开发者ID:BackupTheBerlios,项目名称:beae-svn,代码行数:55,代码来源:ToolTip.cpp

示例3: strcmp

filter_result
BStatusMouseFilter::Filter(BMessage* message, BHandler** target)
{
	// If the target is the status bar, make sure the message goes to the
	// parent view instead.
	if ((*target)->Name() != NULL
		&& strcmp((*target)->Name(), "StatusBar") == 0) {
		BView* view = dynamic_cast<BView*>(*target);
		if (view != NULL)
			view = view->Parent();
		if (view != NULL)
			*target = view;
	}

	return B_DISPATCH_MESSAGE;
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:16,代码来源:StatusWindow.cpp

示例4: Bounds

void
BGLView::FrameResized(float width, float height)
{
	fBounds = Bounds();
	for (BView *v = this; v; v = v->Parent())
		v->ConvertToParent(&fBounds);

	if (fRenderer) {
		LockGL();
		_LockDraw();
		fRenderer->FrameResized(width, height);
		_UnlockDraw();
		UnlockGL();
	}

   	BView::FrameResized(width, height);
}
开发者ID:aljen,项目名称:haiku-opengl,代码行数:17,代码来源:GLView.cpp

示例5: SelectionChanged

// Buttons are enabled or not depending on the selection in the list
// so each time you click in the list, this method is called to update the buttons
void NetListView::SelectionChanged(void)
{
	int32 index = CurrentSelection();

	BView *parent = Parent();
	
	if (index >= 0) {
		
		// There are 2 lists that are instances of this class, so we have to see in which list you are clicking
		if (strcmp(parent->Name(),"Interfaces_Scroller") == 0) {												  
			
			BButton *settings = dynamic_cast <BButton *> ((parent->Parent())->FindView("Settings"));
			BButton *clear 	  = dynamic_cast <BButton *> ((parent->Parent())->FindView("Clear"));
			
			settings->SetEnabled(true);
			clear->SetEnabled(true);
		}
		else if (strcmp(parent->Name(),"Configurations_Scroller") == 0) {
			
			BButton *restore = dynamic_cast <BButton *> ((parent->Parent())->FindView("Restore"));
			BButton *remove	 = dynamic_cast <BButton *> ((parent->Parent())->FindView("Delete"));
			
			restore ->SetEnabled(true);
			remove  ->SetEnabled(true);
		}
	}
	else {
		
		// There are 2 lists that are instances of this class, so we have to see in which list you are clicking
		if (strcmp(parent->Name(),"Interfaces_Scroller") == 0) {												  
		
			BButton *settings=dynamic_cast <BButton *> ((parent->Parent())->FindView("Settings"));
			BButton *clear=dynamic_cast <BButton *> ((parent->Parent())->FindView("Clear"));
			
			settings->SetEnabled(false);
			clear->SetEnabled(false);
		}
		else if (strcmp(parent->Name(),"Configurations_Scroller") == 0) {
		
			BButton *restore=dynamic_cast <BButton *> ((parent->Parent())->FindView("Restore"));
			BButton *remove=dynamic_cast <BButton *> ((parent->Parent())->FindView("Delete"));
			
			restore->SetEnabled(false);
			remove->SetEnabled(false);
		}
	}			
				
}
开发者ID:dakk,项目名称:Haiku-WIPs,代码行数:50,代码来源:NetListView.cpp

示例6: msgr

void
AgentDockHeaderString::MouseUp (BPoint where)
{
	SetViewColor (tint_color (ui_color (B_MENU_BACKGROUND_COLOR), B_DARKEN_1_TINT));
	Parent()->SetViewColor (tint_color (ui_color (B_MENU_BACKGROUND_COLOR), B_DARKEN_1_TINT));
	Invalidate();
	Parent()->Invalidate();
	
	// check if this header string belongs to notify list and send resize message if so
	BView *notifyList (Parent());
	if (notifyList && dynamic_cast<AgentDockHeader *>(notifyList) != NULL)
	{
		notifyList = notifyList->Parent();
		if (notifyList && dynamic_cast<AgentDockNotifyList *>(notifyList) != NULL)
		{
			BMessenger msgr (((AgentDockNotifyList *)notifyList)->pNotifyList());
			if (msgr.IsValid())
				msgr.SendMessage (M_NOTIFYLIST_RESIZE);
		}
	}

	BStringView::MouseUp (where);
}
开发者ID:jessicah,项目名称:Vision,代码行数:23,代码来源:ClientWindowDock.cpp

示例7: string

filter_result
SpinnerMsgFilter::Filter(BMessage *msg, BHandler **target)
{
	int32 c;
	msg->FindInt32("raw_char",&c);
	switch (c) {
		case B_ENTER: {
			BTextView *text = dynamic_cast<BTextView*>(*target);
			if (text && text->IsFocus()) {
				BView *view = text->Parent();
				while (view) {					
					Spinner *spin = dynamic_cast<Spinner*>(view);
					if (spin) {
						BString string(text->Text());
						int32 newvalue = 0;
						
						sscanf(string.String(),"%ld",&newvalue);
						if (newvalue != spin->Value()) {
							spin->SetValue(newvalue);
							spin->Invoke();
						}
						return B_SKIP_MESSAGE;
					}
					view = view->Parent();
				}
			}
			return B_DISPATCH_MESSAGE;
		}
		case B_TAB: {
			// Cause Tab characters to perform keybaord navigation
			BHandler *h = *target;
			BView *v = NULL;
			
			h = h->NextHandler();
			while (h) {
				v = dynamic_cast<BView*>(h);
				if (v) {
					*target = v->Window();
					return B_DISPATCH_MESSAGE;
				}
				h = h->NextHandler();
			}
			return B_SKIP_MESSAGE;
		}
		case B_UP_ARROW:
		case B_DOWN_ARROW: {
			BTextView *text = dynamic_cast<BTextView*>(*target);
			if (text && text->IsFocus()) {
				// We have a text view. See if it currently has the focus and belongs
				// to a Spinner control. If so, change the value of the spinner
				
				// TextViews are complicated beasts which are actually multiple views.
				// Travel up the hierarchy to see if any of the target's ancestors are
				// a Spinner.
				
				BView *view = text->Parent();
				while (view) {					
					Spinner *spin = dynamic_cast<Spinner*>(view);
					if (spin) {
						int32 step = spin->GetSteps();
						if (c == B_DOWN_ARROW)
							step = 0 - step;
						
						spin->SetValue(spin->Value() + step);
						spin->Invoke();
						return B_SKIP_MESSAGE;
					}
					view = view->Parent();
				}
			}
			
			return B_DISPATCH_MESSAGE;
		}
		default:
			return B_DISPATCH_MESSAGE;
	}
	
	// shut the stupid compiler up
	return B_SKIP_MESSAGE;
}
开发者ID:Barrett17,项目名称:Faber,代码行数:80,代码来源:Spinner.cpp

示例8: PostInit

void CPrefsDialog::PostInit()
{
	BAutolock lock(this);

	strcpy(fNewFontFamily, gPrefs->GetPrefString("defdoc font family", NULL));
	fNewFontSize = gPrefs->GetPrefDouble("defdoc font size", 0.0);
	strcpy(fNewBFontFamily, gPrefs->GetPrefString("border font family", NULL));
	fNewBFontSize = gPrefs->GetPrefDouble("border font size", 0.0);

	CellStyle cs;
	font_style style;

	fOwner->GetCellView()->GetContainer()->GetDefaultCellStyle(cs);
	try {
		gFontSizeTable.GetFontInfo(cs.fFont, &fDocFontFamily, &style, &fDocFontSize);
		gFontSizeTable.GetFontInfo(fOwner->GetCellView()->BorderFontID(),
			&fDocBFontFamily, &style, &fDocBFontSize);
	}
	catch (CErr& e) {
		e.DoError();
	}

	BMenuField *mf = dynamic_cast<BMenuField*>(FindView("docfont"));
	fDocFont = mf->Menu();
	if (fDocFont) 
	{
		for (long i = 0; i < count_font_families(); i++)
		{
			font_family ff;
			get_font_family(i, &ff);
			fDocFont->AddItem(new BMenuItem(ff, new BMessage(msg_Changed)));
		}
		fDocFont->SetRadioMode(TRUE);
	}

	mf = dynamic_cast<BMenuField*>(FindView("borderfont"));
	fBorderFont = mf->Menu();
	for (long i = 0; i < count_font_families(); i++)
	{
		font_family ff;
		get_font_family(i, &ff);
		fBorderFont->AddItem(new BMenuItem(ff, new BMessage(msg_Changed)));
	}
	fBorderFont->SetRadioMode(TRUE);

	mf = dynamic_cast<BMenuField*>(FindView("dateorder"));
	fDMY = mf->Menu();
	fDMY->AddItem(new BMenuItem("dmy", new BMessage(msg_Changed)));
	fDMY->AddItem(new BMenuItem("dym", new BMessage(msg_Changed)));
	fDMY->AddItem(new BMenuItem("mdy", new BMessage(msg_Changed)));
	fDMY->AddItem(new BMenuItem("myd", new BMessage(msg_Changed)));
	fDMY->AddItem(new BMenuItem("ydm", new BMessage(msg_Changed)));
	fDMY->AddItem(new BMenuItem("ymd", new BMessage(msg_Changed)));

	mf = dynamic_cast<BMenuField*>(FindView("neworcur"));
	if (mf)
	{
		fNewOrCur = mf->Menu();
		fNewOrCur->AddItem(new BMenuItem("New Documents", new BMessage(msg_ChangeTarget)));
		if (fOwner)
		{
			char s[32];
			fDocFont->FindItem(fDocFontFamily)->SetMarked(true);
			ftoa(fDocFontSize, s);
			SetText("docsize", s);
			fBorderFont->FindItem(fDocBFontFamily)->SetMarked(true);
			ftoa(fDocBFontSize, s);
			SetText("bordersize", s);

			fNewOrCur->AddItem(new BMenuItem(fOwner->Title(), new BMessage(msg_ChangeTarget)));
			fNewOrCur->ItemAt(1)->SetMarked(true);
		}
		else
			fNewOrCur->ItemAt(0)->SetMarked(true);
		mf->SetDivider(be_plain_font->StringWidth(mf->Label()) + 4);
	}

	BBox *b;
	BView *v;
	v = FindView("prgrid");
	b = dynamic_cast<BBox*>(v->Parent());
	if (b)
	{
		char t[256];
		sprintf(t, b->Label(), fOwner->Title());
		b->SetLabel(t);
	}
	
	fAutoRecalc = fOwner->GetCellView()->DoesAutoRecalc();
	fDisplayZero = fOwner->GetCellView()->DoesDisplayZero();
	fPrGrid = fOwner->GetCellView()->PrintsGrid();
	fPrBorders = fOwner->GetCellView()->PrintsBorders();
	fShGrid = fOwner->GetCellView()->ShowsGrid();
	fShBorders = fOwner->GetCellView()->ShowsBorders();

	CancelClicked();

	Show();
} /* CPrefsDialog::PostInit */
开发者ID:ModeenF,项目名称:OpenSumIt,代码行数:99,代码来源:PrefsDialog.cpp

示例9: Helper

void BubbleHelper::Helper()
{
	// Wait until the BApplication becomes valid, in case
	// someone creates this as a global variable.
	while (!be_app_messenger.IsValid()) snooze(200000);
	// wait a little longer, until the BApplication is really up to speed
	while (be_app->IsLaunching()) snooze(200000);

	textwin = new BWindow(BRect(-100, -100, -50, -50), "", B_BORDERED_WINDOW_LOOK,
						  B_FLOATING_ALL_WINDOW_FEEL, B_NOT_MOVABLE | B_AVOID_FOCUS);

	textview = new BTextView(BRect(0, 0, 50, 50), "", BRect(1, 1, 49, 49), B_FOLLOW_ALL_SIDES,
							 B_WILL_DRAW);
	textview->MakeEditable(false);
	textview->MakeSelectable(false);
	textview->SetWordWrap(false);
	textview->SetLowColor(255, 255, 190);
	textview->SetViewColor(255, 255, 190);
	textview->SetHighColor(0, 0, 0);
	textwin->AddChild(textview);
	textwin->Run();
	textwin->Lock();
	textwin->Activate(false);
	rename_thread(textwin->Thread(), "bubble");
	textwin->Unlock();

	ulong delaycounter = 0;
	BPoint lastwhere;

	while (be_app_messenger.IsValid()) {
		BPoint where;
		uint32 buttons;
		if (enabled) {
			if (textwin->Lock()) {
				textview->GetMouse(&where, &buttons);
				textview->ConvertToScreen(&where);
				if (lastwhere != where || buttons) {
					delaycounter = 0;
				} else {
					// mouse didn't move
					if (delaycounter++ > 5) {
						delaycounter = 0;
						// mouse didn't move for a while
						BView* view = FindView(where);
						char* text = NULL;
						while (view && (text = GetHelp(view)) == NULL) view = view->Parent();
						if (text) {
							DisplayHelp(text, where);
							// wait until mouse moves out of view, or wait
							// for timeout
							long displaycounter = 0;
							BPoint where2;
							long displaytime = max_c(20, strlen(text));
							do {
								textwin->Unlock();
								snooze(100000);
								if (!textwin->Lock()) goto end; // window is apparently gone
								textview->GetMouse(&where2, &buttons);
								textview->ConvertToScreen(&where2);
							} while (!buttons && where2 == where &&
									 (displaycounter++ < displaytime));

							HideBubble();
							do {
								textwin->Unlock();
								snooze(100000);
								if (!textwin->Lock()) goto end; // window is apparently gone
								textview->GetMouse(&where2, &buttons);
								textview->ConvertToScreen(&where2);
							} while (where2 == where);
						}
					}
				}
				lastwhere = where;
				textwin->Unlock();
			}
		}
	end:
		snooze(100000);
	}
	// (this thread normally gets killed by the destructor before arriving here)
}
开发者ID:HaikuArchives,项目名称:Helios,代码行数:82,代码来源:BubbleHelper.cpp


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