本文整理汇总了C++中TBarView::AppCanHandleTypes方法的典型用法代码示例。如果您正苦于以下问题:C++ TBarView::AppCanHandleTypes方法的具体用法?C++ TBarView::AppCanHandleTypes怎么用?C++ TBarView::AppCanHandleTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBarView
的用法示例。
在下文中一共展示了TBarView::AppCanHandleTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Menu
void
TTeamMenuItem::DrawContentLabel()
{
BMenu* menu = Menu();
menu->MovePenBy(0, fLabelAscent);
float cachedWidth = menu->StringWidth(Label());
if (Submenu() && fVertical)
cachedWidth += 18;
const char* label = Label();
char* truncLabel = NULL;
float max = 0;
if (fVertical && static_cast<TBarApp*>(be_app)->Settings()->superExpando)
max = menu->MaxContentWidth() - kSwitchWidth;
else
max = menu->MaxContentWidth() - 4.0f;
if (max > 0) {
BPoint penloc = menu->PenLocation();
BRect frame = Frame();
float offset = penloc.x - frame.left;
if (cachedWidth + offset > max) {
truncLabel = (char*)malloc(strlen(label) + 4);
if (!truncLabel)
return;
TruncateLabel(max-offset, truncLabel);
label = truncLabel;
}
}
if (!label)
label = Label();
TBarView* barview = (static_cast<TBarApp*>(be_app))->BarView();
bool canHandle = !barview->Dragging()
|| barview->AppCanHandleTypes(Signature());
if (_IsSelected() && IsEnabled() && canHandle)
menu->SetLowColor(tint_color(menu->LowColor(),
B_HIGHLIGHT_BACKGROUND_TINT));
else
menu->SetLowColor(menu->LowColor());
menu->DrawString(label);
free(truncLabel);
}
示例2: frame
void
TTeamMenuItem::Draw()
{
BRect frame(Frame());
BMenu* menu = Menu();
menu->PushState();
rgb_color menuColor = menu->LowColor();
TBarView* barView = (static_cast<TBarApp*>(be_app))->BarView();
bool canHandle = !barView->Dragging()
|| barView->AppCanHandleTypes(Signature());
if (be_control_look != NULL) {
uint32 flags = 0;
if (_IsSelected() && canHandle)
flags |= BControlLook::B_ACTIVATED;
uint32 borders = BControlLook::B_TOP_BORDER;
if (fVertical) {
menu->SetHighColor(tint_color(menuColor, B_DARKEN_1_TINT));
borders |= BControlLook::B_LEFT_BORDER
| BControlLook::B_RIGHT_BORDER;
menu->StrokeLine(frame.LeftBottom(), frame.RightBottom());
frame.bottom--;
be_control_look->DrawMenuBarBackground(menu, frame, frame,
menuColor, flags, borders);
} else {
if (flags & BControlLook::B_ACTIVATED)
menu->SetHighColor(tint_color(menuColor, B_DARKEN_3_TINT));
else
menu->SetHighColor(tint_color(menuColor, 1.22));
borders |= BControlLook::B_BOTTOM_BORDER;
menu->StrokeLine(frame.LeftTop(), frame.LeftBottom());
frame.left++;
be_control_look->DrawButtonBackground(menu, frame, frame,
menuColor, flags, borders);
}
menu->MovePenTo(ContentLocation());
DrawContent();
menu->PopState();
return;
}
// if not selected or being tracked on, fill with gray
if ((!_IsSelected() && !menu->IsRedrawAfterSticky()) || !canHandle
|| !IsEnabled()) {
frame.InsetBy(1, 1);
menu->SetHighColor(menuColor);
menu->FillRect(frame);
}
// draw the gray, unselected item, border
if (!_IsSelected() || !IsEnabled()) {
rgb_color shadow = tint_color(menuColor, B_DARKEN_1_TINT);
rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);
frame = Frame();
menu->SetHighColor(shadow);
if (fVertical)
menu->StrokeLine(frame.LeftBottom(), frame.RightBottom());
else
menu->StrokeLine(frame.LeftBottom() + BPoint(1, 0),
frame.RightBottom());
menu->StrokeLine(frame.RightBottom(), frame.RightTop());
menu->SetHighColor(light);
menu->StrokeLine(frame.RightTop() + BPoint(-1, 0), frame.LeftTop());
if (fVertical)
menu->StrokeLine(frame.LeftTop(), frame.LeftBottom()
+ BPoint(0, -1));
else
menu->StrokeLine(frame.LeftTop(), frame.LeftBottom());
}
// if selected or being tracked on, fill with the hilite gray color
if (IsEnabled() && _IsSelected() && !menu->IsRedrawAfterSticky()
&& canHandle) {
// fill
menu->SetHighColor(tint_color(menuColor, B_HIGHLIGHT_BACKGROUND_TINT));
menu->FillRect(frame);
// these continue the dark grey border on the left or top edge
menu->SetHighColor(tint_color(menuColor, B_DARKEN_4_TINT));
if (fVertical) {
// dark line at top
menu->StrokeLine(frame.LeftTop(), frame.RightTop());
} else {
// dark line on the left
menu->StrokeLine(frame.LeftTop(), frame.LeftBottom());
}
} else
menu->SetLowColor(menuColor);
menu->MovePenTo(ContentLocation());
DrawContent();
//.........这里部分代码省略.........