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


C++ BFilePanel::Show方法代码示例

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


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

示例1: 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

示例2: run_template_loader

void run_template_loader()
{
TemplateLooper *looper;
BMessenger *messenger;
BFilePanel *panel;

	// create looper to deliver it to
	looper = new TemplateLooper();
	looper->Run();
	messenger = new BMessenger(NULL, looper);

	// set starting dir to that of template directory
	entry_ref start_dir;
	GetTemplateDirectoryRef(&start_dir);

	// create panel
	panel = new BFilePanel(B_OPEN_PANEL, messenger, &start_dir, 0, true, new BMessage(M_TEMPLATE_LOAD), NULL, true);
	panel->Window()->SetTitle("New from Template");
	
	// and away we go
	if (TemplatePanel) delete TemplatePanel;
	TemplatePanel = panel;
	
	panel->Show();
}
开发者ID:HaikuArchives,项目名称:Sisong,代码行数:25,代码来源:Templates.cpp

示例3: BMessenger

struct gui_download_window *gui_download_window_create(download_context *ctx,
		struct gui_window *parent)
{
	struct gui_download_window *download = (struct gui_download_window*)malloc(sizeof *download);
	if (download == NULL)
		return NULL;

	download->storageLock = new BLocker("storage_lock");
	download->storage = new BMallocIO();
	download->ctx = ctx;

	download->window = new NSDownloadWindow(ctx);

	// Also ask the user where to save the file
	BMessage* msg = new BMessage(B_SAVE_REQUESTED);

	BFilePanel* panel = new BFilePanel(B_SAVE_PANEL,
		new BMessenger(download->window), NULL, 0, false);

	panel->SetSaveText(download_context_get_filename(ctx));

	msg->AddPointer("source", panel);
	msg->AddPointer("dw", download);
	panel->SetMessage(msg);
	
	panel->Show();

	return download;
}
开发者ID:pombredanne,项目名称:NetSurf,代码行数:29,代码来源:download.cpp

示例4: run_template_saver

// pop up the Save box for a template, and have it save a copy of the current document.
void run_template_saver()
{
TemplateLooper *looper;
BMessage *message;
BMessenger *messenger;
BFilePanel *panel;

	// create message to deliver when done
	message = new BMessage(M_TEMPLATE_SAVE);
	message->AddInt32("DocID", editor.curev->DocID);

	// create looper to deliver it to
	looper = new TemplateLooper();
	looper->Run();
	messenger = new BMessenger(NULL, looper);

	// set starting dir to that of template directory
	entry_ref start_dir;
	GetTemplateDirectoryRef(&start_dir);

	// create panel
	panel = new BFilePanel(B_SAVE_PANEL, messenger, &start_dir, 0, false, message, NULL, true);
	
	// set window title
	BString title;
	title << "Save as Template: " << GetFileSpec(editor.curev->filename);	
	panel->Window()->SetTitle(title.String());
	
	// and away we go
	if (TemplatePanel) delete TemplatePanel;
	TemplatePanel = panel;
	
	panel->Show();
}
开发者ID:HaikuArchives,项目名称:Sisong,代码行数:35,代码来源:Templates.cpp

示例5: TemplateLooper

char *run_template_selector(BMessage msg_to_deliver, BMessenger target)
{
TemplateLooper *looper;
BMessenger *messenger;
BFilePanel *panel;
BMessage *msg;

	// create looper to deliver it to
	looper = new TemplateLooper();
	looper->Run();
	messenger = new BMessenger(NULL, looper);

	msg = new BMessage(M_TEMPLATE_SELECT);
	msg->AddMessage("message", &msg_to_deliver);
	msg->AddMessenger("target", target);
	
	// set starting dir to that of template directory
	entry_ref start_dir;
	GetTemplateDirectoryRef(&start_dir);

	// create panel
	panel = new BFilePanel(B_OPEN_PANEL, messenger, &start_dir, 0, false, msg, NULL, true);
	panel->Window()->SetTitle("Select Template");
	
	// and away we go
	if (TemplatePanel) delete TemplatePanel;
	TemplatePanel = panel;
	
	panel->Show();
}
开发者ID:HaikuArchives,项目名称:Sisong,代码行数:30,代码来源:Templates.cpp

