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


C++ BWindow类代码示例

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


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

示例1: Window

void ColumnListView::AddSortKey(int32 ColumnIndex)
{
	CLVColumn* Column;
	if(ColumnIndex >= 0)
	{
		Column = (CLVColumn*)fColumnList.ItemAt(ColumnIndex);
		if(!(Column->Flags()&CLV_SORT_KEYABLE))
			return;
	}
	else
		Column = NULL;
	if(Column && !fSortKeyList.HasItem(Column))
	{
		BWindow* ParentWindow = Window();
		if(ParentWindow)
			ParentWindow->Lock();
		BRect LabelBounds = fColumnLabelView->Bounds();
		fSortKeyList.AddItem(Column);
		if(Column->fSortMode == NoSort)
			SetSortMode(ColumnIndex,Ascending);
		SortItems();
		//Need to draw new underline
		fColumnLabelView->Invalidate(BRect(Column->fColumnBegin,LabelBounds.top,Column->fColumnEnd,
			LabelBounds.bottom));
		if(ParentWindow)
			ParentWindow->Unlock();
	}
}
开发者ID:mariuz,项目名称:haiku,代码行数:28,代码来源:ColumnListView.cpp

示例2: lock

void
TTracker::CloseAllWindows()
{
	// this is a response to the DeskBar sending us a B_QUIT, when it really
	// means to say close all your windows. It might be better to have it
	// send a kCloseAllWindows message and have windowless apps stay running,
	// which is what we will do for the Tracker
	AutoLock<WindowList> lock(&fWindowList);

	int32 count = CountWindows();
	for (int32 index = 0; index < count; index++) {
		BWindow *window = WindowAt(index);
		// avoid the desktop
		if (!dynamic_cast<BDeskWindow *>(window)
			&& !dynamic_cast<BStatusWindow *>(window))
			window->PostMessage(B_CLOSE_REQUESTED);
	}
	// count from end to beginning so we can remove items safely
	for (int32 index = fWindowList.CountItems() - 1; index >= 0; index--) {
		BWindow *window = fWindowList.ItemAt(index);
		if (!dynamic_cast<BDeskWindow *>(window)
			&& !dynamic_cast<BStatusWindow *>(window))
				// ToDo:
				// get rid of the Remove here, BContainerWindow::Quit does it
			fWindowList.RemoveItemAt(index);
	}	
}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:27,代码来源:Tracker.cpp

示例3: BMessenger

