Beispiel #1
0
void CMainFrame::SwapView()
{
	//if we are already showing the right view, bail, nothing to do.
	DWORD nCmdID = LOWORD(GetCurrentMessage()->wParam);   
	if((nCmdID == ID_VIEW_SOURCE) && (m_dwCurrentView == ID_VIEW_SOURCE))
		return;
	if((nCmdID == ID_VIEW_WEB) && (m_dwCurrentView == ID_VIEW_WEB))
		return;

	SwapView(nCmdID);
}
void PluginUIWindow::MessageReceived(BMessage *msg)
{
	switch(msg->what)
	{
		case JE_LOAD_UI:
		{
			void *view = NULL;
			
			if (msg->FindPointer("view", &view) == B_OK)
			{
				//printf("PluginUIWindow::MessageReceived(JE_LOAD_UI)\n");
				//printf("view = %p\n", view);
				// show the window if we're hidden
				if (IsHidden())
					Show();
				// swap out the view
				//pluginUI->SwapView(reinterpret_cast<BView *>(view));
				SwapView(reinterpret_cast<BView *>(view));
			}
			
			break;
		}
		case JE_UNLOAD_UI:
		{
			//printf("PluginUIWindow::MessageReceived(JE_UNLOAD_UI)\n");
			int32 kill=0;
			
			// just send it a NULL pointer
			//pluginUI->SwapView(NULL);
			SwapView(NULL);
			
			// hide the window (unless it's already hidden)
			if (!IsHidden())
				Hide();
			
			// we only unload the plugin if "kill" is in the msg
			// otherwise we just unload the UI here
			if (msg->FindInt32("kill", &kill) == B_OK)
			{
				BMessage app_msg(*msg); // copy
				// change the 'what' of app_msg
				app_msg.what = JE_UNLOAD_PLUGIN;
				// send
				be_app->PostMessage(&app_msg);
			}
			
			break;
		}
		case JE_APP_IS_QUITTING:
		{
			// we're quitting
			// it's now ok to kill ourself
			okToClose = true;
			PostMessage(B_QUIT_REQUESTED);
		}
		default:
		{
			BWindow::MessageReceived(msg);
			break;
		}
	}
}
Beispiel #3
0
void CMainFrame::OnViewWeb() 
{
	SwapView();
}
Beispiel #4
0
void CMainFrame::OnViewSource() 
{
	SwapView();	
}