1 /* 2 * Copyright 2001-2009, 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 147 virtual void AttachedToWindow(); 148 virtual void AllAttached(); 149 virtual void DetachedFromWindow(); 150 virtual void AllDetached(); 151 152 virtual void MessageReceived(BMessage* message); 153 154 void AddChild(BView* child, BView* before = NULL); 155 bool AddChild(BLayoutItem* child); 156 bool RemoveChild(BView* child); 157 int32 CountChildren() const; 158 BView* ChildAt(int32 index) const; 159 BView* NextSibling() const; 160 BView* PreviousSibling() const; 161 bool RemoveSelf(); 162 163 BWindow* Window() const; 164 165 virtual void Draw(BRect updateRect); 166 virtual void MouseDown(BPoint where); 167 virtual void MouseUp(BPoint where); 168 virtual void MouseMoved(BPoint where, uint32 code, 169 const BMessage* dragMessage); 170 virtual void WindowActivated(bool state); 171 virtual void KeyDown(const char* bytes, int32 numBytes); 172 virtual void KeyUp(const char* bytes, int32 numBytes); 173 virtual void Pulse(); 174 virtual void FrameMoved(BPoint newPosition); 175 virtual void FrameResized(float newWidth, float newHeight); 176 177 virtual void TargetedByScrollView(BScrollView* scrollView); 178 void BeginRectTracking(BRect startRect, 179 uint32 style = B_TRACK_WHOLE_RECT); 180 void EndRectTracking(); 181 182 void GetMouse(BPoint* location, uint32* buttons, 183 bool checkMessageQueue = true); 184 185 void DragMessage(BMessage* message, BRect dragRect, 186 BHandler* replyTo = NULL); 187 void DragMessage(BMessage* message, BBitmap* bitmap, 188 BPoint offset, BHandler* replyTo = NULL); 189 void DragMessage(BMessage* message, BBitmap* bitmap, 190 drawing_mode dragMode, BPoint offset, 191 BHandler* replyTo = NULL); 192 193 BView* FindView(const char* name) const; 194 BView* Parent() const; 195 BRect Bounds() const; 196 BRect Frame() const; 197 void ConvertToScreen(BPoint* pt) const; 198 BPoint ConvertToScreen(BPoint pt) const; 199 void ConvertFromScreen(BPoint* pt) const; 200 BPoint ConvertFromScreen(BPoint pt) const; 201 void ConvertToScreen(BRect* r) const; 202 BRect ConvertToScreen(BRect r) const; 203 void ConvertFromScreen(BRect* r) const; 204 BRect ConvertFromScreen(BRect r) const; 205 void ConvertToParent(BPoint* pt) const; 206 BPoint ConvertToParent(BPoint pt) const; 207 void ConvertFromParent(BPoint* pt) const; 208 BPoint ConvertFromParent(BPoint pt) const; 209 void ConvertToParent(BRect* r) const; 210 BRect ConvertToParent(BRect r) const; 211 void ConvertFromParent(BRect* r) const; 212 BRect ConvertFromParent(BRect r) const; 213 BPoint LeftTop() const; 214 215 void GetClippingRegion(BRegion* region) const; 216 virtual void ConstrainClippingRegion(BRegion* region); 217 void ClipToPicture(BPicture* picture, 218 BPoint where = B_ORIGIN, bool sync = true); 219 void ClipToInversePicture(BPicture* picture, 220 BPoint where = B_ORIGIN, bool sync = true); 221 222 virtual void SetDrawingMode(drawing_mode mode); 223 drawing_mode DrawingMode() const; 224 225 void SetBlendingMode(source_alpha srcAlpha, 226 alpha_function alphaFunc); 227 void GetBlendingMode(source_alpha* srcAlpha, 228 alpha_function* alphaFunc) const; 229 230 virtual void SetPenSize(float size); 231 float PenSize() const; 232 233 void SetViewCursor(const BCursor* cursor, 234 bool sync = true); 235 236 virtual void SetViewColor(rgb_color c); 237 void SetViewColor(uchar r, uchar g, uchar b, 238 uchar a = 255); 239 rgb_color ViewColor() const; 240 241 void SetViewBitmap(const BBitmap* bitmap, 242 BRect srcRect, BRect dstRect, 243 uint32 followFlags 244 = B_FOLLOW_TOP | B_FOLLOW_LEFT, 245 uint32 options = B_TILE_BITMAP); 246 void SetViewBitmap(const BBitmap* bitmap, 247 uint32 followFlags 248 = B_FOLLOW_TOP | B_FOLLOW_LEFT, 249 uint32 options = B_TILE_BITMAP); 250 void ClearViewBitmap(); 251 252 status_t SetViewOverlay(const BBitmap* overlay, 253 BRect srcRect, BRect dstRect, 254 rgb_color* colorKey, 255 uint32 followFlags 256 = B_FOLLOW_TOP | B_FOLLOW_LEFT, 257 uint32 options = 0); 258 status_t SetViewOverlay(const BBitmap* overlay, 259 rgb_color* colorKey, 260 uint32 followFlags 261 = B_FOLLOW_TOP | B_FOLLOW_LEFT, 262 uint32 options = 0); 263 void ClearViewOverlay(); 264 265 virtual void SetHighColor(rgb_color a_color); 266 void SetHighColor(uchar r, uchar g, uchar b, 267 uchar a = 255); 268 rgb_color HighColor() const; 269 270 virtual void SetLowColor(rgb_color a_color); 271 void SetLowColor(uchar r, uchar g, uchar b, 272 uchar a = 255); 273 rgb_color LowColor() const; 274 275 void SetLineMode(cap_mode lineCap, 276 join_mode lineJoin, 277 float miterLimit = B_DEFAULT_MITER_LIMIT); 278 join_mode LineJoinMode() const; 279 cap_mode LineCapMode() const; 280 float LineMiterLimit() const; 281 282 void SetOrigin(BPoint pt); 283 void SetOrigin(float x, float y); 284 BPoint Origin() const; 285 286 void PushState(); 287 void PopState(); 288 289 void MovePenTo(BPoint pt); 290 void MovePenTo(float x, float y); 291 void MovePenBy(float x, float y); 292 BPoint PenLocation() const; 293 void StrokeLine(BPoint toPt, 294 pattern p = B_SOLID_HIGH); 295 void StrokeLine(BPoint a, BPoint b, 296 pattern p = B_SOLID_HIGH); 297 void BeginLineArray(int32 count); 298 void AddLine(BPoint a, BPoint b, rgb_color color); 299 void EndLineArray(); 300 301 void StrokePolygon(const BPolygon* polygon, 302 bool closed = true, 303 pattern p = B_SOLID_HIGH); 304 void StrokePolygon(const BPoint* ptArray, 305 int32 numPts, bool closed = true, 306 pattern p = B_SOLID_HIGH); 307 void StrokePolygon(const BPoint* ptArray, 308 int32 numPts, BRect bounds, 309 bool closed = true, 310 pattern p = B_SOLID_HIGH); 311 void FillPolygon(const BPolygon* polygon, 312 pattern p = B_SOLID_HIGH); 313 void FillPolygon(const BPoint* ptArray, 314 int32 numPts, pattern p = B_SOLID_HIGH); 315 void FillPolygon(const BPoint* ptArray, 316 int32 numPts, BRect bounds, 317 pattern p = B_SOLID_HIGH); 318 void FillPolygon(const BPolygon* polygon, 319 const BGradient& gradient); 320 void FillPolygon(const BPoint* ptArray, 321 int32 numPts, const BGradient& gradient); 322 void FillPolygon(const BPoint* ptArray, 323 int32 numPts, BRect bounds, 324 const BGradient& gradient); 325 326 void StrokeTriangle(BPoint pt1, BPoint pt2, 327 BPoint pt3, BRect bounds, 328 pattern p = B_SOLID_HIGH); 329 void StrokeTriangle(BPoint pt1, BPoint pt2, 330 BPoint pt3, pattern p = B_SOLID_HIGH); 331 void FillTriangle(BPoint pt1, BPoint pt2, 332 BPoint pt3, pattern p = B_SOLID_HIGH); 333 void FillTriangle(BPoint pt1, BPoint pt2, 334 BPoint pt3, BRect bounds, 335 pattern p = B_SOLID_HIGH); 336 void FillTriangle(BPoint pt1, BPoint pt2, 337 BPoint pt3, const BGradient& gradient); 338 void FillTriangle(BPoint pt1, BPoint pt2, 339 BPoint pt3, BRect bounds, 340 const BGradient& gradient); 341 342 void StrokeRect(BRect r, pattern p = B_SOLID_HIGH); 343 void FillRect(BRect r, pattern p = B_SOLID_HIGH); 344 void FillRect(BRect r, const BGradient& gradient); 345 void FillRegion(BRegion* region, 346 pattern p = B_SOLID_HIGH); 347 void FillRegion(BRegion* region, 348 const BGradient& gradient); 349 void InvertRect(BRect r); 350 351 void StrokeRoundRect(BRect r, float xRadius, 352 float yRadius, pattern p = B_SOLID_HIGH); 353 void FillRoundRect(BRect r, float xRadius, 354 float yRadius, pattern p = B_SOLID_HIGH); 355 void FillRoundRect(BRect r, float xRadius, 356 float yRadius, const BGradient& gradient); 357 358 void StrokeEllipse(BPoint center, float xRadius, 359 float yRadius, pattern p = B_SOLID_HIGH); 360 void StrokeEllipse(BRect r, 361 pattern p = B_SOLID_HIGH); 362 void FillEllipse(BPoint center, float xRadius, 363 float yRadius, pattern p = B_SOLID_HIGH); 364 void FillEllipse(BRect r, pattern p = B_SOLID_HIGH); 365 void FillEllipse(BPoint center, float xRadius, 366 float yRadius, const BGradient& gradient); 367 void FillEllipse(BRect r, 368 const BGradient& gradient); 369 370 void StrokeArc(BPoint center, float xRadius, 371 float yRadius, float startAngle, 372 float arcAngle, pattern p = B_SOLID_HIGH); 373 void StrokeArc(BRect r, float startAngle, 374 float arcAngle, pattern p = B_SOLID_HIGH); 375 void FillArc(BPoint center, float xRadius, 376 float yRadius, float startAngle, 377 float arcAngle, pattern p = B_SOLID_HIGH); 378 void FillArc(BRect r, float startAngle, 379 float arcAngle, pattern p = B_SOLID_HIGH); 380 void FillArc(BPoint center, float xRadius, 381 float yRadius, float startAngle, 382 float arcAngle, const BGradient& gradient); 383 void FillArc(BRect r, float startAngle, 384 float arcAngle, const BGradient& gradient); 385 386 void StrokeBezier(BPoint* controlPoints, 387 pattern p = B_SOLID_HIGH); 388 void FillBezier(BPoint* controlPoints, 389 pattern p = B_SOLID_HIGH); 390 void FillBezier(BPoint* controlPoints, 391 const BGradient& gradient); 392 393 void StrokeShape(BShape* shape, 394 pattern p = B_SOLID_HIGH); 395 void FillShape(BShape* shape, 396 pattern p = B_SOLID_HIGH); 397 void FillShape(BShape* shape, 398 const BGradient& gradient); 399 400 void CopyBits(BRect src, BRect dst); 401 402 void DrawBitmapAsync(const BBitmap* aBitmap, 403 BRect bitmapRect, BRect viewRect, 404 uint32 options); 405 void DrawBitmapAsync(const BBitmap* aBitmap, 406 BRect bitmapRect, BRect viewRect); 407 void DrawBitmapAsync(const BBitmap* aBitmap, 408 BRect viewRect); 409 void DrawBitmapAsync(const BBitmap* aBitmap, 410 BPoint where); 411 void DrawBitmapAsync(const BBitmap* aBitmap); 412 413 void DrawBitmap(const BBitmap* aBitmap, 414 BRect bitmapRect, BRect viewRect, 415 uint32 options); 416 void DrawBitmap(const BBitmap* aBitmap, 417 BRect bitmapRect, BRect viewRect); 418 void DrawBitmap(const BBitmap* aBitmap, 419 BRect viewRect); 420 void DrawBitmap(const BBitmap* aBitmap, 421 BPoint where); 422 void DrawBitmap(const BBitmap* aBitmap); 423 424 void DrawChar(char aChar); 425 void DrawChar(char aChar, BPoint location); 426 void DrawString(const char* aString, 427 escapement_delta* delta = NULL); 428 void DrawString(const char* aString, 429 BPoint location, 430 escapement_delta* delta = NULL); 431 void DrawString(const char* aString, int32 length, 432 escapement_delta* delta = NULL); 433 void DrawString(const char* aString, int32 length, 434 BPoint location, 435 escapement_delta* delta = 0L); 436 437 virtual void SetFont(const BFont* font, 438 uint32 mask = B_FONT_ALL); 439 440 void GetFont(BFont* font) const; 441 void TruncateString(BString* in_out, uint32 mode, 442 float width) const; 443 float StringWidth(const char* string) const; 444 float StringWidth(const char* string, 445 int32 length) const; 446 void GetStringWidths(char* stringArray[], 447 int32 lengthArray[], int32 numStrings, 448 float widthArray[]) const; 449 void SetFontSize(float size); 450 void ForceFontAliasing(bool enable); 451 void GetFontHeight(font_height* height) const; 452 453 void Invalidate(BRect invalRect); 454 void Invalidate(const BRegion* invalRegion); 455 void Invalidate(); 456 457 void SetDiskMode(char* filename, long offset); 458 459 void BeginPicture(BPicture* a_picture); 460 void AppendToPicture(BPicture* a_picture); 461 BPicture* EndPicture(); 462 463 void DrawPicture(const BPicture* a_picture); 464 void DrawPicture(const BPicture* a_picture, 465 BPoint where); 466 void DrawPicture(const char* filename, long offset, 467 BPoint where); 468 void DrawPictureAsync(const BPicture* a_picture); 469 void DrawPictureAsync(const BPicture* a_picture, 470 BPoint where); 471 void DrawPictureAsync(const char* filename, 472 long offset, BPoint where); 473 474 status_t SetEventMask(uint32 mask, uint32 options = 0); 475 uint32 EventMask(); 476 status_t SetMouseEventMask(uint32 mask, 477 uint32 options = 0); 478 479 virtual void SetFlags(uint32 flags); 480 uint32 Flags() const; 481 virtual void SetResizingMode(uint32 mode); 482 uint32 ResizingMode() const; 483 void MoveBy(float dh, float dv); 484 void MoveTo(BPoint where); 485 void MoveTo(float x, float y); 486 void ResizeBy(float dh, float dv); 487 void ResizeTo(float width, float height); 488 void ResizeTo(BSize size); 489 void ScrollBy(float dh, float dv); 490 void ScrollTo(float x, float y); 491 virtual void ScrollTo(BPoint where); 492 virtual void MakeFocus(bool focusState = true); 493 bool IsFocus() const; 494 495 virtual void Show(); 496 virtual void Hide(); 497 bool IsHidden() const; 498 bool IsHidden(const BView* looking_from) const; 499 500 void Flush() const; 501 void Sync() const; 502 503 virtual void GetPreferredSize(float* width, float* height); 504 virtual void ResizeToPreferred(); 505 506 BScrollBar* ScrollBar(orientation posture) const; 507 508 virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index, 509 BMessage* specifier, int32 form, 510 const char* property); 511 virtual status_t GetSupportedSuites(BMessage* data); 512 513 bool IsPrinting() const; 514 void SetScale(float scale) const; 515 float Scale() const; 516 // new for Haiku 517 518 virtual status_t Perform(perform_code code, void* data); 519 520 virtual void DrawAfterChildren(BRect r); 521 522 // layout related 523 524 virtual BSize MinSize(); 525 virtual BSize MaxSize(); 526 virtual BSize PreferredSize(); 527 virtual BAlignment LayoutAlignment(); 528 529 void SetExplicitMinSize(BSize size); 530 void SetExplicitMaxSize(BSize size); 531 void SetExplicitPreferredSize(BSize size); 532 void SetExplicitAlignment(BAlignment alignment); 533 534 BSize ExplicitMinSize() const; 535 BSize ExplicitMaxSize() const; 536 BSize ExplicitPreferredSize() const; 537 BAlignment ExplicitAlignment() const; 538 539 virtual bool HasHeightForWidth(); 540 virtual void GetHeightForWidth(float width, float* min, 541 float* max, float* preferred); 542 543 virtual void SetLayout(BLayout* layout); 544 BLayout* GetLayout() const; 545 546 virtual void InvalidateLayout(bool descendants = false); 547 void EnableLayoutInvalidation(); 548 void DisableLayoutInvalidation(); 549 bool IsLayoutValid() const; 550 void ResetLayoutInvalidation(); 551 552 BLayoutContext* LayoutContext() const; 553 554 void Layout(bool force); 555 void Relayout(); 556 557 protected: 558 virtual void DoLayout(); 559 560 public: 561 // tool tip support 562 563 void SetToolTip(const char* text); 564 void SetToolTip(BToolTip* tip); 565 BToolTip* ToolTip() const; 566 567 void ShowToolTip(BToolTip* tip = NULL); 568 void HideToolTip(); 569 570 protected: 571 virtual bool GetToolTipAt(BPoint point, BToolTip** _tip); 572 573 private: 574 void _Layout(bool force, BLayoutContext* context); 575 576 private: 577 // FBC padding and forbidden methods 578 virtual void _ReservedView12(); 579 virtual void _ReservedView13(); 580 virtual void _ReservedView14(); 581 virtual void _ReservedView15(); 582 virtual void _ReservedView16(); 583 584 BView(const BView&); 585 BView& operator=(const BView&); 586 587 private: 588 struct LayoutData; 589 590 friend class BBitmap; 591 friend class BLayout; 592 friend class BPrintJob; 593 friend class BScrollBar; 594 friend class BShelf; 595 friend class BTabView; 596 friend class BWindow; 597 598 void _InitData(BRect frame, const char* name, 599 uint32 resizeMask, uint32 flags); 600 status_t _SetViewBitmap(const BBitmap* bitmap, 601 BRect srcRect, BRect dstRect, 602 uint32 followFlags, uint32 options); 603 void _ClipToPicture(BPicture* picture, BPoint where, 604 bool invert, bool sync); 605 606 bool _CheckOwnerLockAndSwitchCurrent() const; 607 bool _CheckOwnerLock() const; 608 void _CheckLockAndSwitchCurrent() const; 609 void _CheckLock() const; 610 void _SwitchServerCurrentView() const; 611 612 void _SetOwner(BWindow* newOwner); 613 void _RemoveCommArray(); 614 615 BShelf* _Shelf() const; 616 void _SetShelf(BShelf* shelf); 617 618 void _MoveTo(int32 x, int32 y); 619 void _ResizeBy(int32 deltaWidth, int32 deltaHeight); 620 void _ParentResizedBy(int32 deltaWidth, 621 int32 deltaHeight); 622 623 void _ConvertToScreen(BPoint* pt, 624 bool checkLock) const; 625 void _ConvertFromScreen(BPoint* pt, 626 bool checkLock) const; 627 628 void _ConvertToParent(BPoint* pt, 629 bool checkLock) const; 630 void _ConvertFromParent(BPoint* pt, 631 bool checkLock) const; 632 633 void _Activate(bool state); 634 void _Attach(); 635 void _Detach(); 636 void _Draw(BRect screenUpdateRect); 637 void _DrawAfterChildren(BRect screenUpdateRect); 638 void _Pulse(); 639 640 void _UpdateStateForRemove(); 641 void _UpdatePattern(::pattern pattern); 642 643 void _FlushIfNotInTransaction(); 644 645 bool _CreateSelf(); 646 bool _AddChildToList(BView* child, 647 BView* before = NULL); 648 bool _RemoveChildFromList(BView* child); 649 650 bool _AddChild(BView *child, BView *before); 651 bool _RemoveSelf(); 652 653 // Debugging methods 654 void _PrintToStream(); 655 void _PrintTree(); 656 657 int32 _unused_int1; 658 659 uint32 fFlags; 660 BPoint fParentOffset; 661 BWindow* fOwner; 662 BView* fParent; 663 BView* fNextSibling; 664 BView* fPreviousSibling; 665 BView* fFirstChild; 666 667 int16 fShowLevel; 668 bool fTopLevelView; 669 bool fNoISInteraction; 670 BPicture* fCurrentPicture; 671 _array_data_* fCommArray; 672 673 BScrollBar* fVerScroller; 674 BScrollBar* fHorScroller; 675 bool fIsPrinting; 676 bool fAttached; 677 bool _unused_bool1; 678 bool _unused_bool2; 679 BPrivate::ViewState* fState; 680 BRect fBounds; 681 BShelf* fShelf; 682 uint32 fEventMask; 683 uint32 fEventOptions; 684 uint32 fMouseEventOptions; 685 686 LayoutData* fLayoutData; 687 BToolTip* fToolTip; 688 BToolTip* fVisibleToolTip; 689 690 uint32 _reserved[5]; 691 }; 692 693 694 // #pragma mark - inline definitions 695 696 697 inline void 698 BView::ScrollTo(float x, float y) 699 { 700 ScrollTo(BPoint(x, y)); 701 } 702 703 704 inline void 705 BView::SetViewColor(uchar r, uchar g, uchar b, uchar a) 706 { 707 rgb_color color; 708 color.red = r; 709 color.green = g; 710 color.blue = b; 711 color.alpha = a; 712 SetViewColor(color); 713 } 714 715 716 inline void 717 BView::SetHighColor(uchar r, uchar g, uchar b, uchar a) 718 { 719 rgb_color color; 720 color.red = r; 721 color.green = g; 722 color.blue = b; 723 color.alpha = a; 724 SetHighColor(color); 725 } 726 727 728 inline void 729 BView::SetLowColor(uchar r, uchar g, uchar b, uchar a) 730 { 731 rgb_color color; 732 color.red = r; 733 color.green = g; 734 color.blue = b; 735 color.alpha = a; 736 SetLowColor(color); 737 } 738 739 #endif // _VIEW_H 740