示例6:

void
PackageInstaller::ReadyToRun()
{
	// We're ready to run - if no windows are yet visible, this means that
	// we should show a open panel
	if (fWindowCount == 0)
		fOpenPanel->Show();
}
开发者ID:MaddTheSane,项目名称:haiku,代码行数:8,代码来源:main.cpp

示例7: MessageReceived

void ReloadedWin::MessageReceived(BMessage* mess)
{
    int k;
    int m;

    switch(mess->what)
    {
    case B_KEY_DOWN:
    case B_UNMAPPED_KEY_DOWN:
        m = mess->FindInt32("modifiers");
        k = mess->FindInt32("key");
        REmulator::getInstance()->PressKey(k,m);
        break;
    case B_KEY_UP:
    case B_UNMAPPED_KEY_UP:
        m = mess->FindInt32("modifiers");
        k = mess->FindInt32("key");
        REmulator::getInstance()->ReleaseKey(k,m);
        break;

    case 'rfsh':
        fBitmapView->Invalidate();
        break;

    case 'dins':
    {
        BFilePanel* f = new BFilePanel(B_OPEN_PANEL, &be_app_messenger,
                                       NULL, B_FILE_NODE, false);
        f->Show();
        break;
    }

    case 'kymp':
    {
        KeymapWindow* kwin = new KeymapWindow();
        kwin->Show();
        break;
    }

    case 'fled':
    {
        // Draw FDC LED
        bool status;
        mess->FindBool("status", &status);
        if (status)
            fStatusLed->SetViewColor(0xFF,00,00);
        else
            fStatusLed->SetViewColor(0x77,00,00);
        fStatusLed->Invalidate();
        break;
    }

    default:
        BWindow::MessageReceived(mess);
        break;
    }
}
开发者ID:pedgarcia,项目名称:cpcsdk,代码行数:57,代码来源:RWin.cpp

示例8: getMountFolder

		// getMountFolder()
		//
		void getMountFolder()
		{
			char path[B_PATH_NAME_LENGTH];
			entry_ref entryRef;

			find_directory(B_USER_DIRECTORY, 0, false, path, sizeof(path));
			BEntry entry(path, false);
			entry.GetRef(&entryRef);
			BFilePanel *filePanel = new BFilePanel(B_OPEN_PANEL, &be_app_messenger, &entryRef, B_DIRECTORY_NODE, false);
			filePanel->Show();
			filePanel->Window()->SetTitle("Mount Location");
			filePanel->SetButtonLabel(B_DEFAULT_BUTTON, "Mount");
		}
开发者ID:HaikuArchives,项目名称:BeServed,代码行数:15,代码来源:MyNetApp.cpp

示例9: msg


//.........这里部分代码省略.........


	//bool handled (false);

