本文整理汇总了C++中BPoseView类的典型用法代码示例。如果您正苦于以下问题:C++ BPoseView类的具体用法?C++ BPoseView怎么用?C++ BPoseView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BPoseView类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: viewBounds
void
BackgroundImage::Show(BackgroundImageInfo *info, BView *view)
{
BPoseView *poseView = dynamic_cast<BPoseView *>(view);
if (poseView)
poseView->SetWidgetTextOutline(info->fTextWidgetOutline);
if (info->fBitmap == NULL) {
view->ClearViewBitmap();
view->Invalidate();
fShowingBitmap = info;
return;
}
BRect viewBounds(view->Bounds());
BRect bitmapBounds(info->fBitmap->Bounds());
BRect destinationBitmapBounds(bitmapBounds);
uint32 tile = 0;
uint32 followFlags = B_FOLLOW_TOP | B_FOLLOW_LEFT;
// figure out the display mode and the destination bounds for the bitmap
switch (info->fMode) {
case kCentered:
if (fIsDesktop) {
destinationBitmapBounds.OffsetBy(
(viewBounds.Width() - bitmapBounds.Width()) / 2,
(viewBounds.Height() - bitmapBounds.Height()) / 2);
break;
}
// else fall thru
case kScaledToFit:
if (fIsDesktop) {
destinationBitmapBounds = viewBounds;
followFlags = B_FOLLOW_ALL;
break;
}
// else fall thru
case kAtOffset:
destinationBitmapBounds.OffsetTo(info->fOffset);
break;
case kTiled:
if (fIsDesktop) {
destinationBitmapBounds.OffsetBy(
(viewBounds.Width() - bitmapBounds.Width()) / 2,
(viewBounds.Height() - bitmapBounds.Height()) / 2);
}
tile = B_TILE_BITMAP;
break;
}
// switch to the bitmap and force a redraw
view->SetViewBitmap(info->fBitmap, bitmapBounds, destinationBitmapBounds,
followFlags, tile);
view->Invalidate();
fShowingBitmap = info;
}
示例2:
void
BackgroundImage::Remove()
{
if (fShowingBitmap) {
fView->ClearViewBitmap();
fView->Invalidate();
BPoseView *poseView = dynamic_cast<BPoseView *>(fView);
// make sure text widgets draw the default way, erasing their background
if (poseView)
poseView->SetWidgetTextOutline(true);
}
fShowingBitmap = NULL;
}
示例3: ImageInfoForWorkspace
void
BackgroundImage::Show(BView *view, int32 workspace)
{
fView = view;
BackgroundImageInfo *info = ImageInfoForWorkspace(workspace);
if (info) {
BPoseView *poseView = dynamic_cast<BPoseView *>(fView);
if (poseView)
poseView->SetWidgetTextOutline(info->fTextWidgetOutline);
Show(info, fView);
}
}
示例4: poseViewBounds
void
ColumnResizeState::DrawLine()
{
BPoseView *poseView = fTitleView->PoseView();
ASSERT(!poseView->IsDesktopWindow());
BRect poseViewBounds(poseView->Bounds());
// remember the line location
poseViewBounds.left = fTitle->Bounds().right;
fLastLineDrawPos = poseViewBounds.left;
// draw the line in the new location
_DrawLine(poseView, poseViewBounds.LeftTop(), poseViewBounds.LeftBottom());
}
示例5: bounds
void
ColumnResizeState::Moved(BPoint where, uint32)
{
float newWidth = where.x + fInitialTrackOffset - fTitle->fColumn->Offset();
if (newWidth < kMinColumnWidth)
newWidth = kMinColumnWidth;
BPoseView *poseView = fTitleView->PoseView();
// bool shrink = (newWidth < fTitle->fColumn->Width());
// resize the column
poseView->ResizeColumn(fTitle->fColumn, newWidth, &fLastLineDrawPos,
_DrawLine, _UndrawLine);
BRect bounds(fTitleView->Bounds());
bounds.left = fTitle->fColumn->Offset();
// force title redraw
fTitleView->Draw(bounds, true, false);
}
示例6: lock
bool
TTracker::SelectChildInParent(const entry_ref *parent, const node_ref *child)
{
AutoLock<WindowList> lock(&fWindowList);
BContainerWindow *window = FindContainerWindow(parent);
if (!window)
// parent window already closed, give up
return false;
AutoLock<BWindow> windowLock(window);
if (windowLock.IsLocked()) {
BPoseView *view = window->PoseView();
int32 index;
BPose *pose = view->FindPose(child, &index);
if (pose) {
view->SelectPose(pose, index);
return true;
}
}
return false;
}
示例7: TextViewFilter
static filter_result
TextViewFilter(BMessage* message, BHandler**, BMessageFilter* filter)
{
uchar key;
if (message->FindInt8("byte", (int8*)&key) != B_OK)
return B_DISPATCH_MESSAGE;
ThrowOnAssert(filter != NULL);
BContainerWindow* window = dynamic_cast<BContainerWindow*>(
filter->Looper());
ThrowOnAssert(window != NULL);
BPoseView* poseView = window->PoseView();
ThrowOnAssert(poseView != NULL);
if (key == B_RETURN || key == B_ESCAPE) {
poseView->CommitActivePose(key == B_RETURN);
return B_SKIP_MESSAGE;
}
if (key == B_TAB) {
if (poseView->ActivePose()) {
if (message->FindInt32("modifiers") & B_SHIFT_KEY)
poseView->ActivePose()->EditPreviousWidget(poseView);
else
poseView->ActivePose()->EditNextWidget(poseView);
}
return B_SKIP_MESSAGE;
}
// the BTextView doesn't respect window borders when resizing itself;
// we try to work-around this "bug" here.
// find the text editing view
BView* scrollView = poseView->FindView("BorderView");
if (scrollView != NULL) {
BTextView* textView = dynamic_cast<BTextView*>(
scrollView->FindView("WidgetTextView"));
if (textView != NULL) {
BRect rect = scrollView->Frame();
if (rect.right + 3 > poseView->Bounds().right
|| rect.left - 3 < 0)
textView->MakeResizable(true, NULL);
}
}
return B_DISPATCH_MESSAGE;
}
示例8: key_down_filter
static filter_result
key_down_filter(BMessage* message, BHandler** handler, BMessageFilter* filter)
{
ASSERT(filter != NULL);
if (filter == NULL)
return B_DISPATCH_MESSAGE;
TFilePanel* panel = dynamic_cast<TFilePanel*>(filter->Looper());
ASSERT(panel != NULL);
if (panel == NULL)
return B_DISPATCH_MESSAGE;
BPoseView* view = panel->PoseView();
if (panel->TrackingMenu())
return B_DISPATCH_MESSAGE;
uchar key;
if (message->FindInt8("byte", (int8*)&key) != B_OK)
return B_DISPATCH_MESSAGE;
int32 modifier = 0;
message->FindInt32("modifiers", &modifier);
if (!modifier && key == B_ESCAPE) {
if (view->ActivePose())
view->CommitActivePose(false);
else if (view->IsFiltering())
filter->Looper()->PostMessage(B_CANCEL, *handler);
else
filter->Looper()->PostMessage(kCancelButton);
return B_SKIP_MESSAGE;
}
if (key == B_RETURN && view->ActivePose()) {
view->CommitActivePose();
return B_SKIP_MESSAGE;
}
return B_DISPATCH_MESSAGE;
}
示例9: if
void
ColumnDragState::Clicked(BPoint /*where*/)
{
BPoseView *poseView = fTitleView->PoseView();
uint32 hash = fTitle->Column()->AttrHash();
uint32 primarySort = poseView->PrimarySort();
uint32 secondarySort = poseView->SecondarySort();
bool shift = (modifiers() & B_SHIFT_KEY) != 0;
// For now:
// if we hit the primary sort field again
// then if shift key was down, switch primary and secondary
if (hash == primarySort) {
if (shift && secondarySort) {
poseView->SetPrimarySort(secondarySort);
poseView->SetSecondarySort(primarySort);
} else
poseView->SetReverseSort(!poseView->ReverseSort());
} else if (shift) {
// hit secondary sort column with shift key, disable
if (hash == secondarySort)
poseView->SetSecondarySort(0);
else
poseView->SetSecondarySort(hash);
} else {
poseView->SetPrimarySort(hash);
poseView->SetReverseSort(false);
}
if (poseView->PrimarySort() == poseView->SecondarySort())
poseView->SetSecondarySort(0);
UndrawOutline();
poseView->SortPoses();
poseView->Invalidate();
}
示例10: process_refs
/*!
\brief Tracker add-on entry
*/
extern "C" void
process_refs(entry_ref dir, BMessage* refs, void* /*reserved*/)
{
status_t status;
BAlert *alert;
BMessenger msgr;
BPoseView *view = NULL;
BMessage poseViewBackup;
BMessage poseViewColumnBackup;
uint32 poseViewModeBackup;
BString windowTitleBackup;
refs->PrintToStream();
status = refs->FindMessenger("TrackerViewToken", &msgr);
if (status < B_OK) {
Error(view, status);
return;
}
status = B_ERROR;
if (!msgr.LockTarget()) {
Error(view, status);
return;
}
status = B_BAD_HANDLER;
view = dynamic_cast<BPoseView *>(msgr.Target(NULL));
if (!view) {
Error(view, status);
return;
}
if (dynamic_cast<BWindow *>(view->Looper()) == NULL) {
Error(view, status, true);
return;
}
windowTitleBackup = view->Window()->Title();
view->SaveColumnState(poseViewColumnBackup);
view->SaveState(poseViewBackup);
view->SetDragEnabled(false);
view->SetSelectionRectEnabled(false);
view->SetPoseEditing(false);
poseViewModeBackup = view->ViewMode();
view->SetViewMode(kIconMode);
view->ShowBarberPole();
view->UnlockLooper();
alert = new BAlert("Error", "IconVader:\nClick on the icons to get points."
"\nAvoid symlinks!", "OK");
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
int32 score = 0;
int32 count = 300;
while (count--) {
status = B_ERROR;
if (!msgr.LockTarget()) {
Error(view, status);
return;
}
BPose *pose;
for (int32 i = 0; (pose = view->PoseAtIndex(i)); i++) {
if (pose->IsSelected()) {
if (pose->TargetModel()->IsFile())
score++;
if (pose->TargetModel()->IsDirectory())
score+=2;
if (pose->TargetModel()->IsSymLink())
score-=10;
pose->Select(false);
}
#ifdef __HAIKU__
BPoint location = pose->Location(view);
#else
BPoint location = pose->Location();
#endif
location.x += ((rand() % 20) - 10);
location.y += ((rand() % 20) - 10);
#ifdef __HAIKU__
pose->SetLocation(location, view);
#else
pose->SetLocation(location);
#endif
}
view->CheckPoseVisibility();
//.........这里部分代码省略.........