本文整理汇总了C++中BAlert::SetFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ BAlert::SetFlags方法的具体用法?C++ BAlert::SetFlags怎么用?C++ BAlert::SetFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BAlert
的用法示例。
在下文中一共展示了BAlert::SetFlags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lpr
bool
LprSetupView::UpdateViewData()
{
if (*fServer->Text() && *fQueue->Text()) {
try {
LpsClient lpr(fServer->Text());
lpr.connect();
}
catch (LPSException &err) {
BAlert *alert = new BAlert("", err.what(), "OK");
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
return false;
}
fDir->WriteAttr(LPR_SERVER_NAME, B_STRING_TYPE, 0, fServer->Text(),
strlen(fServer->Text()) + 1);
fDir->WriteAttr(LPR_QUEUE_NAME, B_STRING_TYPE, 0, fQueue->Text(),
strlen(fQueue->Text()) + 1);
return true;
}
BAlert *alert = new BAlert("", "Please enter server address and printer"
"queue name.", "OK");
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
return false;
}
示例2: BNetEndpoint
bool
SetupView::CheckSetup()
{
if (*fServerAddress->Text() && *fQueuePort->Text()) {
BNetEndpoint* ep = new BNetEndpoint(SOCK_STREAM);
if (ep->InitCheck() == B_NO_ERROR) {
uint16 port = atoi(fQueuePort->Text());
if (! port)
port = 9100;
if (ep->Connect(fServerAddress->Text(), port) != B_OK) {
BString text;
text << "Failed to connect to " << fServerAddress->Text() << ":" << (int) port << "!";
BAlert* alert = new BAlert("", text.String(), "OK");
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
return false;
};
char str[256];
sprintf(str, "%s:%d", fServerAddress->Text(), port);
fPrinterDirectory->WriteAttr("transport_address", B_STRING_TYPE,
0, str, strlen(str) + 1);
return true;
};
};
BAlert* alert = new BAlert("", "Please input parameters.", "OK");
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
return false;
}
示例3: directory
extern "C" void
process_refs(entry_ref directoryRef, BMessage *msg, void *)
{
BDirectory directory(&directoryRef);
if (directory.InitCheck() != B_OK)
return;
int32 errors = 0;
entry_ref ref;
int32 index;
for (index = 0; msg->FindRef("refs", index, &ref) == B_OK; index ++) {
BSymLink link(&ref);
if (link.InitCheck() != B_OK || !link.IsSymLink()) {
errors++;
continue;
}
BEntry targetEntry;
BPath path;
if (link.MakeLinkedPath(&directory, &path) < B_OK
|| targetEntry.SetTo(path.Path()) != B_OK
|| targetEntry.GetParent(&targetEntry) != B_OK) {
BAlert* alert = new BAlert("Open Target Folder",
"Cannot open target folder. Maybe this link is broken?",
"OK", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go(NULL);
continue;
}
// create Tracker message...
entry_ref target;
targetEntry.GetRef(&target);
BMessage message(B_REFS_RECEIVED);
message.AddRef("refs", &target);
// ...and send it
BMessenger messenger("application/x-vnd.Be-TRAK");
messenger.SendMessage(&message);
// TODO: select entry via scripting?
}
if (errors) {
BAlert* alert = new BAlert("Open Target Folder",
"This add-on can only be used on symbolic links.\n"
"It opens the folder of the link target in Tracker.",
"OK");
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go(NULL);
}
}
示例4: BAlert
void
Window::MessageReceived(BMessage* message)
{
switch (message->what) {
case kMsgShowAlert:
{
int32 count = fCountSlider->Value();
BAlert* alert = new BAlert("Test title", "Lorem ipsum dolor sit "
"amet, consectetur adipiscing elit. Suspendisse vel iaculis "
"quam. Donec faucibus erat nunc, ac ullamcorper justo sodales.",
"short 1", count > 1 ? "a bit longer 2" : NULL,
count > 2 ? "very very long button 3" : NULL,
_ButtonWidth(), _ButtonSpacing(), _AlertType());
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
int result = alert->Go();
if (result < 0) {
fLastStringView->SetText("Canceled alert");
} else {
fLastStringView->SetText(BString().SetToFormat(
"Pressed button %d", result + 1).String());
}
break;
}
default:
BWindow::MessageReceived(message);
}
}
示例5: QuitRequested
bool
ScreenWindow::QuitRequested()
{
fSettings->SetWindowFrame(Frame());
// Write mode of workspace 0 (the boot workspace) to the vesa settings file
screen_mode vesaMode;
if (fBootWorkspaceApplied && fScreenMode.Get(vesaMode, 0) == B_OK) {
status_t status = _WriteVesaModeFile(vesaMode);
if (status < B_OK) {
BString warning = B_TRANSLATE("Could not write VESA mode settings"
" file:\n\t");
warning << strerror(status);
BAlert* alert = new BAlert(B_TRANSLATE("Warning"),
warning.String(), B_TRANSLATE("OK"), NULL,
NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
}
}
be_app->PostMessage(B_QUIT_REQUESTED);
return BWindow::QuitRequested();
}
示例6: name
void
SyslogDaemon::AboutRequested()
{
BPath path;
find_directory(B_SYSTEM_LOG_DIRECTORY, &path);
path.Append("syslog");
BString name(B_TRANSLATE("Syslog Daemon"));
BString message;
snprintf(message.LockBuffer(512), 512,
B_TRANSLATE("%s\n\nThis daemon is responsible for collecting "
"all system messages and write them to the system-wide log "
"at \"%s\".\n\n"), name.String(), path.Path());
message.UnlockBuffer();
BAlert *alert = new BAlert(name.String(), message.String(), B_TRANSLATE("OK"));
BTextView *view = alert->TextView();
BFont font;
view->SetStylable(true);
view->GetFont(&font);
font.SetSize(21);
font.SetFace(B_BOLD_FACE);
view->SetFontAndColor(0, name.Length(), &font);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go(NULL);
}
示例7: Probe
void
DiskProbe::RefsReceived(BMessage* message)
{
bool traverseLinks = (modifiers() & B_SHIFT_KEY) == 0;
int32 index = 0;
entry_ref ref;
while (message->FindRef("refs", index++, &ref) == B_OK) {
const char* attribute = NULL;
if (message->FindString("attributes", index - 1, &attribute) == B_OK)
traverseLinks = false;
BEntry entry;
status_t status = entry.SetTo(&ref, traverseLinks);
if (status == B_OK)
status = Probe(entry, attribute);
if (status != B_OK) {
char buffer[1024];
snprintf(buffer, sizeof(buffer),
B_TRANSLATE_COMMENT("Could not open \"%s\":\n"
"%s", "Opening of entry reference buffer for a DiskProbe "
"request Alert message. The name of entry reference and "
"error message is shown."),
ref.name, strerror(status));
BAlert* alert = new BAlert(B_TRANSLATE("DiskProbe request"),
buffer, B_TRANSLATE("OK"), NULL, NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
}
}
}
示例8: frame
void
LoginApp::ReadyToRun()
{
BScreen screen;
if (fEditShelfMode) {
BAlert* alert = new BAlert(B_TRANSLATE("Info"), B_TRANSLATE("You can "
"customize the desktop shown behind the Login application by "
"dropping replicants onto it.\n\n"
"When you are finished just quit the application (Cmd-Q)."),
B_TRANSLATE("OK"));
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go(NULL);
} else {
BRect frame(0, 0, 450, 150);
frame.OffsetBySelf(screen.Frame().Width()/2 - frame.Width()/2,
screen.Frame().Height()/2 - frame.Height()/2);
fLoginWindow = new LoginWindow(frame);
fLoginWindow->Show();
}
fDesktopWindow = new DesktopWindow(screen.Frame(), fEditShelfMode);
fDesktopWindow->Show();
// TODO: add a shelf with Activity Monitor replicant :)
}
示例9: BAlert
static int
ShowMessage(char* string)
{
BAlert *alert = new BAlert("Message", string, "OK");
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
return alert->Go();
}
示例10: file
void
NotificationWindow::_LoadSettings(bool startMonitor)
{
BPath path;
BMessage settings;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
return;
path.Append(kSettingsFile);
BFile file(path.Path(), B_READ_ONLY | B_CREATE_FILE);
settings.Unflatten(&file);
_LoadGeneralSettings(settings);
_LoadDisplaySettings(settings);
_LoadAppFilters(settings);
if (startMonitor) {
node_ref nref;
BEntry entry(path.Path());
entry.GetNodeRef(&nref);
if (watch_node(&nref, B_WATCH_ALL, BMessenger(this)) != B_OK) {
BAlert* alert = new BAlert(B_TRANSLATE("Warning"),
B_TRANSLATE("Couldn't start general settings monitor.\n"
"Live filter changes disabled."), B_TRANSLATE("OK"));
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go(NULL);
}
}
}
示例11: AboutText
void
HWindow::AboutRequested()
{
const char* aboutText = AboutText();
if (aboutText == NULL)
return;
BAlert *about = new BAlert("About", aboutText, "Cool");
BTextView *v = about->TextView();
if (v) {
rgb_color red = {255, 0, 51, 255};
rgb_color blue = {0, 102, 255, 255};
v->SetStylable(true);
char *text = (char*)v->Text();
char *s = text;
// set all Be in blue and red
while ((s = strstr(s, "Be")) != NULL) {
int32 i = s - text;
v->SetFontAndColor(i, i+1, NULL, 0, &blue);
v->SetFontAndColor(i+1, i+2, NULL, 0, &red);
s += 2;
}
// first text line
s = strchr(text, '\n');
BFont font;
v->GetFontAndColor(0, &font);
font.SetSize(12); // font.SetFace(B_OUTLINED_FACE);
v->SetFontAndColor(0, s-text+1, &font, B_FONT_SIZE);
};
about->SetFlags(about->Flags() | B_CLOSE_ON_ESCAPE);
about->Go();
}
示例12: BView
CDPlayer::CDPlayer(BRect frame, const char *name, uint32 resizeMask,
uint32 flags)
: BView(frame, name, resizeMask, flags | B_FRAME_EVENTS),
fCDQuery("freedb.freedb.org")
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fVolume = 255;
BuildGUI();
if (fCDDrive.CountDrives() < 1) {
BAlert *alert = new BAlert("CDPlayer", B_TRANSLATE(
"It appears that there are no CD"
" drives on your computer or there is no system software to "
"support one. Sorry."), B_TRANSLATE("OK"));
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
}
fWindowState = fCDDrive.GetState();
fVolumeSlider->SetValue(fCDDrive.GetVolume());
if (fVolumeSlider->Value() <= 2) {
fCDDrive.SetVolume(255);
fVolumeSlider->SetValue(255);
}
_WatchCDState();
}
示例13: BAlert
void
ConfigWindow::_RevertToLastSettings()
{
// revert general settings
BMailSettings settings;
status_t status = _SetToGeneralSettings(&settings);
if (status != B_OK) {
char text[256];
sprintf(text, B_TRANSLATE(
"\nThe general settings couldn't be reverted.\n\n"
"Error retrieving general settings:\n%s\n"),
strerror(status));
BAlert* alert = new BAlert(B_TRANSLATE("Error"), text,
B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
}
// revert account data
if (fAccountsListView->CurrentSelection() != -1)
_ReplaceConfigView(_BuildHowToView());
for (int32 i = 0; i < fAccounts.CountItems(); i++) {
BMailAccountSettings* account = fAccounts.ItemAt(i);
_RemoveAccountFromListView(account);
delete account;
}
fAccounts.MakeEmpty();
_LoadAccounts();
}
示例14: BAlert
void
PulseApp::ShowAbout(bool asApplication)
{
// static version to be used in replicant mode
BString name;
if (asApplication)
name = B_TRANSLATE_SYSTEM_NAME("Pulse");
else
name = B_TRANSLATE("Pulse");
BString message = B_TRANSLATE(
"%s\n\nBy David Ramsey and Arve Hjønnevåg\n"
"Revised by Daniel Switkin\n");
message.ReplaceFirst("%s", name);
BAlert *alert = new BAlert(B_TRANSLATE("Info"),
message.String(), B_TRANSLATE("OK"));
BTextView* view = alert->TextView();
BFont font;
view->SetStylable(true);
view->GetFont(&font);
font.SetSize(18);
font.SetFace(B_BOLD_FACE);
view->SetFontAndColor(0, name.Length(), &font);
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
// Use the asynchronous version so we don't block the window's thread
alert->Go(NULL);
}
示例15: MessageReceived
void SnowView::MessageReceived(BMessage *msg)
{
BAlert *info;
//msg->PrintToStream();
switch (msg->what) {
case MSG_PULSE_ME:
if (Parent()) {
Calc();
InvalFlakes();
}
break;
case B_ABOUT_REQUESTED:
info = new BAlert("BSnow info",
"BSnow, just in case you don't have real one...\n"
"" B_UTF8_COPYRIGHT " 2003, François Revol.",
"Where is Santa ??");
info->SetFeel(B_NORMAL_WINDOW_FEEL);
info->SetLook(B_FLOATING_WINDOW_LOOK);
info->SetFlags(info->Flags()|B_NOT_ZOOMABLE);
info->Go(NULL);
break;
default:
//#ifdef FORWARD_TO_PARENT
/*
if (fAttached && Parent())
Parent()->MessageReceived(msg);
else
*/
//#endif
BView::MessageReceived(msg);
}
}