// ignore this part until some minor details with DCC Prefs are worked out
/*
		const char *directory = "/boot/home/";
		entry_ref ref;
		BEntry entry;

		create_directory (directory, 0777);
		if (entry.SetTo (directory) == B_NO_ERROR 
		if (entry.GetRef (&ref)     == B_NO_ERROR)
		{
			BDirectory dir (&ref);
			BEntry file_entry; 
			struct stat s;

			if (file_entry.SetTo (&dir, file.String()) == B_NO_ERROR
			&&  file_entry.GetStat (&s)       == B_NO_ERROR
			&&  S_ISREG (s.st_mode))
			{
				BString buffer;
				BAlert *alert;
				int32 which;

				buffer << "The file \""
					<< file
					<< "\" already exists in the specified folder.  "
						"Do you want to continue the transfer?";

				alert = new BAlert (
					"DCC Request",
					buffer.String(),
					"Refuse",
					"Get",
					"Resume",
					B_WIDTH_AS_USUAL,
					B_OFFSET_SPACING,
					B_WARNING_ALERT);

				which = alert->Go();

				if (which == 0)
				{
					return;
				}

				if (which == 2)
				{
					BFile file (&file_entry, B_READ_ONLY);
					off_t position;
					BPath path;

					file.GetSize (&position);
					file_entry.GetPath (&path);
					msg.AddString ("path", path.Path());
					msg.AddInt64 ("pos", position);

					AddResumeData (&msg);
					return;
				}
			}

			msg.AddRef ("directory", &ref);
			msg.AddString ("name", file);
			sMsgr.SendMessage (&msg);
			handled = true;
		}
	}
*/
	BFilePanel *panel;
	BString text;

	text << nick
		<< ": "
		<< file
		<< " ("
		<< size
		<< " bytes)";

	panel = new BFilePanel (
		B_SAVE_PANEL,
		&sMsgr,
		0,
		0,
		false,
		&msg);
	panel->SetButtonLabel (B_DEFAULT_BUTTON, "Accept");
	panel->SetButtonLabel (B_CANCEL_BUTTON, "Refuse");
	panel->SetSaveText (file.String());

	if (panel->Window()->Lock())
	{
		panel->Window()->SetTitle (text.String());
		panel->Window()->AddFilter (new DCCFileFilter (panel, msg));
		panel->Window()->Unlock();
	}
	panel->Show();
}
开发者ID:,项目名称:,代码行数:101,代码来源:

示例10: fileNameNoExt


//.........这里部分代码省略.........
					*/
				}
			}
			// comment start
			header.ReplaceAll("%COMMS%", commentBlockStart.String());
			// comment cont'd
			header.ReplaceAll("%COMMC%", commentBlockCont.String());
			// comment cont'd lazy (blank if possible)
			header.ReplaceAll("%COMML%", commentBlockLazy.String());
			// comment end
			header.ReplaceAll("%COMME%", commentBlockEnd.String());
			// comment line end
			commentBlockLineEnd << "\n";
			header.ReplaceAll("\n", commentBlockLineEnd.String());


			err = B_OK;
			break;
		}
		case 'optf':
		{
			const char *args[] = {path.Path(), NULL};
			err = be_roster->Launch(sTrackerSig, 1, (char **)args);
			//printf("err %s\n", strerror(err));
			err = B_CANCELED;
			break;
		}
		case 'seta':
		{
			MimeRefFilter filter("application/x-person");
			BPath path;
			entry_ref people;

			if (find_directory(B_USER_DIRECTORY, &path) == B_OK)
			{
				path.Append("people");
				get_ref_for_path(path.Path(), &people);
			}

			BFilePanel *panel;
			panel = new BFilePanel(B_OPEN_PANEL, NULL, &people,
				B_FILE_NODE, false, NULL, &filter);
			// trick to synchronously use BFilePanel
			PanelHandler *handler = new PanelHandler;
			if (panel->Window()->Lock())
			{
				panel->Window()->AddHandler(handler);
				panel->Window()->Unlock();
			}
			panel->SetTarget(BMessenger(handler));
			panel->Show();
			if (handler->Wait() < B_OK)
				break;
			if (!handler->Message())
				break;
			if (handler->Message()->what == B_CANCEL)
				break;
			entry_ref ref;
			//panel->Message()->PrintToStream();
			if (panel->GetNextSelectedRef(&ref) == B_OK)
			{
				//printf("ref:%s\n", ref.name);
				path.SetTo(&ref);
				dir.WriteAttr("pe:author_people", B_STRING_TYPE, 0LL, 
					path.Path(), strlen(path.Path()));
			}
			delete panel;
			delete handler;
			err = B_CANCELED;
			break;
		}
		case B_ABOUT_REQUESTED:
		{
			BString tmpPath("/tmp/Pe-HeaderHeader-About-");
			tmpPath << system_time() << "-" << getpid() << ".txt";
			entry_ref ref;
			get_ref_for_path(tmpPath.String(), &ref);
			{
				BFile f(&ref, B_CREATE_FILE | B_WRITE_ONLY);
				err = f.InitCheck();
				if (err < 0)
					break;
				f.Write(sAboutText, strlen(sAboutText));
				f.SetPermissions(0444);
			}
			BMessage msg(B_REFS_RECEIVED);
			msg.AddRef("refs", &ref);
			err = be_app_messenger.SendMessage(&msg);
			err = B_CANCELED;
			break;
		}
		case 0:
			err = B_CANCELED;
			break;
		default:
			break;
	}
	delete menu;
	return err;
}
开发者ID:HaikuArchives,项目名称:Pe,代码行数:101,代码来源:HeaderHeader.cpp