void
BToolTipManager::ShowTip(BToolTip* tip, BPoint where, void* owner)
{
	BToolTip* current = NULL;
	void* currentOwner = NULL;
	BMessage reply;
	if (fWindow.SendMessage(kMsgCurrentToolTip, &reply) == B_OK) {
		reply.FindPointer("current", (void**)&current);
		reply.FindPointer("owner", &currentOwner);
	}

	// Release reference from the message
	if (current != NULL)
		current->ReleaseReference();

	if (current == tip || currentOwner == owner) {
		fWindow.SendMessage(kMsgShowToolTip);
		return;
	}

	fWindow.SendMessage(kMsgHideToolTip);

	if (tip != NULL) {
		BWindow* window = new BPrivate::ToolTipWindow(tip, where, owner);
		window->Show();

		fWindow = BMessenger(window);
	}
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:29,代码来源:ToolTipManager.cpp

示例4: Window

// ---------------------------------------------------------------------
//! Minimizes UI
// ---------------------------------------------------------------------
void BeSkinView::Minimize()
{
	BWindow* window = Window();
	BAutolock locker(window);
	
	window->Minimize(true);
}
开发者ID:HaikuArchives,项目名称:CoveredCalc,代码行数:10,代码来源:BeSkinView.cpp

示例5: main

int
main(int argc, char** argv)
{
	BApplication app("application/x-vnd.Antares-DrawAfterChildren");

	BRect frame(100, 100, 700, 400);
	BWindow* window = new BWindow(frame, "Window",
		B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE);

	frame.OffsetTo(B_ORIGIN);
	TestView* view = new TestView(frame);
	window->AddChild(view);

	frame.InsetBy(20, 20);
	frame.right = frame.left + frame.Width() / 2 - 10;
	BView* child = new ChildView(frame, "child 1",
		(rgb_color){ 200, 200, 200, 255 });
	view->AddChild(child);

	frame.OffsetBy(frame.Width() + 20, 0);
	child = new ChildView(frame, "child 2", B_TRANSPARENT_COLOR);
	view->AddChild(child);

	window->Show();

	app.Run();
	return 0;
}
开发者ID:mmanley,项目名称:Antares,代码行数:28,代码来源:DrawAfterChildren.cpp

示例6: show_window

// show_window
void
show_window(BRect frame, const char* name)
{
	BWindow* window = new BWindow(frame, name,
								  B_TITLED_WINDOW,
								  B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);

	BView* view = new TestView(window->Bounds(), "test", B_FOLLOW_ALL,
							   B_WILL_DRAW/* | B_FULL_UPDATE_ON_RESIZE*/);

	window->AddChild(view);
	BRect b(0.0, 0.0, 50.0, 15.0);
	b.OffsetTo(5.0, view->Bounds().bottom - (b.Height() + 15.0));
	BButton* control = new BButton(b, "button", "Copy", new BMessage(MSG_COPY_BITS));
	view->AddChild(control);
	control->SetTarget(view);

	// test CopyBits() on top of children
	b = BRect(80, 130, 130, 160);
	BView* child = new BView(b, "some child", B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, 0);
	child->SetViewColor(255, 0, 0);
	view->AddChild(child);

	b = BRect(136, 127, 158, 140);
	child = new BView(b, "some other child", B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, 0);
	child->SetViewColor(255, 255, 0);
	view->AddChild(child);

	window->Show();
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:31,代码来源:main.cpp

示例7: Window

void
SButton::KeyDown(const char *bytes, int32 numBytes)
{
	if(numBytes == 1)
	{
		if(bytes[0] == B_ENTER || bytes[0] == B_RETURN || bytes[0] == B_SPACE)
		{
			BWindow *window = Window();

			BMessage *msg = window->CurrentMessage();

			if(msg)
			{
				if(msg->what == B_KEY_DOWN)
				{
					int32 key_repeat = 0;
					if(msg->FindInt32("be:key_repeat", &key_repeat) == B_OK)
					{
						if(key_repeat > 0) return;
					}
				}
			}

			waitting = true;
			waitting_is_keyboard = true;

			Draw(Bounds());
			window->UpdateIfNeeded();

			return;
		}
	}

	BView::KeyDown(bytes, numBytes);
}
开发者ID:Haiku-cn,项目名称:BeCJK,代码行数:35,代码来源:Button.cpp

示例8: main

int main(int argc, char ** argv)
{
	BApplication app("application/x-vnd.misza-SystemInfoReplicant");
	
	BRect temp,r;
	
	BPath path;
  	find_directory(B_USER_SETTINGS_DIRECTORY,&path);
  	path.Append("SystemInfoReplicant",true);
  	
  	BFile file(path.Path(),B_READ_ONLY);
  	if(file.InitCheck() == B_OK)
  	{
		BMessage msg;
  		msg.Unflatten(&file);
		if(msg.FindRect("frame",&temp) == B_OK)
			r = temp;
	
	}
	else
		r = BRect(250,250,424,385);
	
	
	BWindow* window = new SIReplicant(r);
	window->Show();
	app.Run();
	return 0;
}
开发者ID:chirayudesai,项目名称:SystemInfo,代码行数:28,代码来源:main.cpp

示例9: targatobpic

int targatobpic(
	const unsigned char* targa, int targasize,
	BPicture* picture)
{
	BRect frame(0,0,100,100);	// arbitraire
	BBitmap *bitmap;
	BView *view;
	BWindow *window;
	
	bitmap=targatobbitmap(targa,targasize);
	if(!bitmap) return -1;
	
	window=new BWindow(frame,NULL,B_MODAL_WINDOW,0);
	view=new BView(frame,NULL,B_FOLLOW_NONE,0);
	window->AddChild(view);
	
	view->BeginPicture(picture);
	view->DrawBitmap(bitmap);
	view->EndPicture();
	
	delete bitmap;
	delete window;
	
	return 0;
}
开发者ID:HaikuArchives,项目名称:Stamina,代码行数:25,代码来源:targatobbitmap.cpp

示例10: title

bool
ProjectWindow::QuitRequested()
{
	if (fShowingLibs)
	{
		BString title("Libraries: ");
		title << fProject->GetName();
		for (int32 i = 0; i < be_app->CountWindows(); i++)
		{
			BWindow *win = be_app->WindowAt(i);
			if (title.Compare(win->Title()) == 0)
			{
				win->PostMessage(B_QUIT_REQUESTED);
				break;
			}
		}
	}
	
	fProject->Save();
	
	if (fErrorWindow)
	{
		fErrorWindow->Quit();
		fErrorWindow = NULL;
	}
	
	DeregisterWindow();
	return true;
}
开发者ID:passick,项目名称:Paladin,代码行数:29,代码来源:ProjectWindow.cpp

示例11: entry

void AmControlChangeReport::ReadSong(const AmSong* song)
{
	_AmControlEntryCollection	entries;
	const AmTrack*				track;
	for (uint32 k = 0; (track = song->Track(k)); k++) {
		_AmControlEntry			entry(track);
		control_report(&(track->Phrases()), entry);
		if (entry.controls.size() > 0) entries.AddEntry(entry);
	}

	BRect		f(100, 100, 400, 400);
	BWindow*	window = new BWindow(	f, "Control Change Report", B_DOCUMENT_WINDOW_LOOK,
										B_NORMAL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS);
	if (window) {
		BOutlineListView*	lv = new BOutlineListView(	BRect(0, 0, f.Width() - 15, f.Height() - 15), "outline",
														B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL);
		if (lv) {
			entries.AddTo(lv);
			BScrollView*	scroll = new BScrollView("scroll", lv, B_FOLLOW_ALL, 0, true, true);
			if (scroll) window->AddChild(scroll);
			else window->AddChild(lv);
		}
		window->Show();
	}
}
开发者ID:tgkokk,项目名称:Sequitur,代码行数:25,代码来源:AmSongFunctionRoster.cpp

示例12: haiku_create_window_surface

/**
 * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
 */
static _EGLSurface *
haiku_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
	_EGLConfig *conf, void *native_window, const EGLint *attrib_list)
{
	CALLED();

	struct haiku_egl_surface* surface;
	surface = (struct haiku_egl_surface*) calloc(1, sizeof (*surface));
	if (!surface) {
		_eglError(EGL_BAD_ALLOC, "haiku_create_window_surface");
		return NULL;
	}

	if (!_eglInitSurface(&surface->surf, disp, EGL_WINDOW_BIT,
		conf, attrib_list)) {
		free(surface);
		return NULL;
	}

	(&surface->surf)->SwapInterval = 1;

	TRACE("Creating window\n");
	BWindow* win = (BWindow*)native_window;

	TRACE("Creating GL view\n");
	surface->gl = new BGLView(win->Bounds(), "OpenGL", B_FOLLOW_ALL_SIDES, 0,
		BGL_RGB | BGL_DOUBLE | BGL_ALPHA);

	TRACE("Adding GL\n");
	win->AddChild(surface->gl);

	TRACE("Showing window\n");
	win->Show();
	return &surface->surf;
}
开发者ID:ChristophHaag,项目名称:mesa-mesa,代码行数:38,代码来源:egl_haiku.cpp

示例13: fprintf

void
BepdfApplication::MessageReceived (BMessage * msg)
{
	if (msg == NULL) {
		fprintf (stderr, "xpdf: message NULL received\n");
		return;
	}

	switch (msg->what) {
	case NOTIFY_QUIT_MSG:
		if (mWindow) {
			BWindow* w = mWindow;
			w->Lock();
			w->PostMessage(B_QUIT_REQUESTED);
			w->Unlock();
		}
		break;
	case NOTIFY_CLOSE_MSG:
		if (mWindow) {
			mWindow->Lock();
			mWindow->UpdateWindowsMenu();
			mWindow->Unlock();
		}
		break;
	case B_CANCEL:
		if (!mWindow && mReadyToQuit) {
			PostMessage(B_QUIT_REQUESTED);
		}
		break;
	default:
		BApplication::MessageReceived(msg);
	}
}
开发者ID:HaikuArchives,项目名称:BePDF,代码行数:33,代码来源:BepdfApplication.cpp

示例14: Window

// SetExportMode
void
SavePanel::SetExportMode(bool exportMode)
{
	BWindow* window = Window();
	if (!window || !window->Lock())
		return;

	// adjust window title and enable format menu
	BString helper("Icon-O-Matic: ");
	if (exportMode) {
		fFormatMF->SetEnabled(true);
		SetExportMode(fExportMode);
		_EnableSettings();
		helper << B_TRANSLATE_CONTEXT("Export Icon", "Dialog title");
	} else {
		fExportMode = ExportMode();
			// does not overwrite fExportMode in case we already were
			// in native save mode
		fNativeMI->SetMarked(true);

		fFormatMF->SetEnabled(false);
		fSettingsB->SetEnabled(false);
		helper << B_TRANSLATE_CONTEXT("Save Icon", "Dialog title");
	}

	window->Unlock();
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:28,代码来源:SavePanel.cpp

示例15: Window

void
ImageView::MouseUp(BPoint point)
{
	BWindow *parent = Window();
	if (parent)
		parent->PostMessage(P_MSG_CLOSE);
}
开发者ID:mariuz,项目名称:haiku,代码行数:7,代码来源:PackageImageViewer.cpp


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