1 /* 2 * Copyright 2001-2013 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _VIEW_H 6 #define _VIEW_H 7 8 9 #include <Alignment.h> 10 #include <Font.h> 11 #include <Handler.h> 12 #include <InterfaceDefs.h> 13 #include <Rect.h> 14 #include <Gradient.h> 15 16 17 // mouse button 18 enum { 19 B_PRIMARY_MOUSE_BUTTON = 0x01, 20 B_SECONDARY_MOUSE_BUTTON = 0x02, 21 B_TERTIARY_MOUSE_BUTTON = 0x04 22 }; 23 24 // mouse transit 25 enum { 26 B_ENTERED_VIEW = 0, 27 B_INSIDE_VIEW, 28 B_EXITED_VIEW, 29 B_OUTSIDE_VIEW 30 }; 31 32 // event mask 33 enum { 34 B_POINTER_EVENTS = 0x00000001, 35 B_KEYBOARD_EVENTS = 0x00000002 36 }; 37 38 // event mask options 39 enum { 40 B_LOCK_WINDOW_FOCUS = 0x00000001, 41 B_SUSPEND_VIEW_FOCUS = 0x00000002, 42 B_NO_POINTER_HISTORY = 0x00000004, 43 // NOTE: New in Haiku (unless this flag is 44 // specified, both BWindow and BView::GetMouse() 45 // will filter out older mouse moved messages) 46 B_FULL_POINTER_HISTORY = 0x00000008 47 }; 48 49 enum { 50 B_TRACK_WHOLE_RECT, 51 B_TRACK_RECT_CORNER 52 }; 53 54 // set font mask 55 enum { 56 B_FONT_FAMILY_AND_STYLE = 0x00000001, 57 B_FONT_SIZE = 0x00000002, 58 B_FONT_SHEAR = 0x00000004, 59 B_FONT_ROTATION = 0x00000008, 60 B_FONT_SPACING = 0x00000010, 61 B_FONT_ENCODING = 0x00000020, 62 B_FONT_FACE = 0x00000040, 63 B_FONT_FLAGS = 0x00000080, 64 B_FONT_FALSE_BOLD_WIDTH = 0x00000100, 65 B_FONT_ALL = 0x000001FF 66 }; 67 68 // view flags 69 const uint32 B_FULL_UPDATE_ON_RESIZE = 0x80000000UL; /* 31 */ 70 const uint32 _B_RESERVED1_ = 0x40000000UL; /* 30 */ 71 const uint32 B_WILL_DRAW = 0x20000000UL; /* 29 */ 72 const uint32 B_PULSE_NEEDED = 0x10000000UL; /* 28 */ 73 const uint32 B_NAVIGABLE_JUMP = 0x08000000UL; /* 27 */ 74 const uint32 B_FRAME_EVENTS = 0x04000000UL; /* 26 */ 75 const uint32 B_NAVIGABLE = 0x02000000UL; /* 25 */ 76 const uint32 B_SUBPIXEL_PRECISE = 0x01000000UL; /* 24 */ 77 const uint32 B_DRAW_ON_CHILDREN = 0x00800000UL; /* 23 */ 78 const uint32 B_INPUT_METHOD_AWARE = 0x00400000UL; /* 23 */ 79 const uint32 _B_RESERVED7_ = 0x00200000UL; /* 22 */ 80 const uint32 B_SUPPORTS_LAYOUT = 0x00100000UL; /* 21 */ 81 const uint32 B_INVALIDATE_AFTER_LAYOUT = 0x00080000UL; /* 20 */ 82 83 #define _RESIZE_MASK_ (0xffff) 84 85 const uint32 _VIEW_TOP_ = 1UL; 86 const uint32 _VIEW_LEFT_ = 2UL; 87 const uint32 _VIEW_BOTTOM_ = 3UL; 88 const uint32 _VIEW_RIGHT_ = 4UL; 89 const uint32 _VIEW_CENTER_ = 5UL; 90 91 inline uint32 _rule_(uint32 r1, uint32 r2, uint32 r3, uint32 r4) 92 { return ((r1 << 12) | (r2 << 8) | (r3 << 4) | r4); } 93 94 #define B_FOLLOW_NONE 0 95 #define B_FOLLOW_ALL_SIDES _rule_(_VIEW_TOP_, _VIEW_LEFT_, _VIEW_BOTTOM_, \ 96 _VIEW_RIGHT_) 97 #define B_FOLLOW_ALL B_FOLLOW_ALL_SIDES 98 99 #define B_FOLLOW_LEFT _rule_(0, _VIEW_LEFT_, 0, _VIEW_LEFT_) 100 #define B_FOLLOW_RIGHT _rule_(0, _VIEW_RIGHT_, 0, _VIEW_RIGHT_) 101 #define B_FOLLOW_LEFT_RIGHT _rule_(0, _VIEW_LEFT_, 0, _VIEW_RIGHT_) 102 #define B_FOLLOW_H_CENTER _rule_(0, _VIEW_CENTER_, 0, _VIEW_CENTER_) 103 104 #define B_FOLLOW_TOP _rule_(_VIEW_TOP_, 0, _VIEW_TOP_, 0) 105 #define B_FOLLOW_BOTTOM _rule_(_VIEW_BOTTOM_, 0, _VIEW_BOTTOM_, 0) 106 #define B_FOLLOW_TOP_BOTTOM _rule_(_VIEW_TOP_, 0, _VIEW_BOTTOM_, 0) 107 #define B_FOLLOW_V_CENTER _rule_(_VIEW_CENTER_, 0, _VIEW_CENTER_, 0) 108 109 class BBitmap; 110 class BCursor; 111 class BLayout; 112 class BLayoutContext; 113 class BLayoutItem; 114 class BMessage; 115 class BPicture; 116 class BPolygon; 117 class BRegion; 118 class BScrollBar; 119 class BScrollView; 120 class BShape; 121 class BShelf; 122 class BString; 123 class BToolTip; 124 class BWindow; 125 struct _array_data_; 126 struct _array_hdr_; 127 struct overlay_restrictions; 128 129 namespace BPrivate { 130 class ViewState; 131 }; 132 133 134 class BView : public BHandler { 135 public: 136 BView(const char* name, uint32 flags, 137 BLayout* layout = NULL); 138 BView(BRect frame, const char* name, 139 uint32 resizeMask, uint32 flags); 140 virtual ~BView(); 141 142 BView(BMessage* archive); 143 static BArchivable* Instantiate(BMessage* archive); 144 virtual status_t Archive(BMessage* archive, 145 bool deep = true) const; 146 virtual status_t AllUnarchived(const BMessage* archive); 147 virtual status_t AllArchived(BMessage* archive) const; 148 149 virtual void AttachedToWindow(); 150 virtual void AllAttached(); 151 virtual void DetachedFromWindow(); 152 virtual void AllDetached(); 153 154 virtual void MessageReceived(BMessage* message); 155 156 void AddChild(BView* child, BView* before = NULL); 157 bool AddChild(BLayoutItem* child); 158 bool RemoveChild(BView* child); 159 int32 CountChildren() const; 160 BView* ChildAt(int32 index) const; 161 BView* NextSibling() const; 162 BView* PreviousSibling() const; 163 bool RemoveSelf(); 164 165 BWindow* Window() const; 166 167 virtual void Draw(BRect updateRect); 168 virtual void MouseDown(BPoint where); 169 virtual void MouseUp(BPoint where); 170 virtual void MouseMoved(BPoint where, uint32 code, 171 const BMessage* dragMessage); 172 virtual void WindowActivated(bool state); 173 virtual void KeyDown(const char* bytes, int32 numBytes); 174 virtual void KeyUp(const char* bytes, int32 numBytes); 175 virtual void Pulse(); 176 virtual void FrameMoved(BPoint newPosition); 177 virtual void FrameResized(float newWidth, float newHeight); 178 179 virtual void TargetedByScrollView(BScrollView* scrollView); 180 void BeginRectTracking(BRect startRect, 181 uint32 style = B_TRACK_WHOLE_RECT); 182 void EndRectTracking(); 183 184 void GetMouse(BPoint* location, uint32* buttons, 185 bool checkMessageQueue = true); 186 187 void DragMessage(BMessage* message, BRect dragRect, 188 BHandler* replyTo = NULL); 189 void DragMessage(BMessage* message, BBitmap* bitmap, 190 BPoint offset, BHandler* replyTo = NULL); 191 void DragMessage(BMessage* message, BBitmap* bitmap, 192 drawing_mode dragMode, BPoint offset, 193 BHandler* replyTo = NULL); 194 195 BView* FindView(const char* name) const; 196 BView* Parent() const; 197 BRect Bounds() const; 198 BRect Frame() const; 199 void ConvertToScreen(BPoint* point) const; 200 BPoint ConvertToScreen(BPoint point) const; 201 void ConvertFromScreen(BPoint* point) const; 202 BPoint ConvertFromScreen(BPoint point) const; 203 void ConvertToScreen(BRect* rect) const; 204 BRect ConvertToScreen(BRect rect) const; 205 void ConvertFromScreen(BRect* rect) const; 206 BRect ConvertFromScreen(BRect rect) const; 207 void ConvertToParent(BPoint* point) const; 208 BPoint ConvertToParent(BPoint point) const; 209 void ConvertFromParent(BPoint* point) const; 210 BPoint ConvertFromParent(BPoint point) const; 211 void ConvertToParent(BRect* rect) const; 212 BRect ConvertToParent(BRect rect) const; 213 void ConvertFromParent(BRect* rect) const; 214 BRect ConvertFromParent(BRect rect) const; 215 BPoint LeftTop() const; 216 217 void GetClippingRegion(BRegion* region) const; 218 virtual void ConstrainClippingRegion(BRegion* region); 219 void ClipToPicture(BPicture* picture, 220 BPoint where = B_ORIGIN, bool sync = true); 221 void ClipToInversePicture(BPicture* picture, 222 BPoint where = B_ORIGIN, bool sync = true); 223 224 virtual void SetDrawingMode(drawing_mode mode); 225 drawing_mode DrawingMode() const; 226 227 void SetBlendingMode(source_alpha srcAlpha, 228 alpha_function alphaFunc); 229 void GetBlendingMode(source_alpha* srcAlpha, 230 alpha_function* alphaFunc) const; 231 232 virtual void SetPenSize(float size); 233 float PenSize() const; 234 235 void SetViewCursor(const BCursor* cursor, 236 bool sync = true); 237 238 virtual void SetViewColor(rgb_color color); 239 void SetViewColor(uchar red, uchar green, uchar blue, 240 uchar alpha = 255); 241 rgb_color ViewColor() const; 242 243 void SetViewBitmap(const BBitmap* bitmap, 244 BRect srcRect, BRect dstRect, 245 uint32 followFlags 246 = B_FOLLOW_TOP | B_FOLLOW_LEFT, 247 uint32 options = B_TILE_BITMAP); 248 void SetViewBitmap(const BBitmap* bitmap, 249 uint32 followFlags 250 = B_FOLLOW_TOP | B_FOLLOW_LEFT, 251 uint32 options = B_TILE_BITMAP); 252 void ClearViewBitmap(); 253 254 status_t SetViewOverlay(const BBitmap* overlay, 255 BRect srcRect, BRect dstRect, 256 rgb_color* colorKey, 257 uint32 followFlags 258 = B_FOLLOW_TOP | B_FOLLOW_LEFT, 259 uint32 options = 0); 260 status_t SetViewOverlay(const BBitmap* overlay, 261 rgb_color* colorKey, 262 uint32 followFlags 263 = B_FOLLOW_TOP | B_FOLLOW_LEFT, 264 uint32 options = 0); 265 void ClearViewOverlay(); 266 267 virtual void SetHighColor(rgb_color color); 268 void SetHighColor(uchar red, uchar green, uchar blue, 269 uchar alpha = 255); 270 rgb_color HighColor() const; 271 272 virtual void SetLowColor(rgb_color color); 273 void SetLowColor(uchar red, uchar green, uchar blue, 274 uchar alpha = 255); 275 rgb_color LowColor() const; 276 277 void SetLineMode(cap_mode lineCap, 278 join_mode lineJoin, 279 float miterLimit = B_DEFAULT_MITER_LIMIT); 280 join_mode LineJoinMode() const; 281 cap_mode LineCapMode() const; 282 float LineMiterLimit() const; 283 284 void SetOrigin(BPoint pt); 285 void SetOrigin(float x, float y); 286 BPoint Origin() const; 287 288 void PushState(); 289 void PopState(); 290 291 void MovePenTo(BPoint pt); 292 void MovePenTo(float x, float y); 293 void MovePenBy(float x, float y); 294 BPoint PenLocation() const; 295 void StrokeLine(BPoint toPoint, 296 ::pattern pattern = B_SOLID_HIGH); 297 void StrokeLine(BPoint start, BPoint end, 298 ::pattern pattern = B_SOLID_HIGH); 299 void BeginLineArray(int32 count); 300 void AddLine(BPoint start, BPoint end, 301 rgb_color color); 302 void EndLineArray(); 303 304 void StrokePolygon(const BPolygon* polygon, 305 bool closed = true, 306 ::pattern pattern = B_SOLID_HIGH); 307 void StrokePolygon(const BPoint* pointArray, 308 int32 numPoints, bool closed = true, 309 ::pattern pattern = B_SOLID_HIGH); 310 void StrokePolygon(const BPoint* pointArray, 311 int32 numPoints, BRect bounds, 312 bool closed = true, 313 ::pattern pattern = B_SOLID_HIGH); 314 void FillPolygon(const BPolygon* polygon, 315 ::pattern pattern = B_SOLID_HIGH); 316 void FillPolygon(const BPoint* pointArray, 317 int32 numPoints, 318 ::pattern pattern = B_SOLID_HIGH); 319 void FillPolygon(const BPoint* pointArray, 320 int32 numPoints, BRect bounds, 321 ::pattern pattern = B_SOLID_HIGH); 322 void FillPolygon(const BPolygon* polygon, 323 const BGradient& gradient); 324 void FillPolygon(const BPoint* pointArray, 325 int32 numPoints, const BGradient& gradient); 326 void FillPolygon(const BPoint* pointArray, 327 int32 numPoints, BRect bounds, 328 const BGradient& gradient); 329 330 void StrokeTriangle(BPoint point1, BPoint point2, 331 BPoint point3, BRect bounds, 332 ::pattern pattern = B_SOLID_HIGH); 333 void StrokeTriangle(BPoint point1, BPoint point2, 334 BPoint point3, 335 ::pattern pattern = B_SOLID_HIGH); 336 void FillTriangle(BPoint point1, BPoint point2, 337 BPoint point3, 338 ::pattern pattern = B_SOLID_HIGH); 339 void FillTriangle(BPoint point1, BPoint point2, 340 BPoint point3, BRect bounds, 341 ::pattern pattern = B_SOLID_HIGH); 342 void FillTriangle(BPoint point1, BPoint point2, 343 BPoint point3, const BGradient& gradient); 344 void FillTriangle(BPoint point1, BPoint point2, 345 BPoint point3, BRect bounds, 346 const BGradient& gradient); 347 348 void StrokeRect(BRect rect, 349 ::pattern pattern = B_SOLID_HIGH); 350 void FillRect(BRect rect, 351 ::pattern pattern = B_SOLID_HIGH); 352 void FillRect(BRect rect, const BGradient& gradient); 353 void FillRegion(BRegion* rectegion, 354 ::pattern pattern = B_SOLID_HIGH); 355 void FillRegion(BRegion* rectegion, 356 const BGradient& gradient); 357 void InvertRect(BRect rect); 358 359 void StrokeRoundRect(BRect rect, float xRadius, 360 float yRadius, 361 ::pattern pattern = B_SOLID_HIGH); 362 void FillRoundRect(BRect rect, float xRadius, 363 float yRadius, 364 ::pattern pattern = B_SOLID_HIGH); 365 void FillRoundRect(BRect rect, float xRadius, 366 float yRadius, const BGradient& gradient); 367 368 void StrokeEllipse(BPoint center, float xRadius, 369 float yRadius, 370 ::pattern pattern = B_SOLID_HIGH); 371 void StrokeEllipse(BRect rect, 372 ::pattern pattern = B_SOLID_HIGH); 373 void FillEllipse(BPoint center, float xRadius, 374 float yRadius, 375 ::pattern pattern = B_SOLID_HIGH); 376 void FillEllipse(BRect rect, 377 ::pattern pattern = B_SOLID_HIGH); 378 void FillEllipse(BPoint center, float xRadius, 379 float yRadius, const BGradient& gradient); 380 void FillEllipse(BRect rect, 381 const BGradient& gradient); 382 383 void StrokeArc(BPoint center, float xRadius, 384 float yRadius, float startAngle, 385 float arcAngle, 386 ::pattern pattern = B_SOLID_HIGH); 387 void StrokeArc(BRect rect, float startAngle, 388 float arcAngle, 389 ::pattern pattern = B_SOLID_HIGH); 390 void FillArc(BPoint center, float xRadius, 391 float yRadius, float startAngle, 392 float arcAngle, 393 ::pattern pattern = B_SOLID_HIGH); 394 void FillArc(BRect rect, float startAngle, 395 float arcAngle, 396 ::pattern pattern = B_SOLID_HIGH); 397 void FillArc(BPoint center, float xRadius, 398 float yRadius, float startAngle, 399 float arcAngle, const BGradient& gradient); 400 void FillArc(BRect rect, float startAngle, 401 float arcAngle, const BGradient& gradient); 402 403 void StrokeBezier(BPoint* controlPoints, 404 ::pattern pattern = B_SOLID_HIGH); 405 void FillBezier(BPoint* controlPoints, 406 ::pattern pattern = B_SOLID_HIGH); 407 void FillBezier(BPoint* controlPoints, 408 const BGradient& gradient); 409 410 void StrokeShape(BShape* shape, 411 ::pattern pattern = B_SOLID_HIGH); 412 void FillShape(BShape* shape, 413 ::pattern pattern = B_SOLID_HIGH); 414 void FillShape(BShape* shape, 415 const BGradient& gradient); 416 417 void CopyBits(BRect src, BRect dst); 418 419 void DrawBitmapAsync(const BBitmap* aBitmap, 420 BRect bitmapRect, BRect viewRect, 421 uint32 options); 422 void DrawBitmapAsync(const BBitmap* aBitmap, 423 BRect bitmapRect, BRect viewRect); 424 void DrawBitmapAsync(const BBitmap* aBitmap, 425 BRect viewRect); 426 void DrawBitmapAsync(const BBitmap* aBitmap, 427 BPoint where); 428 void DrawBitmapAsync(const BBitmap* aBitmap); 429 430 void DrawBitmap(const BBitmap* aBitmap, 431 BRect bitmapRect, BRect viewRect, 432 uint32 options); 433 void DrawBitmap(const BBitmap* aBitmap, 434 BRect bitmapRect, BRect viewRect); 435 void DrawBitmap(const BBitmap* aBitmap, 436 BRect viewRect); 437 void DrawBitmap(const BBitmap* aBitmap, 438 BPoint where); 439 void DrawBitmap(const BBitmap* aBitmap); 440 441 void DrawChar(char aChar); 442 void DrawChar(char aChar, BPoint location); 443 void DrawString(const char* string, 444 escapement_delta* delta = NULL); 445 void DrawString(const char* string, 446 BPoint location, 447 escapement_delta* delta = NULL); 448 void DrawString(const char* string, int32 length, 449 escapement_delta* delta = NULL); 450 void DrawString(const char* string, int32 length, 451 BPoint location, 452 escapement_delta* delta = 0L); 453 void DrawString(const char* string, 454 const BPoint* locations, 455 int32 locationCount); 456 void DrawString(const char* string, int32 length, 457 const BPoint* locations, 458 int32 locationCount); 459 460 virtual void SetFont(const BFont* font, 461 uint32 mask = B_FONT_ALL); 462 463 void GetFont(BFont* font) const; 464 void TruncateString(BString* in_out, uint32 mode, 465 float width) const; 466 float StringWidth(const char* string) const; 467 float StringWidth(const char* string, 468 int32 length) const; 469 void GetStringWidths(char* stringArray[], 470 int32 lengthArray[], int32 numStrings, 471 float widthArray[]) const; 472 void SetFontSize(float size); 473 void ForceFontAliasing(bool enable); 474 void GetFontHeight(font_height* height) const; 475 476 void Invalidate(BRect invalRect); 477 void Invalidate(const BRegion* invalRegion); 478 void Invalidate(); 479 480 void SetDiskMode(char* filename, long offset); 481 482 void BeginPicture(BPicture* a_picture); 483 void AppendToPicture(BPicture* a_picture); 484 BPicture* EndPicture(); 485 486 void DrawPicture(const BPicture* a_picture); 487 void DrawPicture(const BPicture* a_picture, 488 BPoint where); 489 void DrawPicture(const char* filename, long offset, 490 BPoint where); 491 void DrawPictureAsync(const BPicture* a_picture); 492 void DrawPictureAsync(const BPicture* a_picture, 493 BPoint where); 494 void DrawPictureAsync(const char* filename, 495 long offset, BPoint where); 496 497 status_t SetEventMask(uint32 mask, uint32 options = 0); 498 uint32 EventMask(); 499 status_t SetMouseEventMask(uint32 mask, 500 uint32 options = 0); 501 502 virtual void SetFlags(uint32 flags); 503 uint32 Flags() const; 504 virtual void SetResizingMode(uint32 mode); 505 uint32 ResizingMode() const; 506 void MoveBy(float dh, float dv); 507 void MoveTo(BPoint where); 508 void MoveTo(float x, float y); 509 void ResizeBy(float dh, float dv); 510 void ResizeTo(float width, float height); 511 void ResizeTo(BSize size); 512 void ScrollBy(float dh, float dv); 513 void ScrollTo(float x, float y); 514 virtual void ScrollTo(BPoint where); 515 virtual void MakeFocus(bool focusState = true); 516 bool IsFocus() const; 517 518 virtual void Show(); 519 virtual void Hide(); 520 bool IsHidden() const; 521 bool IsHidden(const BView* looking_from) const; 522 523 void Flush() const; 524 void Sync() const; 525 526 virtual void GetPreferredSize(float* _width, float* _height); 527 virtual void ResizeToPreferred(); 528 529 BScrollBar* ScrollBar(orientation posture) const; 530 531 virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, 532 BMessage* specifier, int32 form, 533 const char* property); 534 virtual status_t GetSupportedSuites(BMessage* data); 535 536 bool IsPrinting() const; 537 void SetScale(float scale) const; 538 float Scale() const; 539 // new for Haiku 540 541 virtual status_t Perform(perform_code code, void* data); 542 543 virtual void DrawAfterChildren(BRect updateRect); 544 545 // layout related 546 547 virtual BSize MinSize(); 548 virtual BSize MaxSize(); 549 virtual BSize PreferredSize(); 550 virtual BAlignment LayoutAlignment(); 551 552 void SetExplicitMinSize(BSize size); 553 void SetExplicitMaxSize(BSize size); 554 void SetExplicitPreferredSize(BSize size); 555 void SetExplicitSize(BSize size); 556 void SetExplicitAlignment(BAlignment alignment); 557 558 BSize ExplicitMinSize() const; 559 BSize ExplicitMaxSize() const; 560 BSize ExplicitPreferredSize() const; 561 BAlignment ExplicitAlignment() const; 562 563 virtual bool HasHeightForWidth(); 564 virtual void GetHeightForWidth(float width, float* min, 565 float* max, float* preferred); 566 567 void InvalidateLayout(bool descendants = false); 568 virtual void SetLayout(BLayout* layout); 569 BLayout* GetLayout() const; 570 571 void EnableLayoutInvalidation(); 572 void DisableLayoutInvalidation(); 573 bool IsLayoutInvalidationDisabled(); 574 bool IsLayoutValid() const; 575 void ResetLayoutInvalidation(); 576 577 BLayoutContext* LayoutContext() const; 578 579 void Layout(bool force); 580 void Relayout(); 581 582 class Private; 583 584 protected: 585 virtual void LayoutInvalidated(bool descendants = false); 586 virtual void DoLayout(); 587 588 public: 589 // tool tip support 590 591 void SetToolTip(const char* text); 592 void SetToolTip(BToolTip* tip); 593 BToolTip* ToolTip() const; 594 595 void ShowToolTip(BToolTip* tip = NULL); 596 void HideToolTip(); 597 598 protected: 599 virtual bool GetToolTipAt(BPoint point, BToolTip** _tip); 600 601 virtual void LayoutChanged(); 602 603 void ScrollWithMouseWheelDelta(BScrollBar*, float); 604 605 private: 606 void _Layout(bool force, BLayoutContext* context); 607 void _LayoutLeft(BLayout* deleted); 608 void _InvalidateParentLayout(); 609 610 private: 611 // FBC padding and forbidden methods 612 virtual void _ReservedView13(); 613 virtual void _ReservedView14(); 614 virtual void _ReservedView15(); 615 virtual void _ReservedView16(); 616 617 BView(const BView&); 618 BView& operator=(const BView&); 619 620 private: 621 struct LayoutData; 622 623 friend class Private; 624 friend class BBitmap; 625 friend class BLayout; 626 friend class BPrintJob; 627 friend class BScrollBar; 628 friend class BShelf; 629 friend class BTabView; 630 friend class BWindow; 631 632 void _InitData(BRect frame, const char* name, 633 uint32 resizeMask, uint32 flags); 634 status_t _SetViewBitmap(const BBitmap* bitmap, 635 BRect srcRect, BRect dstRect, 636 uint32 followFlags, uint32 options); 637 void _ClipToPicture(BPicture* picture, BPoint where, 638 bool invert, bool sync); 639 640 bool _CheckOwnerLockAndSwitchCurrent() const; 641 bool _CheckOwnerLock() const; 642 void _CheckLockAndSwitchCurrent() const; 643 void _CheckLock() const; 644 void _SwitchServerCurrentView() const; 645 646 void _SetOwner(BWindow* newOwner); 647 void _RemoveCommArray(); 648 649 BShelf* _Shelf() const; 650 void _SetShelf(BShelf* shelf); 651 652 void _MoveTo(int32 x, int32 y); 653 void _ResizeBy(int32 deltaWidth, int32 deltaHeight); 654 void _ParentResizedBy(int32 deltaWidth, 655 int32 deltaHeight); 656 657 void _ConvertToScreen(BPoint* pt, 658 bool checkLock) const; 659 void _ConvertFromScreen(BPoint* pt, 660 bool checkLock) const; 661 662 void _ConvertToParent(BPoint* pt, 663 bool checkLock) const; 664 void _ConvertFromParent(BPoint* pt, 665 bool checkLock) const; 666 667 void _Activate(bool state); 668 void _Attach(); 669 void _Detach(); 670 void _Draw(BRect screenUpdateRect); 671 void _DrawAfterChildren(BRect screenUpdateRect); 672 void _Pulse(); 673 674 void _UpdateStateForRemove(); 675 void _UpdatePattern(::pattern pattern); 676 677 void _FlushIfNotInTransaction(); 678 679 bool _CreateSelf(); 680 bool _AddChildToList(BView* child, 681 BView* before = NULL); 682 bool _RemoveChildFromList(BView* child); 683 684 bool _AddChild(BView *child, BView *before); 685 bool _RemoveSelf(); 686 687 // Debugging methods 688 void _PrintToStream(); 689 void _PrintTree(); 690 691 int32 _unused_int1; 692 693 uint32 fFlags; 694 BPoint fParentOffset; 695 BWindow* fOwner; 696 BView* fParent; 697 BView* fNextSibling; 698 BView* fPreviousSibling; 699 BView* fFirstChild; 700 701 int16 fShowLevel; 702 bool fTopLevelView; 703 bool fNoISInteraction; 704 BPicture* fCurrentPicture; 705 _array_data_* fCommArray; 706 707 BScrollBar* fVerScroller; 708 BScrollBar* fHorScroller; 709 bool fIsPrinting; 710 bool fAttached; 711 bool _unused_bool1; 712 bool _unused_bool2; 713 ::BPrivate::ViewState* fState; 714 BRect fBounds; 715 BShelf* fShelf; 716 uint32 fEventMask; 717 uint32 fEventOptions; 718 uint32 fMouseEventOptions; 719 720 LayoutData* fLayoutData; 721 BToolTip* fToolTip; 722 723 uint32 _reserved[6]; 724 }; 725 726 727 // #pragma mark - inline definitions 728 729 730 inline void 731 BView::ScrollTo(float x, float y) 732 { 733 ScrollTo(BPoint(x, y)); 734 } 735 736 737 inline void 738 BView::SetViewColor(uchar red, uchar green, uchar blue, uchar alpha) 739 { 740 rgb_color color; 741 color.red = red; 742 color.green = green; 743 color.blue = blue; 744 color.alpha = alpha; 745 SetViewColor(color); 746 } 747 748 749 inline void 750 BView::SetHighColor(uchar red, uchar green, uchar blue, uchar alpha) 751 { 752 rgb_color color; 753 color.red = red; 754 color.green = green; 755 color.blue = blue; 756 color.alpha = alpha; 757 SetHighColor(color); 758 } 759 760 761 inline void 762 BView::SetLowColor(uchar red, uchar green, uchar blue, uchar alpha) 763 { 764 rgb_color color; 765 color.red = red; 766 color.green = green; 767 color.blue = blue; 768 color.alpha = alpha; 769 SetLowColor(color); 770 } 771 772 773 #endif // _VIEW_H 774