示例11: OpenSaveFilePanel

/*
	open a file panel and ask for a PDF file
	the file panel will tell by itself if openning have been cancelled
	or not.
*/
void BepdfApplication::OpenSaveFilePanel(BHandler* handler, bool fileMode, BRefFilter* filter, BMessage* msg, const char* name) {
	BFilePanel* panel = NULL;

	// lazy construct file panel
	if (fileMode) {
		// file panel for selection of file
		if (mSaveFilePanel == NULL) {
			mSaveFilePanel = new BFilePanel (B_SAVE_PANEL,
							NULL, NULL, B_FILE_NODE, false, NULL, NULL, true);
		}

		// hide other file panel
		if (mSaveToDirectoryFilePanel != NULL && mSaveToDirectoryFilePanel->IsShowing()) {
			mSaveToDirectoryFilePanel->Hide();
		}

		panel = mSaveFilePanel;
	} else {
		// file panel for selection of directory
		if (mSaveToDirectoryFilePanel == NULL) {
			mSaveToDirectoryFilePanel = new BFilePanel (B_OPEN_PANEL,
							NULL, NULL, B_DIRECTORY_NODE, false, NULL, NULL, true);
		}

		// hide other file panel
		if (mSaveFilePanel != NULL && mSaveFilePanel->IsShowing()) {
			mSaveFilePanel->Hide();
		}

		panel = mSaveToDirectoryFilePanel;
	}

	// (re)-set to directory of currently opened PDF file
	// TODO decide if directory should be independent from PDF file
	panel->SetPanelDirectory(mSettings->GetPanelDirectory());

	if (name != NULL) {
		panel->SetSaveText(name);
	}
	else if (fileMode) {
		panel->SetSaveText("");
	}

	// set/reset filter
	panel->SetRefFilter(filter);

	// add kind to message
	BMessage message(B_SAVE_REQUESTED);
	if (msg == NULL) {
		msg = &message;
	}
	panel->SetMessage(msg);

	// set target
	BMessenger msgr(handler);
	panel->SetTarget(msgr);

	panel->Refresh();

	panel->Show();
}
开发者ID:HaikuArchives,项目名称:BePDF,代码行数:66,代码来源:BepdfApplication.cpp

示例12: YabFilePanelLooper

