* Set the _RESIZE_MASK_ macro to 0xffff. It was the bitwise inverse of the

disjunction of all view flags before, and the new layout related flags were
  missing. I suppose there was not striking reason for previous method.
* Made InvalidateLayout() virtual. When implementing layout management
  directly in a derived class instead of a separate BLayout, one needs to
  override it to know when to discard cashed layout infos.
* Added a ResizeTo(BSize) method.
* Avoided ugly multi-line strings in PrintToStream().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21355 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2007-06-08 23:24:38 +00:00
parent ea2dcf71dc
commit d432839022
2 changed files with 47 additions and 42 deletions

View File

@ -80,9 +80,7 @@ const uint32 _B_RESERVED7_ = 0x00200000UL; /* 22 */
const uint32 B_SUPPORTS_LAYOUT = 0x00100000UL; /* 21 */
const uint32 B_INVALIDATE_AFTER_LAYOUT = 0x00080000UL; /* 20 */
#define _RESIZE_MASK_ ~(B_FULL_UPDATE_ON_RESIZE | _B_RESERVED1_ | B_WILL_DRAW \
| B_PULSE_NEEDED | B_NAVIGABLE_JUMP | B_FRAME_EVENTS | B_NAVIGABLE \
| B_SUBPIXEL_PRECISE | B_DRAW_ON_CHILDREN | B_INPUT_METHOD_AWARE | _B_RESERVED7_)
#define _RESIZE_MASK_ (0xffff)
const uint32 _VIEW_TOP_ = 1UL;
const uint32 _VIEW_LEFT_ = 2UL;
@ -473,6 +471,7 @@ public:
void MoveTo(float x, float y);
void ResizeBy(float dh, float dv);
void ResizeTo(float width, float height);
void ResizeTo(BSize size);
void ScrollBy(float dh, float dv);
void ScrollTo(float x, float y);
virtual void ScrollTo(BPoint where);
@ -533,7 +532,7 @@ public:
virtual void SetLayout(BLayout* layout);
BLayout* GetLayout() const;
void InvalidateLayout(bool descendants = false);
virtual void InvalidateLayout(bool descendants = false);
void EnableLayoutInvalidation();
void DisableLayoutInvalidation();
bool IsLayoutValid() const;
@ -560,7 +559,6 @@ private:
friend class BTabView;
friend class BWindow;
virtual void _ReservedView10();
virtual void _ReservedView11();
virtual void _ReservedView12();
virtual void _ReservedView13();

View File

@ -3642,6 +3642,13 @@ BView::ResizeTo(float width, float height)
}
void
BView::ResizeTo(BSize size)
{
ResizeBy(size.width - fBounds.Width(), size.height - fBounds.Height());
}
// #pragma mark -
// Inherited Methods (from BHandler)
@ -4843,7 +4850,7 @@ extern "C" void _ReservedView6__5BView() {}
extern "C" void _ReservedView7__5BView() {}
extern "C" void _ReservedView8__5BView() {}
extern "C" void _ReservedView9__5BView() {}
void BView::_ReservedView10(){}
extern "C" void _ReservedView10__5BView() {}
void BView::_ReservedView11(){}
void BView::_ReservedView12(){}
void BView::_ReservedView13(){}
@ -4871,25 +4878,25 @@ void
BView::PrintToStream()
{
printf("BView::PrintToStream()\n");
printf("\tName: %s\
\tParent: %s\
\tFirstChild: %s\
\tNextSibling: %s\
\tPrevSibling: %s\
\tOwner(Window): %s\
\tToken: %ld\
\tFlags: %ld\
\tView origin: (%f,%f)\
\tView Bounds rectangle: (%f,%f,%f,%f)\
\tShow level: %d\
\tTopView?: %s\
\tBPicture: %s\
\tVertical Scrollbar %s\
\tHorizontal Scrollbar %s\
\tIs Printing?: %s\
\tShelf?: %s\
\tEventMask: %ld\
\tEventOptions: %ld\n",
printf("\tName: %s\n"
"\tParent: %s\n"
"\tFirstChild: %s\n"
"\tNextSibling: %s\n"
"\tPrevSibling: %s\n"
"\tOwner(Window): %s\n"
"\tToken: %ld\n"
"\tFlags: %ld\n"
"\tView origin: (%f,%f)\n"
"\tView Bounds rectangle: (%f,%f,%f,%f)\n"
"\tShow level: %d\n"
"\tTopView?: %s\n"
"\tBPicture: %s\n"
"\tVertical Scrollbar %s\n"
"\tHorizontal Scrollbar %s\n"
"\tIs Printing?: %s\n"
"\tShelf?: %s\n"
"\tEventMask: %ld\n"
"\tEventOptions: %ld\n",
Name(),
fParent ? fParent->Name() : "NULL",
fFirstChild ? fFirstChild->Name() : "NULL",
@ -4910,23 +4917,23 @@ BView::PrintToStream()
fEventMask,
fEventOptions);
printf("\tState status:\
\t\tLocalCoordianteSystem: (%f,%f)\
\t\tPenLocation: (%f,%f)\
\t\tPenSize: %f\
\t\tHighColor: [%d,%d,%d,%d]\
\t\tLowColor: [%d,%d,%d,%d]\
\t\tViewColor: [%d,%d,%d,%d]\
\t\tPattern: %llx\
\t\tDrawingMode: %d\
\t\tLineJoinMode: %d\
\t\tLineCapMode: %d\
\t\tMiterLimit: %f\
\t\tAlphaSource: %d\
\t\tAlphaFuntion: %d\
\t\tScale: %f\
\t\t(Print)FontAliasing: %s\
\t\tFont Info:\n",
printf("\tState status:\n"
"\t\tLocalCoordianteSystem: (%f,%f)\n"
"\t\tPenLocation: (%f,%f)\n"
"\t\tPenSize: %f\n"
"\t\tHighColor: [%d,%d,%d,%d]\n"
"\t\tLowColor: [%d,%d,%d,%d]\n"
"\t\tViewColor: [%d,%d,%d,%d]\n"
"\t\tPattern: %llx\n"
"\t\tDrawingMode: %d\n"
"\t\tLineJoinMode: %d\n"
"\t\tLineCapMode: %d\n"
"\t\tMiterLimit: %f\n"
"\t\tAlphaSource: %d\n"
"\t\tAlphaFuntion: %d\n"
"\t\tScale: %f\n"
"\t\t(Print)FontAliasing: %s\n"
"\t\tFont Info:\n",
fState->origin.x, fState->origin.y,
fState->pen_location.x, fState->pen_location.y,
fState->pen_size,