本文整理汇总了C++中BFilePanel::SetPanelDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ BFilePanel::SetPanelDirectory方法的具体用法?C++ BFilePanel::SetPanelDirectory怎么用?C++ BFilePanel::SetPanelDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BFilePanel
的用法示例。
在下文中一共展示了BFilePanel::SetPanelDirectory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: message
BFilePanel *
CDocument::CreateSavePanel()
{
BMessage message(B_SAVE_REQUESTED);
message.AddPointer("Document", this);
// Create a new save panel
BMessenger messenger(NULL, MasterWindow());
BFilePanel *panel = new BFilePanel(B_SAVE_PANEL, &messenger,
NULL, B_FILE_NODE, false, &message);
// Set the save panel to point to the directory from where we loaded.
BEntry entry;
if (m_entry.GetParent(&entry) == B_NO_ERROR)
{
panel->SetPanelDirectory(&entry);
}
return panel;
}
示例2: 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;
}
示例3: 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();
}
示例4: msg
void
ServerAgent::DCCGetDialog (
BString nick,
BString file,
BString size,
BString ip,
BString port)
{
BMessage msg (M_DCC_ACCEPT), reply;
msg.AddString ("vision:nick", nick.String());
msg.AddString ("vision:file", file.String());
msg.AddString ("vision:size", size.String());
msg.AddString ("vision:ip", ip.String());
msg.AddString ("vision:port", port.String());
BFilePanel *panel;
BString text;
text << nick
<< ": "
<< file
<< " ("
<< size
<< " bytes)";
panel = new BFilePanel (
B_SAVE_PANEL,
&fSMsgr,
0,
0,
false,
&msg);
panel->SetButtonLabel (B_DEFAULT_BUTTON, "Accept");
panel->SetButtonLabel (B_CANCEL_BUTTON, "Refuse");
panel->SetSaveText (file.String());
BWindow *panelWindow (panel->Window());
if (panelWindow->Lock())
{
panelWindow->SetTitle (text.String());
panelWindow->SetFlags (panelWindow->Flags() | B_AVOID_FOCUS);
panelWindow->AddFilter (new DCCFileFilter (panel, msg));
if (vision_app->GetBool ("dccAutoAccept"))
{
BDirectory path (vision_app->GetString ("dccDefPath"));
if (path.InitCheck() == B_OK)
panel->SetPanelDirectory(&path);
}
if (vision_app->GetBool ("dccAutoAccept"))
{
panelWindow->Hide();
BButton *button (dynamic_cast<BButton *>(panel->Window()->FindView ("default button")));
if (button)
button->Invoke();
}
panelWindow->Unlock();
panel->Show();
// hack trick to ensure that the file panel doesn't take over the keyboard focus
// when it pops up
panelWindow->Lock();
panelWindow->SetFlags (panelWindow->Flags() & ~B_AVOID_FOCUS);
panelWindow->Unlock();
}
}