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


C++ BWindow::Activate方法代码示例

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


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

示例1: Window

void
PadView::MouseDown(BPoint where)
{
	BWindow* window = Window();
	if (window == NULL)
		return;

	BRegion region;
	GetClippingRegion(&region);
	if (!region.Contains(where))
		return;

	bool handle = true;
	for (int32 i = 0; BView* child = ChildAt(i); i++) {
		if (child->Frame().Contains(where)) {
			handle = false;
			break;
		}
	}
	if (!handle)
		return;

	BMessage* message = window->CurrentMessage();
	if (message == NULL)
		return;

	uint32 buttons;
	message->FindInt32("buttons", (int32*)&buttons);
	if (buttons & B_SECONDARY_MOUSE_BUTTON) {
		BRect r = Bounds();
		r.InsetBy(2.0, 2.0);
		r.top += 6.0;
		if (r.Contains(where)) {
			DisplayMenu(where);
		} else {
			// sends the window to the back
			window->Activate(false);
		}
	} else {
		if (system_time() - fClickTime < sActivationDelay) {
			window->Minimize(true);
			fClickTime = 0;
		} else {
			window->Activate();
			fDragOffset = ConvertToScreen(where) - window->Frame().LeftTop();
			fDragging = true;
			SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
			fClickTime = system_time();
		}
	}
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:51,代码来源:PadView.cpp

示例2: msg

void
SButton::MouseDown(BPoint where)
{
	if(!IsEnabled()) return;

	BWindow *window = Window();

	if(!(window->Flags() & B_AVOID_FOCUS)) window->Activate();

	if(tooltips)
	{
		BMessage msg(S_TOOLTIPS_CHANGED);
		msg.AddBool("state", false);
		BMessenger msgr(NULL, window);
		msgr.SendMessage(&msg);
	}

	if(!waitting_is_keyboard)
	{
		waitting = true;
		DrawDefault(Bounds(), true, window->IsActive());
		SetMouseEventMask(B_POINTER_EVENTS, B_SUSPEND_VIEW_FOCUS | B_LOCK_WINDOW_FOCUS);
		window->UpdateIfNeeded();
	}
}
开发者ID:Haiku-cn,项目名称:BeCJK,代码行数:25,代码来源:Button.cpp

示例3:

//Finds the given window name and brings it to the front.  Used when a user tries to
//open a window that is already open.
void
BeAccessibleWindow::BringWindowToFront(BString windowName)
{
	//Loop through all open windows
	for (int i = 0; i < be_app->CountWindows(); i++)
	{
		BWindow* window = be_app->WindowAt(i);
		BString windowTitle = window->Title();
		
		//Bring the window to the front if the titles match
		if (windowName == windowTitle)
		{
			window->Activate(true);
			return;
		}
	}
}
开发者ID:HaikuArchives,项目名称:BeAccessible,代码行数:19,代码来源:BeAccessibleWindow.cpp

示例4: MouseDown

// ---------------------------------------------------------------------
//! Called when user presses a mouse button.
// ---------------------------------------------------------------------
void BeSkinView::MouseDown(
	BPoint where			//!< location of the cursor
)
{
	uint32 buttons = 0;
	BMessage* message = Window()->CurrentMessage();
	if (NULL != message)
	{
		int32 value = 0;
		if (B_OK == message->FindInt32("buttons", &value))
		{
			buttons = value;
		}
	}
	if (0 == (buttons & (B_PRIMARY_MOUSE_BUTTON | B_SECONDARY_MOUSE_BUTTON)))
	{
		return;
	}

	BWindow* window = Window();
	if (!window->IsActive())
	{
		window->Activate();
	}

	// deactivate tool tip
	BMessage deactivateMessage(BeToolTipWindow::MSG_DEACTIVATE);
	toolTipMessenger->SendMessage(&deactivateMessage, static_cast<BHandler*>(NULL), 1000000);
	
	UIManager* uiManager = getUIManager();
	ASSERT(NULL != uiManager);
	if (NULL != uiManager)
	{
		if (buttons & B_PRIMARY_MOUSE_BUTTON)
		{
			uiManager->Button1Down();
			lastPressedMouseButton = 1;
		}
		else if (buttons & B_SECONDARY_MOUSE_BUTTON)
		{
			uiManager->Button2Down();
			lastPressedMouseButton = 2;
		}
	}
}
开发者ID:HaikuArchives,项目名称:CoveredCalc,代码行数:48,代码来源:BeSkinView.cpp

示例5: SetFeel

/*****************************************************************************
 * VideoWindow::SetInterfaceShowing
 *****************************************************************************/
void
VideoWindow::SetInterfaceShowing(bool showIt)
{
    BWindow* window = get_interface_window();
    if (window)
    {
        if (showIt)
        {
            if (fCachedFeel != B_NORMAL_WINDOW_FEEL)
                SetFeel(B_NORMAL_WINDOW_FEEL);
            window->Activate(true);
            SendBehind(window);
        }
        else
        {
            SetFeel(fCachedFeel);
            Activate(true);
            window->SendBehind(this);
        }
        fInterfaceShowing = showIt;
    }
}
开发者ID:shanewfx,项目名称:vlc-arib,代码行数:25,代码来源:VideoOutput.cpp

示例6: Window

void
BMenuBar::MouseDown(BPoint where)
{
	if (fTracking)
		return;

	uint32 buttons;
	GetMouse(&where, &buttons);

	BWindow* window = Window();
	if (!window->IsActive() || !window->IsFront()) {
		if ((mouse_mode() == B_FOCUS_FOLLOWS_MOUSE)
			|| ((mouse_mode() == B_CLICK_TO_FOCUS_MOUSE)
				&& ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0))) {
			// right-click to bring-to-front and send-to-back
			// (might cause some regressions in FFM)
			window->Activate();
			window->UpdateIfNeeded();
		}
	}

	StartMenuBar(-1, false, false);
}
开发者ID:naveedasmat,项目名称:haiku,代码行数:23,代码来源:MenuBar.cpp

