本文整理汇总了C++中BMenu::Window方法的典型用法代码示例。如果您正苦于以下问题:C++ BMenu::Window方法的具体用法?C++ BMenu::Window怎么用?C++ BMenu::Window使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BMenu
的用法示例。
在下文中一共展示了BMenu::Window方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: frame
void
TBarMenuTitle::Draw()
{
BMenu* menu = Menu();
if (menu == NULL)
return;
BRect frame(Frame());
rgb_color base = menu->LowColor();
menu->PushState();
BRect windowBounds = menu->Window()->Bounds();
if (frame.right > windowBounds.right)
frame.right = windowBounds.right;
// fill in background
if (IsSelected()) {
be_control_look->DrawMenuItemBackground(menu, frame, frame, base,
BControlLook::B_ACTIVATED);
} else
be_control_look->DrawButtonBackground(menu, frame, frame, base);
menu->MovePenTo(ContentLocation());
DrawContent();
menu->PopState();
}
示例2: frame
void
TBarMenuTitle::DrawContent()
{
BMenu* menu = Menu();
BRect frame(Frame());
if (be_control_look != NULL) {
menu->SetDrawingMode(B_OP_ALPHA);
if (fIcon != NULL) {
BRect dstRect(fIcon->Bounds());
dstRect.OffsetTo(frame.LeftTop());
dstRect.OffsetBy(rintf(((frame.Width() - dstRect.Width()) / 2)
- 1.0f), rintf(((frame.Height() - dstRect.Height()) / 2)
- 0.0f));
menu->DrawBitmapAsync(fIcon, dstRect);
}
return;
}
rgb_color menuColor = menu->ViewColor();
rgb_color dark = tint_color(menuColor, B_DARKEN_1_TINT);
rgb_color light = tint_color(menuColor, B_LIGHTEN_2_TINT);
rgb_color black = {0, 0, 0, 255};
bool inExpandoMode = dynamic_cast<TExpandoMenuBar*>(menu) != NULL;
BRect bounds(menu->Window()->Bounds());
if (bounds.right < frame.right)
frame.right = bounds.right;
menu->SetDrawingMode(B_OP_COPY);
if (!IsSelected() && !menu->IsRedrawAfterSticky()) {
menu->BeginLineArray(8);
menu->AddLine(frame.RightTop(), frame.LeftTop(), light);
menu->AddLine(frame.LeftBottom(), frame.RightBottom(), dark);
menu->AddLine(frame.LeftTop(),
frame.LeftBottom()+BPoint(0, inExpandoMode ? 0 : -1), light);
menu->AddLine(frame.RightBottom(), frame.RightTop(), dark);
if (inExpandoMode) {
frame.top += 1;
menu->AddLine(frame.LeftTop(), frame.RightTop() + BPoint(-1, 0),
light);
}
menu->EndLineArray();
frame.InsetBy(1, 1);
menu->SetHighColor(menuColor);
menu->FillRect(frame);
menu->SetHighColor(black);
frame.InsetBy(-1, -1);
if (inExpandoMode)
frame.top -= 1;
}
ASSERT(IsEnabled());
if (IsSelected() && !menu->IsRedrawAfterSticky()) {
menu->SetHighColor(tint_color(menuColor, B_HIGHLIGHT_BACKGROUND_TINT));
menu->FillRect(frame);
if (menu->IndexOf(this) > 0) {
menu->SetHighColor(tint_color(menuColor, B_DARKEN_4_TINT));
menu->StrokeLine(frame.LeftTop(), frame.LeftBottom());
}
menu->SetHighColor(black);
}
menu->SetDrawingMode(B_OP_ALPHA);
if (fIcon != NULL) {
BRect dstRect(fIcon->Bounds());
dstRect.OffsetTo(frame.LeftTop());
dstRect.OffsetBy(rintf(((frame.Width() - dstRect.Width()) / 2) - 1.0f),
rintf(((frame.Height() - dstRect.Height()) / 2) - 0.0f));
menu->DrawBitmapAsync(fIcon, dstRect);
}
}