本文整理汇总了C++中TTeamMenuItem::Menu方法的典型用法代码示例。如果您正苦于以下问题:C++ TTeamMenuItem::Menu方法的具体用法?C++ TTeamMenuItem::Menu怎么用?C++ TTeamMenuItem::Menu使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTeamMenuItem
的用法示例。
在下文中一共展示了TTeamMenuItem::Menu方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strdup
void
TExpandoMenuBar::MessageReceived(BMessage *message)
{
int32 index;
TTeamMenuItem *item;
switch (message->what) {
case B_SOME_APP_LAUNCHED: {
BList *teams = NULL;
message->FindPointer("teams", (void **)&teams);
BBitmap *icon = NULL;
message->FindPointer("icon", (void **)&icon);
const char *sig;
if (message->FindString("sig", &sig) == B_OK
&&strcasecmp(sig, TASK_BAR_MIME_SIG) == 0) {
delete teams;
delete icon;
break;
}
uint32 flags;
if (message->FindInt32("flags", ((int32*) &flags)) == B_OK
&& (flags & B_BACKGROUND_APP) != 0) {
delete teams;
delete icon;
break;
}
const char *name = NULL;
message->FindString("name", &name);
AddTeam(teams, icon, strdup(name), strdup(sig));
break;
}
case msg_AddTeam:
AddTeam(message->FindInt32("team"), message->FindString("sig"));
break;
case msg_RemoveTeam:
{
team_id team = -1;
message->FindInt32("team", &team);
RemoveTeam(team, true);
break;
}
case B_SOME_APP_QUIT:
{
team_id team = -1;
message->FindInt32("team", &team);
RemoveTeam(team, false);
break;
}
case M_MINIMIZE_TEAM:
{
index = message->FindInt32("itemIndex");
item = dynamic_cast<TTeamMenuItem *>(ItemAt(index));
if (item == NULL)
break;
TShowHideMenuItem::TeamShowHideCommon(B_MINIMIZE_WINDOW,
item->Teams(),
item->Menu()->ConvertToScreen(item->Frame()),
true);
break;
}
case M_BRING_TEAM_TO_FRONT:
{
index = message->FindInt32("itemIndex");
item = dynamic_cast<TTeamMenuItem *>(ItemAt(index));
if (item == NULL)
break;
TShowHideMenuItem::TeamShowHideCommon(B_BRING_TO_FRONT,
item->Teams(),
item->Menu()->ConvertToScreen(item->Frame()),
true);
break;
}
default:
BMenuBar::MessageReceived(message);
break;
}
}
示例2: strdup
void
TExpandoMenuBar::MessageReceived(BMessage* message)
{
int32 index;
TTeamMenuItem* item;
switch (message->what) {
case B_SOME_APP_LAUNCHED:
{
BList* teams = NULL;
message->FindPointer("teams", (void**)&teams);
BBitmap* icon = NULL;
message->FindPointer("icon", (void**)&icon);
const char* signature = NULL;
message->FindString("sig", &signature);
uint32 flags = 0;
message->FindInt32("flags", ((int32*) &flags));
const char* name = NULL;
message->FindString("name", &name);
AddTeam(teams, icon, strdup(name), strdup(signature));
break;
}
case B_MOUSE_WHEEL_CHANGED:
{
float deltaY = 0;
message->FindFloat("be:wheel_delta_y", &deltaY);
if (deltaY == 0)
return;
TInlineScrollView* scrollView
= dynamic_cast<TInlineScrollView*>(Parent());
if (scrollView == NULL)
return;
float largeStep;
float smallStep;
scrollView->GetSteps(&smallStep, &largeStep);
// pressing the option/command/control key scrolls faster
if (modifiers() & (B_OPTION_KEY | B_COMMAND_KEY | B_CONTROL_KEY))
deltaY *= largeStep;
else
deltaY *= smallStep;
scrollView->ScrollBy(deltaY);
break;
}
case kAddTeam:
AddTeam(message->FindInt32("team"), message->FindString("sig"));
break;
case kRemoveTeam:
{
team_id team = -1;
message->FindInt32("team", &team);
RemoveTeam(team, true);
break;
}
case B_SOME_APP_QUIT:
{
team_id team = -1;
message->FindInt32("team", &team);
RemoveTeam(team, false);
break;
}
case kMinimizeTeam:
{
index = message->FindInt32("itemIndex");
item = dynamic_cast<TTeamMenuItem*>(ItemAt(index));
if (item == NULL)
break;
TShowHideMenuItem::TeamShowHideCommon(B_MINIMIZE_WINDOW,
item->Teams(),
item->Menu()->ConvertToScreen(item->Frame()),
true);
break;
}
case kBringTeamToFront:
{
index = message->FindInt32("itemIndex");
item = dynamic_cast<TTeamMenuItem*>(ItemAt(index));
if (item == NULL)
break;
TShowHideMenuItem::TeamShowHideCommon(B_BRING_TO_FRONT,
item->Teams(), item->Menu()->ConvertToScreen(item->Frame()),
true);
//.........这里部分代码省略.........