本文整理汇总了C++中BFilePanel::SetButtonLabel方法的典型用法代码示例。如果您正苦于以下问题:C++ BFilePanel::SetButtonLabel方法的具体用法?C++ BFilePanel::SetButtonLabel怎么用?C++ BFilePanel::SetButtonLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BFilePanel
的用法示例。
在下文中一共展示了BFilePanel::SetButtonLabel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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");
}
示例2: 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();
}
示例3: 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();
}
}
示例4: firstWord
//.........这里部分代码省略.........
// use BPath to resolve relative pathnames, above code forces it
// to use /boot/home as a working dir as opposed to the app path
BPath sendPath(filePath, NULL, true);
// the BFile is used to verify if the file exists
// based off the documentation get_ref_for_path *should*
// return something other than B_OK if the file doesn't exist
// but that doesn't seem to be working correctly
BFile sendFile(sendPath.Path(), B_READ_ONLY);
// if the file exists, send, otherwise drop to the file panel
if (sendFile.InitCheck() == B_OK)
{
sendFile.Unset();
entry_ref ref;
get_ref_for_path(sendPath.Path(), &ref);
msg->AddRef("refs", &ref);
sMsgr.SendMessage(msg);
return true;
}
}
BFilePanel *myPanel (new BFilePanel);
BString myTitle ("Sending a file to ");
myTitle.Append (theNick);
myPanel->Window()->SetTitle (myTitle.String());
myPanel->SetMessage (msg);
myPanel->SetButtonLabel (B_DEFAULT_BUTTON, "Send");
myPanel->SetTarget (sMsgr);
myPanel->Show();
}
else if (secondWord.ICompare ("CHAT") == 0
&& theNick != "-9z99")
{
BMessage msg (CHAT_ACTION);
msg.AddString ("nick", theNick.String());
sMsgr.SendMessage (&msg);
}
return true;
}
if (firstWord == "/DOP" || firstWord == "/DEOP")
{
BString theNick (RestOfString (data, 2));
if (theNick != "-9z99")
{
BMessage send (M_SERVER_SEND);
AddSend (&send, "MODE ");
AddSend (&send, id);
AddSend (&send, " -oooo ");
AddSend (&send, theNick);
AddSend (&send, endl);
}