BEntry *YabFilePanel::MyFilePanel(const char *name, const char *directory, const char* filename, int mode)
{
	BEntry *myEntry = NULL;
	entry_ref ref;

	sem_id semaphore = create_sem(0, "yabfilepanel");
	YabFilePanelLooper *myLooper = new YabFilePanelLooper(semaphore);
	myLooper->Run();
	
	if(directory)
	{
		myEntry=new BEntry(directory);
		if(myEntry->GetRef(&ref)!=B_OK)
		{
			myEntry->Unset();
			myEntry->SetTo("/boot/home/");
			myEntry->GetRef(&ref);
		}
		myEntry->Unset();
		delete myEntry;
	}

	BFilePanel *myFilePanel = NULL; 
	switch(mode)
	{
		case 0:
			myFilePanel = new BFilePanel(B_OPEN_PANEL, new BMessenger(myLooper, myLooper), &ref, B_FILE_NODE, false, NULL, NULL, true, true);
			break;
		case 1:
			myFilePanel = new BFilePanel(B_SAVE_PANEL, new BMessenger(myLooper, myLooper), &ref, B_FILE_NODE, false, NULL, NULL, true, true);
			if (filename) myFilePanel->SetSaveText(filename);
			break;
		case 2:
			myFilePanel = new BFilePanel(B_OPEN_PANEL, new BMessenger(myLooper, myLooper), &ref, B_DIRECTORY_NODE, false, NULL, NULL, true, true);
			break;
		case 3:
			myFilePanel = new BFilePanel(B_OPEN_PANEL, new BMessenger(myLooper, myLooper), &ref, B_FILE_NODE|B_DIRECTORY_NODE, false, NULL, NULL, true, true);
			break;
	}

	if(name) myFilePanel->Window()->SetTitle(name);
	myFilePanel->Show();

	bool inloop = true;
	while(inloop)
	{
		while(acquire_sem_etc(semaphore, 1, B_RELATIVE_TIMEOUT, 10000)==B_TIMED_OUT) ;

		myEntry = myLooper->GetChosenFile();
		inloop = false;
/*
		if(mode!=2) 
			inloop = false;
		else
		{
			if(myEntry->IsDirectory())
				inloop = false;
			else
			{
				myFilePanel->Show();
			}
		}
*/
	}
	myLooper->Lock();
	myLooper->Quit();

	delete_sem(semaphore);
	delete myFilePanel;
	return myEntry;
}
开发者ID:HaikuArchives,项目名称:Yab,代码行数:71,代码来源:YabFilePanel.cpp

示例13: 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

示例14: filerequester

SDL_bool filerequester( struct machine *oric, char *title, char *path, char *fname, int type )
{
	BFilePanel *panel;
	PanelLooper *looper = new PanelLooper();
	looper->Run();
	SDL_bool ret;

  char *pat;
  bool dosavemode = false;
  
  switch( type )
  {
    case FR_DISKSAVE:
      dosavemode = true;
    case FR_DISKLOAD:
      pat = "*.dsk";
      break;

    // FIXME: Save TAP should be *.tap, save ORT should be *.ort, Load should be *.tap, *.ort, *.wav
    case FR_TAPESAVETAP:
    case FR_TAPESAVEORT:
      dosavemode = true;
    case FR_TAPELOAD:
      pat = "*.tap";
      break;
    
    case FR_ROMS:
      pat = "*.rom";
      break;

    case FR_SNAPSHOTSAVE:
      dosavemode = true;
    case FR_SNAPSHOTLOAD:
      pat = "*.sna";
      break;
      
    case FR_KEYMAPPINGSAVE:
    	dosavemode = true;
    case FR_KEYMAPPINGLOAD:
    	pat = "*.kma";
        break;
 
    default:
      pat = NULL;
      break;
  }

	//XXX: use RefFilter

	panel = new BFilePanel(dosavemode ? B_SAVE_PANEL : B_OPEN_PANEL);
	panel->SetTarget(BMessenger(looper));

	if (path)
		panel->SetPanelDirectory(path);

	panel->Show();

	looper->Wait();
	ret = looper->DoIt();
	entry_ref ref;
	looper->GetRef(ref);
	
	delete panel;
	looper->Lock();
	looper->Quit();
	
  if (ret) {
    BPath p(&ref);
    strncpy( fname, p.Leaf(),   512  ); path[511]  = 0;
    p.GetParent(&p);
    strncpy( path,  p.Path(), 4096 ); path[4095] = 0;
  }

  return ret;
}
开发者ID:Akheon23,项目名称:oriculator,代码行数:75,代码来源:filereq_beos.cpp

示例15: ShowOpenFileDialog

void MainWindowController::ShowOpenFileDialog()
{
	BFilePanel* filePanel = new BFilePanel(B_OPEN_PANEL, &_windowMessenger, NULL, B_DIRECTORY_NODE);
	filePanel->Show();
}
开发者ID:thinkpractice,项目名称:CMakeHelper,代码行数:5,代码来源:MainWindowController.cpp


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