本文整理汇总了C++中BMessenger::Team方法的典型用法代码示例。如果您正苦于以下问题:C++ BMessenger::Team方法的具体用法?C++ BMessenger::Team怎么用?C++ BMessenger::Team使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BMessenger
的用法示例。
在下文中一共展示了BMessenger::Team方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reply
void
NotificationWindow::MessageReceived(BMessage* message)
{
switch (message->what) {
case B_NODE_MONITOR:
{
_LoadSettings();
_LoadAppFilters();
break;
}
case B_COUNT_PROPERTIES:
{
BMessage reply(B_REPLY);
BMessage specifier;
const char* property = NULL;
bool messageOkay = true;
if (message->FindMessage("specifiers", 0, &specifier) != B_OK)
messageOkay = false;
if (specifier.FindString("property", &property) != B_OK)
messageOkay = false;
if (strcmp(property, "message") != 0)
messageOkay = false;
if (messageOkay)
reply.AddInt32("result", fViews.size());
else {
reply.what = B_MESSAGE_NOT_UNDERSTOOD;
reply.AddInt32("error", B_ERROR);
}
message->SendReply(&reply);
break;
}
case B_CREATE_PROPERTY:
case kNotificationMessage:
{
BMessage reply(B_REPLY);
BNotification* notification = new BNotification(message);
if (notification->InitCheck() == B_OK) {
bigtime_t timeout;
if (message->FindInt64("timeout", &timeout) != B_OK)
timeout = -1;
BMessenger messenger = message->ReturnAddress();
app_info info;
if (messenger.IsValid())
be_roster->GetRunningAppInfo(messenger.Team(), &info);
else
be_roster->GetAppInfo("application/x-vnd.Be-SHEL", &info);
NotificationView* view = new NotificationView(this,
notification, timeout);
bool allow = false;
appfilter_t::iterator it = fAppFilters.find(info.signature);
if (it == fAppFilters.end()) {
AppUsage* appUsage = new AppUsage(notification->Group(),
true);
appUsage->Allowed(notification->Title(),
notification->Type());
fAppFilters[info.signature] = appUsage;
allow = true;
} else {
allow = it->second->Allowed(notification->Title(),
notification->Type());
}
if (allow) {
BString groupName(notification->Group());
appview_t::iterator aIt = fAppViews.find(groupName);
AppGroupView* group = NULL;
if (aIt == fAppViews.end()) {
group = new AppGroupView(this,
groupName == "" ? NULL : groupName.String());
fAppViews[groupName] = group;
GetLayout()->AddView(group);
} else
group = aIt->second;
group->AddInfo(view);
_ResizeAll();
reply.AddInt32("error", B_OK);
} else
reply.AddInt32("error", B_NOT_ALLOWED);
} else {
reply.what = B_MESSAGE_NOT_UNDERSTOOD;
reply.AddInt32("error", B_ERROR);
}
message->SendReply(&reply);
break;
}
case kRemoveView:
{
//.........这里部分代码省略.........
示例2: MessageReceived
//.........这里部分代码省略.........
TAwarePopupMenu *source;
if ( message->FindPointer( "source", (void**)&source ) == B_OK )
{
if ( source == fOpenMenu )
{
DebugCall( 9, "fOpenMenu is now 0" );
fOpenMenu = 0;
BPoint point;
uint32 buttons;
GetMouse( &point, &buttons );
if ( !Bounds().Contains( point ) )
Window()->PostMessage(B_EXITED_VIEW);
}
}
break;
}
case B_SOME_APP_LAUNCHED:
{
team_id tid;
if ( message->FindInt32( "be:team", &tid ) != B_OK )
break;
const char *sig;
if ( message->FindString( "be:signature", &sig ) != B_OK )
break;
entry_ref ref;
if ( message->FindRef( "be:ref", &ref ) != B_OK )
break;
int32 flags;
if ( message->FindInt32( "be:flags", &flags ) != B_OK )
break;
if ( sig && strlen(sig) && ( ( flags & B_BACKGROUND_APP ) == 0 ) )
AddTeam( tid, sig, ref );
break;
}
case B_SOME_APP_QUIT:
{
team_id tid;
if ( message->FindInt32( "be:team", &tid ) != B_OK )
break;
RemoveTeam( tid );
break;
}
case B_SOME_APP_ACTIVATED:
{
team_id tid;
if ( message->FindInt32( "be:team", &tid ) == B_OK )
{
TAppPanelIcon *icon = ItemWith( tid );
if ( icon != fLastActiveAppIcon )
{
DebugCall( 10, "B_SOME_APP_ACTIVATED %p[..]->%p[%i]", fLastActiveAppIcon, icon, tid );
if ( fLastActiveAppIcon )
fLastActiveAppIcon->SetActive( false );
if ( icon )
icon->SetActive( true );
fLastActiveAppIcon = icon;
}
}
示例3: if
void
NotificationView::_LoadIcon()
{
// First try to get the icon from the caller application
app_info info;
BMessenger msgr = fDetails->ReturnAddress();
if (msgr.IsValid())
be_roster->GetRunningAppInfo(msgr.Team(), &info);
else if (fType == B_PROGRESS_NOTIFICATION)
be_roster->GetAppInfo("application/x-vnd.Haiku-notification_server",
&info);
BPath path;
path.SetTo(&info.ref);
fBitmap = _ReadNodeIcon(path.Path(), fParent->IconSize());
if (fBitmap)
return;
// If that failed get icons from app_server
if (find_directory(B_BEOS_SERVERS_DIRECTORY, &path) != B_OK)
return;
path.Append("app_server");
BFile file(path.Path(), B_READ_ONLY);
if (file.InitCheck() != B_OK)
return;
BResources res(&file);
if (res.InitCheck() != B_OK)
return;
// Which one should we choose?
const char* iconName = "";
switch (fType) {
case B_INFORMATION_NOTIFICATION:
iconName = "info";
break;
case B_ERROR_NOTIFICATION:
iconName = "stop";
break;
case B_IMPORTANT_NOTIFICATION:
iconName = "warn";
break;
default:
return;
}
// Allocate the bitmap
fBitmap = new BBitmap(BRect(0, 0, (float)B_LARGE_ICON - 1,
(float)B_LARGE_ICON - 1), B_RGBA32);
if (!fBitmap || fBitmap->InitCheck() != B_OK) {
fBitmap = NULL;
return;
}
// Load raw icon data
size_t size = 0;
const uint8* data = (const uint8*)res.LoadResource(B_VECTOR_ICON_TYPE,
iconName, &size);
if ((data == NULL
|| BIconUtils::GetVectorIcon(data, size, fBitmap) != B_OK))
fBitmap = NULL;
}