示例7: FileTypesWindow

void
FileTypes::MessageReceived(BMessage *message)
{
	switch (message->what) {
		case kMsgSettingsChanged:
			fSettings.UpdateFrom(message);
			break;

		case kMsgOpenTypesWindow:
			if (fTypesWindow == NULL) {
				fTypesWindow = new FileTypesWindow(fSettings.Message());
				fTypesWindow->Show();
				fWindowCount++;
			} else
				fTypesWindow->Activate(true);
			break;
		case kMsgTypesWindowClosed:
			fTypesWindow = NULL;
			_WindowClosed();
			break;

		case kMsgOpenApplicationTypesWindow:
			if (fApplicationTypesWindow == NULL) {
				fApplicationTypesWindow = new ApplicationTypesWindow(
					fSettings.Message());
				fApplicationTypesWindow->Show();
				fWindowCount++;
			} else
				fApplicationTypesWindow->Activate(true);
			break;
		case kMsgApplicationTypesWindowClosed:
			fApplicationTypesWindow = NULL;
			_WindowClosed();
			break;

		case kMsgTypeWindowClosed:
			fTypeWindowCount--;
			// supposed to fall through

		case kMsgWindowClosed:
			_WindowClosed();
			break;


		case kMsgOpenFilePanel:
		{
			// the open file panel sends us a message when it's done
			const char* subTitle;
			if (message->FindString("title", &subTitle) != B_OK)
				subTitle = B_TRANSLATE("Open file");

			int32 what;
			if (message->FindInt32("message", &what) != B_OK)
				what = B_REFS_RECEIVED;

			BMessenger target;
			if (message->FindMessenger("target", &target) != B_OK)
				target = be_app_messenger;

			BString title = B_TRANSLATE("FileTypes");
			if (subTitle != NULL && subTitle[0]) {
				title.Append(": ");
				title.Append(subTitle);
			}

			fFilePanel->SetMessage(new BMessage(what));
			fFilePanel->Window()->SetTitle(title.String());
			fFilePanel->SetTarget(target);

			if (!fFilePanel->IsShowing())
				fFilePanel->Show();
			break;
		}

		case B_SILENT_RELAUNCH:
			// In case we were launched via the add-on, there is no types
			// window yet.
			if (fTypesWindow == NULL)
				PostMessage(kMsgOpenTypesWindow);
			break;

		case B_CANCEL:
			if (fWindowCount == 0)
				PostMessage(B_QUIT_REQUESTED);
			break;

		case B_SIMPLE_DATA:
			RefsReceived(message);
			break;

		default:
			BApplication::MessageReceived(message);
			break;
	}
}
开发者ID:mariuz,项目名称:haiku,代码行数:95,代码来源:FileTypes.cpp

示例8: OpenWindow

