本文整理汇总了C++中TTeamMenuItem::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ TTeamMenuItem::Draw方法的具体用法?C++ TTeamMenuItem::Draw怎么用?C++ TTeamMenuItem::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTeamMenuItem
的用法示例。
在下文中一共展示了TTeamMenuItem::Draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showMessage
void
TExpandoMenuBar::MouseDown(BPoint where)
{
BMessage *message = Window()->CurrentMessage();
// check for three finger salute, a.k.a. Vulcan Death Grip
if (message != NULL) {
int32 modifiers = 0;
message->FindInt32("modifiers", &modifiers);
if ((modifiers & B_COMMAND_KEY) != 0
&& (modifiers & B_OPTION_KEY) != 0
&& (modifiers & B_SHIFT_KEY) != 0
&& !fBarView->Dragging()) {
TTeamMenuItem *item = ItemAtPoint(where);
if (item) {
const BList *teams = item->Teams();
int32 teamCount = teams->CountItems();
team_id teamID;
for (int32 team = 0; team < teamCount; team++) {
teamID = (team_id)teams->ItemAt(team);
kill_team(teamID);
// remove the team immediately
// from display
RemoveTeam(teamID, false);
}
return;
}
}
}
const int32 count = CountItems();
// This feature is broken because the menu bar never receives
// the second click
#ifdef DOUBLECLICKBRINGSTOFRONT
// doubleclick on an item brings all to front
for (int32 i = fFirstApp; i < count; i++) {
TTeamMenuItem *item = (TTeamMenuItem *)ItemAt(i);
if (item->Frame().Contains(where)) {
bigtime_t clickSpeed = 0;
get_click_speed(&clickSpeed);
if ( (fLastClickItem == i) &&
(clickSpeed > (system_time() - fLastClickTime)) ) {
// bring this team's window to the front
BMessage showMessage(M_BRING_TEAM_TO_FRONT);
showMessage.AddInt32("itemIndex", i);
Window()->PostMessage(&showMessage, this);
return;
}
fLastClickItem = i;
fLastClickTime = system_time();
break;
}
}
#endif
// control click - show all/hide all shortcut
if (message != NULL) {
int32 modifiers = 0;
message->FindInt32("modifiers", &modifiers);
if ((modifiers & B_CONTROL_KEY) != 0
&& ! fBarView->Dragging()) {
int32 lastApp = -1;
// find the clicked item
for (int32 i = fFirstApp; i < count; i++) {
const TTeamMenuItem *item = (TTeamMenuItem *)ItemAt(i);
// check if this item is really a team item (what a cruel way...)
// "lastApp" will always point to the last application in
// the list - the other entries might be windows (due to the team expander)
if (item->Submenu())
lastApp = i;
if (item->Frame().Contains(where)) {
// show/hide item's teams
BMessage showMessage((modifiers & B_SHIFT_KEY) != 0
? M_MINIMIZE_TEAM : M_BRING_TEAM_TO_FRONT);
showMessage.AddInt32("itemIndex", lastApp);
Window()->PostMessage(&showMessage, this);
return;
}
}
}
}
// Check the bounds of the expand Team icon
if (fShowTeamExpander && fVertical && !fBarView->Dragging()) {
TTeamMenuItem *item = ItemAtPoint(where);
if (item->Submenu()){
BRect expanderRect = item->ExpanderBounds();
if (expanderRect.Contains(where)) {
item->ToggleExpandState(true);
item->Draw();
// Absorb the message.
//.........这里部分代码省略.........
示例2: showMessage
void
TExpandoMenuBar::MouseDown(BPoint where)
{
BMessage* message = Window()->CurrentMessage();
BMenuItem* menuItem;
TTeamMenuItem* item = TeamItemAtPoint(where, &menuItem);
// check for three finger salute, a.k.a. Vulcan Death Grip
if (message != NULL && item != NULL && !fBarView->Dragging()) {
int32 modifiers = 0;
message->FindInt32("modifiers", &modifiers);
if ((modifiers & B_COMMAND_KEY) != 0
&& (modifiers & B_CONTROL_KEY) != 0
&& (modifiers & B_SHIFT_KEY) != 0) {
const BList* teams = item->Teams();
int32 teamCount = teams->CountItems();
team_id teamID;
for (int32 team = 0; team < teamCount; team++) {
teamID = (team_id)teams->ItemAt(team);
kill_team(teamID);
// remove the team immediately from display
RemoveTeam(teamID, false);
}
return;
}
// control click - show all/hide all shortcut
if ((modifiers & B_CONTROL_KEY) != 0) {
// show/hide item's teams
BMessage showMessage((modifiers & B_SHIFT_KEY) != 0
? kMinimizeTeam : kBringTeamToFront);
showMessage.AddInt32("itemIndex", IndexOf(item));
Window()->PostMessage(&showMessage, this);
return;
}
// Check the bounds of the expand Team icon
if (fShowTeamExpander && fVertical) {
BRect expanderRect = item->ExpanderBounds();
if (expanderRect.Contains(where)) {
// Let the update thread wait...
BAutolock locker(sMonLocker);
// Toggle the item
item->ToggleExpandState(true);
item->Draw();
// Absorb the message.
return;
}
}
// double-click on an item brings the team to front
int32 clicks;
if (message->FindInt32("clicks", &clicks) == B_OK && clicks > 1
&& item == menuItem && item == fLastClickItem) {
// activate this team
be_roster->ActivateApp((team_id)item->Teams()->ItemAt(0));
return;
}
fLastClickItem = item;
}
BMenuBar::MouseDown(where);
}