本文整理汇总了C++中BDeskbar::MaxItemHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ BDeskbar::MaxItemHeight方法的具体用法?C++ BDeskbar::MaxItemHeight怎么用?C++ BDeskbar::MaxItemHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BDeskbar
的用法示例。
在下文中一共展示了BDeskbar::MaxItemHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rect
bool
LoadInDeskbar()
{
PulseApp *pulseapp = (PulseApp *)be_app;
BDeskbar *deskbar = new BDeskbar();
// Don't allow two copies in the Deskbar at once
if (deskbar->HasItem("DeskbarPulseView")) {
delete deskbar;
return false;
}
// Must be 16 pixels high, the width is retrieved from the Prefs class
int width = pulseapp->prefs->deskbar_icon_width;
int min_width = GetMinimumViewWidth();
if (width < min_width) {
pulseapp->prefs->deskbar_icon_width = min_width;
width = min_width;
}
float height = deskbar->MaxItemHeight();
BRect rect(0, 0, width - 1, height - 1);
DeskbarPulseView *replicant = new DeskbarPulseView(rect);
status_t err = deskbar->AddItem(replicant);
delete replicant;
delete deskbar;
if (err != B_OK) {
BString message;
snprintf(message.LockBuffer(512), 512,
B_TRANSLATE("Installing in Deskbar failed\n%s"), strerror(err));
message.UnlockBuffer();
BAlert *alert = new BAlert(B_TRANSLATE("Error"),
message.String(), B_TRANSLATE("OK"));
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go(NULL);
return false;
}
return true;
}