void
DiskProbe::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case kMsgOpenOpenWindow:
			if (fOpenWindow == NULL) {
				fOpenWindow = new OpenWindow();
				fOpenWindow->Show();
				fWindowCount++;
			} else
				fOpenWindow->Activate(true);
			break;

		case kMsgOpenWindowClosed:
			fOpenWindow = NULL;
			// supposed to fall through
		case kMsgWindowClosed:
			if (--fWindowCount == 0 && !fFilePanel->IsShowing())
				PostMessage(B_QUIT_REQUESTED);
			break;

		case kMsgSettingsChanged:
			fSettings.UpdateFrom(message);
			break;

		case kMsgFindWindowClosed:
			fFindWindow = NULL;
			break;
		case kMsgFindTarget:
		{
			BMessenger target;
			if (message->FindMessenger("target", &target) != B_OK)
				break;

			if (fFindWindow != NULL && fFindWindow->Lock()) {
				fFindWindow->SetTarget(target);
				fFindWindow->Unlock();
			}
			break;
		}
		case kMsgOpenFindWindow:
		{
			BMessenger target;
			if (message->FindMessenger("target", &target) != B_OK)
				break;

			if (fFindWindow == NULL) {
				// open it!
				fFindWindow = new FindWindow(fWindowFrame.OffsetByCopy(80, 80),
					*message, target, &fSettings.Message());
				fFindWindow->Show();
			} else
				fFindWindow->Activate();
			break;
		}

		case kMsgOpenFilePanel:
			fFilePanel->Show();
			break;
		case B_CANCEL:
			if (fWindowCount == 0)
				PostMessage(B_QUIT_REQUESTED);
			break;

		default:
			BApplication::MessageReceived(message);
			break;
	}
}
开发者ID:looncraz,项目名称:haiku,代码行数:69,代码来源:DiskProbe.cpp

示例9: MessageReceived

