本文整理汇总了C++中BRect::PrintToStream方法的典型用法代码示例。如果您正苦于以下问题:C++ BRect::PrintToStream方法的具体用法?C++ BRect::PrintToStream怎么用?C++ BRect::PrintToStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BRect
的用法示例。
在下文中一共展示了BRect::PrintToStream方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printf
void
jView::Draw(BRect update)
{
DBG(AWT_EVT, printf( "jView::Draw(" ));
DBG(AWT_EVT, update.PrintToStream());
DBG(AWT_EVT, printf( "\n" ));
#if 0
DBG(AWT_EVT, printf("Draw\n"));
// !!! NOT THE BEST PLACE,
// it would be better to intercept events before they are dispatched to the handlers
// (see event_hook)
BMessage * msg = new BMessage();
msg->what = UPDATE_EVENT; /* custom update event */
msg->AddPointer(sourceTag, Window());
msg->AddRect("frame", Frame()); /* update the entire frame */
bigtime_t t = system_time();
msg->AddInt64("when", t);
update.PrintToStream();
javaApp->AddMessage( msg );
#endif
}
示例2:
// MessageReceived
void
TestView::MessageReceived(BMessage* message)
{
if (message->what == MSG_COPY_BITS) {
printf("MSG_COPY_BITS\n");
fSourceRect.PrintToStream();
fDestRect.PrintToStream();
CopyBits(fSourceRect, fDestRect);
fCopyBitsJustCalled = true;
} else
BView::MessageReceived(message);
}
示例3: BFilePanel
StyledEditApp::StyledEditApp()
:
BApplication(APP_SIGNATURE),
fOpenPanel(NULL)
{
B_TRANSLATE_MARK_SYSTEM_NAME_VOID("StyledEdit");
fOpenPanel = new BFilePanel();
fOpenAsEncoding = 0;
BMenuBar* menuBar
= dynamic_cast<BMenuBar*>(fOpenPanel->Window()->FindView("MenuBar"));
if (menuBar != NULL) {
fOpenPanelEncodingMenu = new BMenu(B_TRANSLATE("Encoding"));
fOpenPanelEncodingMenu->SetRadioMode(true);
menuBar->AddItem(fOpenPanelEncodingMenu);
BCharacterSetRoster roster;
BCharacterSet charset;
while (roster.GetNextCharacterSet(&charset) == B_NO_ERROR) {
BString name;
if (charset.GetFontID() == B_UNICODE_UTF8)
name = B_TRANSLATE("Default");
else
name = charset.GetPrintName();
const char* mime = charset.GetMIMEName();
if (mime != NULL) {
name.Append(" (");
name.Append(mime);
name.Append(")");
}
BMenuItem* item
= new BMenuItem(name.String(), new BMessage(OPEN_AS_ENCODING));
item->SetTarget(this);
fOpenPanelEncodingMenu->AddItem(item);
if (charset.GetFontID() == fOpenAsEncoding)
item->SetMarked(true);
}
} else
fOpenPanelEncodingMenu = NULL;
fWindowCount = 0;
fNextUntitledWindow = 1;
fBadArguments = false;
float factor = be_plain_font->Size() / 12.0f;
sCascadeOffset *= factor;
sTopLeft.x *= factor;
sTopLeft.y *= factor;
sWindowRect.left *= factor;
sWindowRect.top *= factor;
sWindowRect.right *= factor;
sWindowRect.bottom *= factor;
sWindowRect.PrintToStream();
}
示例4:
void
WinDecorator::Draw(BRect update)
{
STRACE(("WinDecorator::Draw(): ")); update.PrintToStream();
fDrawingEngine->SetDrawState(&fDrawState);
_DrawFrame(update);
_DrawTab(update);
}
示例5:
/*! \brief Updates the decorator in the rectangular area \a updateRect.
Updates all areas which intersect the frame and tab.
\param updateRect The rectangular area to update.
*/
void
TabDecorator::Draw(BRect updateRect)
{
STRACE(("TabDecorator::Draw(BRect updateRect): "));
updateRect.PrintToStream();
fDrawingEngine->SetDrawState(&fDrawState);
_DrawFrame(updateRect & fBorderRect);
_DrawTabs(updateRect & fTitleBarRect);
}
示例6:
/*! \brief Updates the decorator in the rectangular area \a updateRect.
Updates all areas which intersect the frame and tab.
\param updateRect The rectangular area to update.
*/
void
WinDecorator::Draw(BRect updateRect)
{
STRACE(("WinDecorator::Draw(BRect updateRect): "));
updateRect.PrintToStream();
// We need to draw a few things: the tab, the resize knob, the borders,
// and the buttons
fDrawingEngine->SetDrawState(&fDrawState);
_DrawFrame(updateRect & fBorderRect);
_DrawTabs(updateRect & fTitleBarRect);
}
示例7: SubtractInsets
void
BTwoDimensionalLayout::LayoutView()
{
_ValidateMinMax();
// layout the horizontal/vertical elements
BSize size = SubtractInsets(View()->Frame().Size());
#ifdef DEBUG_LAYOUT
printf("BTwoDimensionalLayout::LayoutView(%p): size: (%.1f, %.1f)\n",
View(), size.width, size.height);
#endif
fLocalLayouter->Layout(size);
// layout the items
int itemCount = CountItems();
for (int i = 0; i < itemCount; i++) {
BLayoutItem* item = ItemAt(i);
if (item->IsVisible()) {
Dimensions itemDimensions;
GetItemDimensions(item, &itemDimensions);
BRect frame = fLocalLayouter->ItemFrame(itemDimensions);
frame.left += fLeftInset;
frame.top += fTopInset;
frame.right += fLeftInset;
frame.bottom += fTopInset;
{
#ifdef DEBUG_LAYOUT
printf(" frame for item %2d (view: %p): ", i, item->View());
frame.PrintToStream();
#endif
//BSize min(item->MinSize());
//BSize max(item->MaxSize());
//printf(" min: (%.1f, %.1f), max: (%.1f, %.1f)\n", min.width, min.height,
// max.width, max.height);
//if (item->HasHeightForWidth()) {
//float minHeight, maxHeight, preferredHeight;
//item->GetHeightForWidth(frame.Width(), &minHeight, &maxHeight,
// &preferredHeight);
//printf(" hfw: min: %.1f, max: %.1f, pref: %.1f\n", minHeight, maxHeight,
// preferredHeight);
//}
}
item->AlignInFrame(frame);
}
//else
//printf(" item %2d not visible", i);
}
}
示例8: r
// Draw
void
TestView::Draw(BRect updateRect)
{
printf("TestView::Draw(");
updateRect.PrintToStream();
BRect r(Bounds());
rgb_color light = tint_color(ViewColor(), B_LIGHTEN_2_TINT);
rgb_color shadow = tint_color(ViewColor(), B_DARKEN_2_TINT);
BeginLineArray(4);
AddLine(r.LeftTop(), r.RightTop(), light);
AddLine(r.RightTop(), r.RightBottom(), shadow);
AddLine(r.RightBottom(), r.LeftBottom(), shadow);
AddLine(r.LeftBottom(), r.LeftTop(), light);
EndLineArray();
}
示例9: BView
TargetSettingsWin::TargetSettingsWin(const char *uWindowTitle, TargetConfig *targetConfig)
:
BWindow(
BRect(64, 64, 680, 450),
uWindowTitle,
B_FLOATING_WINDOW_LOOK,
/*B_NORMAL_WINDOW_FEEL*/ B_MODAL_APP_WINDOW_FEEL,
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE,
0 )
{
assert(targetConfig != NULL);
MainView = new BView(BWindow::Bounds(), NULL, B_FOLLOW_ALL, 0);
if (MainView == NULL)
{
AppReturnValue = B_NO_MEMORY;
be_app->PostMessage(B_QUIT_REQUESTED);
return;
}
MainView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BWindow::AddChild(MainView);
//members
fConfig = targetConfig;
fChangedConfig = false;
fGeneralSettingsChanged = false;
fCompilerSettingsChanged = false;
fLinkerSettingsChanged = false;
fIncludeSettingsChanged = false;
//list of available settings
BRect r = MainView->Bounds();
r.left += 15;
r.bottom = r.top + (r.bottom - r.top)/2;
r.top += 15;
r.right = r.left + 100;
fSettingsListView = new BListView(r, "settings list");
fSettingsListView->SetSelectionMessage(new BMessage(PANEL_LIST_ITEM_SELECTED));
//XXX - the following doesn't work. Why?
fSettingsListView->Select(0); //select the first item, i.e. "general settings"
MainView->AddChild(fSettingsListView);
fSettingsListView->AddItem(new BStringItem("General"));
fSettingsListView->AddItem(new BStringItem("Include Paths"));
fSettingsListView->AddItem(new BStringItem("Compiler Options"));
fSettingsListView->AddItem(new BStringItem("Linker Options"));
/////////////////////////////////////////////////////////////////////
//create all settings panels. Use the same rect for all views.
r = MainView->Bounds();
r.top += 15;
r.right -= 15;
r.bottom -= 50;
r.left += fSettingsListView->Bounds().Width() + 30;
//create GeneralSettingsView and make it the current view
fGeneralSettingsView = new GeneralSettingsView(r, "general settings view");
fCurrentSettingsView = fGeneralSettingsView;
MainView->AddChild(fGeneralSettingsView);
fCompilerSettingsView = new CompilerSettingsView(r, "compiler settings view");
fLinkerSettingsView = new LinkerSettingsView(r, "linker settings view");
fIncludeSettingsView = new IncludeSettingsView(r, "include settings view");
/////////////////////////////////////////////////////////////////////
//insert 'OK' and 'Cancel' buttons
r = BWindow::Bounds();
r.top = fGeneralSettingsView->Bounds().bottom + 30;
r.bottom -= 15;
r.right -=15;
r.left = r.right - 75;
r.PrintToStream();
//OK
BButton* okButton = new BButton(r, "OK button", "OK", new BMessage(OK_BUTTON_PRESSED));
MainView->AddChild(okButton);
//Cancel
r.right = r.left - 15;
r.left = r.right - 75;
r.PrintToStream();
BButton* cancelButton = new BButton(r, "Cancel button", "Cancel", new BMessage(CANCEL_BUTTON_PRESSED));
MainView->AddChild(cancelButton);
/////////////////////////////////////////////////////////////////////
//initialize views with configuration settings
PopulateSettings();
//tell the application that there's a new window
Register();
//last but not least...
Show();
}