// Handling of user interface and other events
void MainWindow::MessageReceived(BMessage *message)
{
	switch(message->what){
		case SELECTION_CHANGED:
			BRow *row;
			row = teamView->RowAt(message->FindInt32("index"));

			if(row != NULL && message->FindInt32("buttons") == B_SECONDARY_MOUSE_BUTTON){
				BPoint point;
				uint32 state;
				teamView->GetMouse(&point,&state);

				BPoint p2 = teamView->ConvertToScreen(point);
				p2.x -= 5.0;
				p2.y -= 5.0;
				//if(fItemMenu->FindMarked())
				//	fItemMenu->FindMarked()->SetMarked(false);

				teamView->SelectionMessage()->ReplaceInt32("buttons",0);
				teamView->ActionMenu()->Go(p2, true, true, true);
				//fItemMenu->Go(p2, true, true, true);
			}
			SetButtonState();
			break;
		case IE_MAINWINDOW_MAINMENU_ACTION_KILL:
		case IE_MAINWINDOW_MAINKILL:
			DoKill();
		 	UpdateTeams();
		 	SetButtonState();
			break;
		case IE_MAINWINDOW_MAINMENU_ACTION_SUSPEND:
		case IE_MAINWINDOW_MAINSUSPEND:
			DoSuspend();
			UpdateTeams();
			SetButtonState();
			break;
		case IE_MAINWINDOW_MAINMENU_ACTION_RESUME:
		case IE_MAINWINDOW_MAINRESUME:
			DoResume();
			UpdateTeams();
			SetButtonState();
			break;
		case SET_PRIORITY: {
			int32 priority = message->FindInt32("priority");
			DoPriority(priority);
			UpdateTeams();
			SetButtonState();
			break;
		}
		case IE_MAINWINDOW_MAINPRIORITYVALUE:
			// takes priority from text field
			DoPriority();
			UpdateTeams();
			SetButtonState();
			break;
		case IE_MAINWINDOW_MAINUPDATE:
			UpdateTeams();
			SetButtonState();
			break;
		case B_ABOUT_REQUESTED:    // "About…" is selected from menu…
		{
			BAboutWindow* fAboutWin = new BAboutWindow(B_TRANSLATE_SYSTEM_NAME("Slayer"), slayer_signature);
			fAboutWin->AddDescription(B_TRANSLATE("A thread manager for Haiku"));
			fAboutWin->SetVersion(SLAYER_VERSION);
			fAboutWin->AddCopyright(1999, "Arto Jalkanen");
			const char* authors[] = {
				"Arto Jalkanen ([email protected])",
				NULL
			};
			fAboutWin->AddAuthors(authors);
			fAboutWin->Show();
		}
			break;
		case IE_MAINWINDOW_MAINMENU_FILE_DOCS__:
		{
			BMessage message(B_REFS_RECEIVED);
			message.AddString("url", ProjectWebsite);
			be_roster->Launch("text/html", &message);
		}
			break;
		case IE_MAINWINDOW_MAINMENU_FILE_QUIT:    // "Quit" is selected from menu…
			be_app->PostMessage(B_QUIT_REQUESTED);
			break;
		case IE_MAINWINDOW_MAINMENU_WINDOWS_SETTINGS:
		{
			const char* windowSettingsTitle = B_TRANSLATE("Settings");
			BWindow *settings = slayer->FindWindow(windowSettingsTitle);
			if (!settings)
				new SettingsWindow(windowSettingsTitle);
			else if (settings->Lock()) {
				settings->Activate(true);
				settings->Unlock();
			}
		}
			break;
		default:
			BWindow::MessageReceived(message);
			break;
	}
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:Slayer,代码行数:101,代码来源:MainWindow.cpp

示例10: MouseDown

void BitmapView::MouseDown( BPoint cPosition )
{
	MakeFocus( true );

	Icon* pcIcon = FindIcon( cPosition );

	if ( pcIcon != NULL )
	{
		if (  pcIcon->m_bSelected )
		{
			if ( m_nHitTime + 500000 >= system_time() )
			{
				if ( pcIcon->GetName() == "Root (List)" )
				{
					BWindow*   pcWindow = new DirWindow( BRect( 200, 150, 600, 400 ), "/" );
					pcWindow->Activate();
				}
				else if ( pcIcon->GetName() == "Root (Icon)" )
				{
					BWindow*   pcWindow = new DirIconWindow( BRect( 20, 20, 359, 220 ), "/", g_pcBackDrop );
					pcWindow->Activate();
				}
				else  if ( pcIcon->GetName() == "Terminal" )
				{
					pid_t nPid = fork();
					if ( nPid == 0 )
					{
						set_thread_priority( -1, 0 );
						execlp( "cterm", "cterm", NULL );
						exit( 1 );
					}
				}
				else  if ( pcIcon->GetName() == "Prefs" )
				{
					pid_t nPid = fork();
					if ( nPid == 0 )
					{
						set_thread_priority( -1, 0 );
						execlp( "guiprefs", "guiprefs", NULL );
						exit( 1 );
					}
				}
				else  if ( pcIcon->GetName() == "Pulse" )
				{
					pid_t nPid = fork();
					if ( nPid == 0 )
					{
						set_thread_priority( -1, 0 );
						execlp( "pulse", "pulse", NULL );
						exit( 1 );
					}
				}
				else  if ( pcIcon->GetName() == "Calculator" )
				{
					pid_t nPid = fork();
					if ( nPid == 0 )
					{
						set_thread_priority( -1, 0 );
						execlp( "calc", "calc", NULL );
						exit( 1 );
					}
				}
				else  if ( pcIcon->GetName() == "Editor" )
				{
					pid_t nPid = fork();
					if ( nPid == 0 )
					{
						set_thread_priority( -1, 0 );
						execlp( "aedit", "aedit", NULL );
						exit( 1 );
					}
				}
				else  if ( pcIcon->GetName() == "Guido" )
				{
					pid_t nPid = fork();
					if ( nPid == 0 )
					{
						set_thread_priority( -1, 0 );
						execlp( "guido", "guido", NULL );
						exit( 1 );
					}
				}
			}
			else
			{
				m_bCanDrag = true;
			}
			m_nHitTime = system_time();
			return;
		}
	}

	for ( uint i = 0 ; i < m_cIcons.size() ; ++i )
	{
		m_cIcons[i]->Select( this, false );
	}

	if ( pcIcon != NULL )
	{
		m_bCanDrag = true;
//.........这里部分代码省略.........
开发者ID:Ithamar,项目名称:cosmoe,代码行数:101,代码来源:main.cpp

示例11: AboutRequested

void Shisen::AboutRequested(void)
{
BWindow *about = NULL;
thread_id id;


	id = find_thread("w>About BShisen");
	if (id != B_NAME_NOT_FOUND)
	{
		about = (BWindow *)LooperForThread(id);
	}

	if (about)
	{
		about->SetWorkspaces(B_CURRENT_WORKSPACE);
		about->Activate();
	}
	else
	{
		BView *back;
		BStringView *str;
		BBitmap *bmap;
		
		about = new BWindow(BRect(50, 50, 360, 190), 
			_("ABOUT_BSHISEN","About BShisen"),
			B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE);
		
		back = new BView(about->Bounds(), NULL, B_FOLLOW_NONE, B_WILL_DRAW);
		back->SetViewColor(0, 0, 0);	//black background
		about->AddChild(back);
	
	
		str = new BStringView(BRect(100, 10, 310, 30), NULL, "BShisen 1.5.0-alpha");
		str->SetFontSize(14);
		str->SetHighColor(0,255,0);
		back->AddChild(str);
	
		str = new BStringView(BRect(100, 35, 310, 55), NULL,
			"(c) 1999-2014 Kelvin W Sherlock"
						);
		str->SetFontSize(12);
		str->SetHighColor(0,255,0);
		back->AddChild(str);
	
		str = new BStringView(BRect(100, 60, 310, 80), NULL,
			"Maintainer: [email protected]");
		str->SetFontSize(10);
		str->SetHighColor(0,255,0);
		back->AddChild(str);


#if BUILD == SHAREWARE	
		if (!REGISTERED) //70, 90
		{
			str = new BStringView(BRect(30, 85, 310, 105), NULL, "UNREGISTERED - PLEASE REGISTER");
			str->SetFontSize(12);
			str->SetHighColor(255,0,0);
			back->AddChild(str);
		}
#endif

#if BUILD == BEGROOVY
	{
			str = new BStringView(BRect(100, 95, 310, 110), NULL, 
				"Get your groove on - BeGroovy");
			str->SetFontSize(12);
			str->SetHighColor(255,0,0);
			back->AddChild(str);
			
			str = new BStringView(BRect(100, 110, 310, 130), NULL, 
				"www.BeGroovy.com");
			str->SetFontSize(14);
			str->SetHighColor(255,0,0);
			back->AddChild(str);
	
	}
#endif

#if BUILD == CUSTOM
	{
			str = new BStringView(BRect(100, 95, 310, 110), NULL, 
				B_UTF8_OPEN_QUOTE "It's the same train, but it's different."B_UTF8_CLOSE_QUOTE);
			str->SetFontSize(10);
			str->SetHighColor(255,0,0);
			back->AddChild(str);
			
			str = new BStringView(BRect(100, 110, 310, 130), NULL, 
				 B_UTF8_OPEN_QUOTE "Based on 1.2pre sources (Released 2014)" B_UTF8_CLOSE_QUOTE);
			str->SetFontSize(10);
			str->SetHighColor(255,0,0);
			back->AddChild(str);
	
	}
#endif

//		Pistooli: Again too lazy to search for ABOUT_PIC_ID, put TIFF into Resource File
		bmap = BTranslationUtils::GetBitmap(B_TIFF_FORMAT, 1);		
//		bmap = BTranslationUtils::GetBitmap(B_RAW_TYPE, ABOUT_PIC_ID);
		if (bmap)
		{
//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:BShisen,代码行数:101,代码来源:Shisen.cpp

示例12: FileTypesWindow

void
FileTypes::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case kMsgSettingsChanged:
			fSettings.UpdateFrom(message);
			break;

		case kMsgOpenTypesWindow:
			if (fTypesWindow == NULL) {
				fTypesWindow = new FileTypesWindow(fSettings.Message());
				if (fArgvType.Length() > 0) {
					// Set the window to the type that was requested on the
					// command line (-type), we do this only once, if we
					// ever opened more than one FileTypesWindow.
					fTypesWindow->SelectType(fArgvType.String());
					fArgvType = "";
				}
				fTypesWindow->Show();
				fWindowCount++;
			} else
				fTypesWindow->Activate(true);
			break;
		case kMsgTypesWindowClosed:
			fTypesWindow = NULL;
			_WindowClosed();
			break;

		case kMsgOpenApplicationTypesWindow:
			if (fApplicationTypesWindow == NULL) {
				fApplicationTypesWindow = new ApplicationTypesWindow(
					fSettings.Message());
				fApplicationTypesWindow->Show();
				fWindowCount++;
			} else
				fApplicationTypesWindow->Activate(true);
			break;
		case kMsgApplicationTypesWindowClosed:
			fApplicationTypesWindow = NULL;
			_WindowClosed();
			break;

		case kMsgTypeWindowClosed:
			fTypeWindowCount--;
			// supposed to fall through

		case kMsgWindowClosed:
			_WindowClosed();
			break;


		case kMsgOpenFilePanel:
		{
			// the open file panel sends us a message when it's done
			const char* subTitle;
			if (message->FindString("title", &subTitle) != B_OK)
				subTitle = B_TRANSLATE("Open file");

			int32 what;
			if (message->FindInt32("message", &what) != B_OK)
				what = B_REFS_RECEIVED;

			BMessenger target;
			if (message->FindMessenger("target", &target) != B_OK)
				target = be_app_messenger;

			BString title = B_TRANSLATE("FileTypes");
			if (subTitle != NULL && subTitle[0]) {
				title.Append(": ");
				title.Append(subTitle);
			}

			uint32 flavors = B_FILE_NODE;
			if (message->FindBool("allowDirs"))
				flavors |= B_DIRECTORY_NODE;
			fFilePanel->SetNodeFlavors(flavors);


			fFilePanel->SetMessage(new BMessage(what));
			fFilePanel->Window()->SetTitle(title.String());
			fFilePanel->SetTarget(target);

			if (!fFilePanel->IsShowing())
				fFilePanel->Show();
			break;
		}

		case B_SILENT_RELAUNCH:
			// In case we were launched via the add-on, there is no types
			// window yet.
			if (fTypesWindow == NULL)
				PostMessage(kMsgOpenTypesWindow);
			break;

		case B_CANCEL:
			if (fWindowCount == 0)
				PostMessage(B_QUIT_REQUESTED);
			break;

		case B_SIMPLE_DATA:
//.........这里部分代码省略.........
开发者ID:AmirAbrams,项目名称:haiku,代码行数:101,代码来源:FileTypes.cpp

示例13: OpenWindow

CDoc* PApp::OpenWindow(const entry_ref& doc, bool show)
{
	try
	{
		BNode n(&doc);
		char mime[256];

		BNodeInfo ni(&n);
		if (ni.GetType(mime) != B_OK)
			mime[0] = 0;

		if (gPrefs->GetPrefInt(prf_I_AutodetectProjects, 1)) {
			if (!strcmp(doc.name, "Jamfile"))
				ni.SetType("text/x-jamfile");
			else if (!strcasecmp(doc.name, "Makefile"))
				ni.SetType("text/x-makefile");
			ni.GetType(mime);
		}

		if (strcmp(mime, "text/x-vnd.Hekkel-Pe-Group") == 0 ||
			strcmp(mime, "text/x-pe-group") == 0)
		{
			PGroupWindow *w = dynamic_cast<PGroupWindow*>(CDoc::FindDoc(doc));
			if (w)
			{
				if (gPrefs->GetPrefInt(prf_I_SmartWorkspaces, 1))
					w->SetWorkspaces(1 << current_workspace());
				if (show)
					w->Activate(true);
				return CDoc::FindDoc(doc);
			}
			else
				return new PGroupWindow(&doc);
		}
		else if (ProjectRoster->IsProjectType(mime))
		{
			BWindow *w = dynamic_cast<BWindow*>(CDoc::FindDoc(doc));
			if (w)
			{
				if (gPrefs->GetPrefInt(prf_I_SmartWorkspaces, 1))
					w->SetWorkspaces(1 << current_workspace());
				if (show)
					w->Activate(true);
				return CDoc::FindDoc(doc);
			}
			else
			{
				PProjectWindow* prjWin = PProjectWindow::Create(&doc, mime);
				if (prjWin && prjWin->InitCheck() == B_OK)
				{
					prjWin->Show();
					return prjWin;
				}
				else
				{
					delete prjWin;
					return gApp->NewWindow(&doc);
				}
			}
		}
		else
		{
			PDoc *d = dynamic_cast<PDoc*>(CDoc::FindDoc(doc));
			if (d)
			{
				if (gPrefs->GetPrefInt(prf_I_SmartWorkspaces, 1))
					d->SetWorkspaces(1 << current_workspace());
				if (show)
					d->Activate(true);
				return CDoc::FindDoc(doc);
			}
			else
				return NewWindow(&doc, show);
		}
	}
	catch (HErr& e)
	{
		e.DoError();
	}

	return NULL;
} /* PApp::OpenWindow */
开发者ID:jscipione,项目名称:Paladin,代码行数:82,代码来源:PApp.cpp


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