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 <BeBuild.h> 11 #include <Font.h> 12 #include <Handler.h> 13 #include <InterfaceDefs.h> 14 #include <Rect.h> 15 #include <Size.h> 16 #include <Gradient.h> 17 18 19 // mouse button 20 enum { 21 B_PRIMARY_MOUSE_BUTTON = 0x01, 22 B_SECONDARY_MOUSE_BUTTON = 0x02, 23 B_TERTIARY_MOUSE_BUTTON = 0x04 24 }; 25 26 // mouse transit 27 enum { 28 B_ENTERED_VIEW = 0, 29 B_INSIDE_VIEW, 30 B_EXITED_VIEW, 31 B_OUTSIDE_VIEW 32 }; 33 34 // event mask 35 enum { 36 B_POINTER_EVENTS = 0x00000001, 37 B_KEYBOARD_EVENTS = 0x00000002 38 }; 39 40 // event mask options 41 enum { 42 B_LOCK_WINDOW_FOCUS = 0x00000001, 43 B_SUSPEND_VIEW_FOCUS = 0x00000002, 44 B_NO_POINTER_HISTORY = 0x00000004, 45 // NOTE: New in Haiku (unless this flag is 46 // specified, both BWindow and BView::GetMouse() 47 // will filter out older mouse moved messages) 48 B_FULL_POINTER_HISTORY = 0x00000008 49 }; 50 51 enum { 52 B_TRACK_WHOLE_RECT, 53 B_TRACK_RECT_CORNER 54 }; 55 56 // set font mask 57 enum { 58 B_FONT_FAMILY_AND_STYLE = 0x00000001, 59 B_FONT_SIZE = 0x00000002, 60 B_FONT_SHEAR = 0x00000004, 61 B_FONT_ROTATION = 0x00000008, 62 B_FONT_SPACING = 0x00000010, 63 B_FONT_ENCODING = 0x00000020, 64 B_FONT_FACE = 0x00000040, 65 B_FONT_FLAGS = 0x00000080, 66 B_FONT_FALSE_BOLD_WIDTH = 0x00000100, 67 B_FONT_ALL = 0x000001FF 68 }; 69 70 // view flags 71 const uint32 B_FULL_UPDATE_ON_RESIZE = 0x80000000UL; /* 31 */ 72 const uint32 _B_RESERVED1_ = 0x40000000UL; /* 30 */ 73 const uint32 B_WILL_DRAW = 0x20000000UL; /* 29 */ 74 const uint32 B_PULSE_NEEDED = 0x10000000UL; /* 28 */ 75 const uint32 B_NAVIGABLE_JUMP = 0x08000000UL; /* 27 */ 76 const uint32 B_FRAME_EVENTS = 0x04000000UL; /* 26 */ 77 const uint32 B_NAVIGABLE = 0x02000000UL; /* 25 */ 78 const uint32 B_SUBPIXEL_PRECISE = 0x01000000UL; /* 24 */ 79 const uint32 B_DRAW_ON_CHILDREN = 0x00800000UL; /* 23 */ 80 const uint32 B_INPUT_METHOD_AWARE = 0x00400000UL; /* 23 */ 81 const uint32 _B_RESERVED7_ = 0x00200000UL; /* 22 */ 82 const uint32 B_SUPPORTS_LAYOUT = 0x00100000UL; /* 21 */ 83 const uint32 B_INVALIDATE_AFTER_LAYOUT = 0x00080000UL; /* 20 */ 84 85 #define _RESIZE_MASK_ (0xffff) 86 87 const uint32 _VIEW_TOP_ = 1UL; 88 const uint32 _VIEW_LEFT_ = 2UL; 89 const uint32 _VIEW_BOTTOM_ = 3UL; 90 const uint32 _VIEW_RIGHT_ = 4UL; 91 const uint32 _VIEW_CENTER_ = 5UL; 92 93 inline uint32 _rule_(uint32 r1, uint32 r2, uint32 r3, uint32 r4) 94 { return ((r1 << 12) | (r2 << 8) | (r3 << 4) | r4); } 95 96 #define B_FOLLOW_NONE 0 97 #define B_FOLLOW_ALL_SIDES _rule_(_VIEW_TOP_, _VIEW_LEFT_, _VIEW_BOTTOM_, \ 98 _VIEW_RIGHT_) 99 #define B_FOLLOW_ALL B_FOLLOW_ALL_SIDES 100 101 #define B_FOLLOW_LEFT _rule_(0, _VIEW_LEFT_, 0, _VIEW_LEFT_) 102 #define B_FOLLOW_RIGHT _rule_(0, _VIEW_RIGHT_, 0, _VIEW_RIGHT_) 103 #define B_FOLLOW_LEFT_RIGHT _rule_(0, _VIEW_LEFT_, 0, _VIEW_RIGHT_) 104 #define B_FOLLOW_H_CENTER _rule_(0, _VIEW_CENTER_, 0, _VIEW_CENTER_) 105 106 #define B_FOLLOW_TOP _rule_(_VIEW_TOP_, 0, _VIEW_TOP_, 0) 107 #define B_FOLLOW_BOTTOM _rule_(_VIEW_BOTTOM_, 0, _VIEW_BOTTOM_, 0) 108 #define B_FOLLOW_TOP_BOTTOM _rule_(_VIEW_TOP_, 0, _VIEW_BOTTOM_, 0) 109 #define B_FOLLOW_V_CENTER _rule_(_VIEW_CENTER_, 0, _VIEW_CENTER_, 0) 110 111 class BBitmap; 112 class BCursor; 113 class BLayout; 114 class BLayoutContext; 115 class BLayoutItem; 116 class BMessage; 117 class BPicture; 118 class BPolygon; 119 class BRegion; 120 class BScrollBar; 121 class BScrollView; 122 class BShape; 123 class BShelf; 124 class BString; 125 class BToolTip; 126 class BWindow; 127 struct _array_data_; 128 struct _array_hdr_; 129 struct overlay_restrictions; 130 131 namespace BPrivate { 132 class ViewState; 133 }; 134 135 136 class BView : public BHandler { 137 public: 138 BView(const char* name, uint32 flags, 139 BLayout* layout = NULL); 140 BView(BRect frame, const char* name, 141 uint32 resizeMask, uint32 flags); 142 virtual ~BView(); 143 144 BView(BMessage* archive); 145 static BArchivable* Instantiate(BMessage* archive); 146 virtual status_t Archive(BMessage* archive, 147 bool deep = true) 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* pt) const; 200 BPoint ConvertToScreen(BPoint pt) const; 201 void ConvertFromScreen(BPoint* pt) const; 202 BPoint ConvertFromScreen(BPoint pt) const; 203 void ConvertToScreen(BRect* r) const; 204 BRect ConvertToScreen(BRect r) const; 205 void ConvertFromScreen(BRect* r) const; 206 BRect ConvertFromScreen(BRect r) const; 207 void ConvertToParent(BPoint* pt) const; 208 BPoint ConvertToParent(BPoint pt) const; 209 void ConvertFromParent(BPoint* pt) const; 210 BPoint ConvertFromParent(BPoint pt) const; 211 void ConvertToParent(BRect* r) const; 212 BRect ConvertToParent(BRect r) const; 213 void ConvertFromParent(BRect* r) const; 214 BRect ConvertFromParent(BRect r) 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 c); 239 void SetViewColor(uchar r, uchar g, uchar b, 240 uchar a = 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 a_color); 268 void SetHighColor(uchar r, uchar g, uchar b, 269 uchar a = 255); 270 rgb_color HighColor() const; 271 272 virtual void SetLowColor(rgb_color a_color); 273 void SetLowColor(uchar r, uchar g, uchar b, 274 uchar a = 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 toPt, 296 pattern p = B_SOLID_HIGH); 297 void StrokeLine(BPoint a, BPoint b, 298 pattern p = B_SOLID_HIGH); 299 void BeginLineArray(int32 count); 300 void AddLine(BPoint a, BPoint b, rgb_color color); 301 void EndLineArray(); 302 303 void StrokePolygon(const BPolygon* polygon, 304 bool closed = true, 305 pattern p = B_SOLID_HIGH); 306 void StrokePolygon(const BPoint* ptArray, 307 int32 numPts, bool closed = true, 308 pattern p = B_SOLID_HIGH); 309 void StrokePolygon(const BPoint* ptArray, 310 int32 numPts, BRect bounds, 311 bool closed = true, 312 pattern p = B_SOLID_HIGH); 313 void FillPolygon(const BPolygon* polygon, 314 pattern p = B_SOLID_HIGH); 315 void FillPolygon(const BPoint* ptArray, 316 int32 numPts, pattern p = B_SOLID_HIGH); 317 void FillPolygon(const BPoint* ptArray, 318 int32 numPts, BRect bounds, 319 pattern p = B_SOLID_HIGH); 320 void FillPolygon(const BPolygon* polygon, 321 const BGradient& gradient); 322 void FillPolygon(const BPoint* ptArray, 323 int32 numPts, const BGradient& gradient); 324 void FillPolygon(const BPoint* ptArray, 325 int32 numPts, BRect bounds, 326 const BGradient& gradient); 327 328 void StrokeTriangle(BPoint pt1, BPoint pt2, 329 BPoint pt3, BRect bounds, 330 pattern p = B_SOLID_HIGH); 331 void StrokeTriangle(BPoint pt1, BPoint pt2, 332 BPoint pt3, pattern p = B_SOLID_HIGH); 333 void FillTriangle(BPoint pt1, BPoint pt2, 334 BPoint pt3, pattern p = B_SOLID_HIGH); 335 void FillTriangle(BPoint pt1, BPoint pt2, 336 BPoint pt3, BRect bounds, 337 pattern p = B_SOLID_HIGH); 338 void FillTriangle(BPoint pt1, BPoint pt2, 339 BPoint pt3, const BGradient& gradient); 340 void FillTriangle(BPoint pt1, BPoint pt2, 341 BPoint pt3, BRect bounds, 342 const BGradient& gradient); 343 344 void StrokeRect(BRect r, pattern p = B_SOLID_HIGH); 345 void FillRect(BRect r, pattern p = B_SOLID_HIGH); 346 void FillRect(BRect r, const BGradient& gradient); 347 void FillRegion(BRegion* region, 348 pattern p = B_SOLID_HIGH); 349 void FillRegion(BRegion* region, 350 const BGradient& gradient); 351 void InvertRect(BRect r); 352 353 void StrokeRoundRect(BRect r, float xRadius, 354 float yRadius, pattern p = B_SOLID_HIGH); 355 void FillRoundRect(BRect r, float xRadius, 356 float yRadius, pattern p = B_SOLID_HIGH); 357 void FillRoundRect(BRect r, float xRadius, 358 float yRadius, const BGradient& gradient); 359 360 void StrokeEllipse(BPoint center, float xRadius, 361 float yRadius, pattern p = B_SOLID_HIGH); 362 void StrokeEllipse(BRect r, 363 pattern p = B_SOLID_HIGH); 364 void FillEllipse(BPoint center, float xRadius, 365 float yRadius, pattern p = B_SOLID_HIGH); 366 void FillEllipse(BRect r, pattern p = B_SOLID_HIGH); 367 void FillEllipse(BPoint center, float xRadius, 368 float yRadius, const BGradient& gradient); 369 void FillEllipse(BRect r, 370 const BGradient& gradient); 371 372 void StrokeArc(BPoint center, float xRadius, 373 float yRadius, float startAngle, 374 float arcAngle, pattern p = B_SOLID_HIGH); 375 void StrokeArc(BRect r, float startAngle, 376 float arcAngle, pattern p = B_SOLID_HIGH); 377 void FillArc(BPoint center, float xRadius, 378 float yRadius, float startAngle, 379 float arcAngle, pattern p = B_SOLID_HIGH); 380 void FillArc(BRect r, float startAngle, 381 float arcAngle, pattern p = B_SOLID_HIGH); 382 void FillArc(BPoint center, float xRadius, 383 float yRadius, float startAngle, 384 float arcAngle, const BGradient& gradient); 385 void FillArc(BRect r, float startAngle, 386 float arcAngle, const BGradient& gradient); 387 388 void StrokeBezier(BPoint* controlPoints, 389 pattern p = B_SOLID_HIGH); 390 void FillBezier(BPoint* controlPoints, 391 pattern p = B_SOLID_HIGH); 392 void FillBezier(BPoint* controlPoints, 393 const BGradient& gradient); 394 395 void StrokeShape(BShape* shape, 396 pattern p = B_SOLID_HIGH); 397 void FillShape(BShape* shape, 398 pattern p = B_SOLID_HIGH); 399 void FillShape(BShape* shape, 400 const BGradient& gradient); 401 402 void CopyBits(BRect src, BRect dst); 403 404 void DrawBitmapAsync(const BBitmap* aBitmap, 405 BRect bitmapRect, BRect viewRect, 406 uint32 options); 407 void DrawBitmapAsync(const BBitmap* aBitmap, 408 BRect bitmapRect, BRect viewRect); 409 void DrawBitmapAsync(const BBitmap* aBitmap, 410 BRect viewRect); 411 void DrawBitmapAsync(const BBitmap* aBitmap, 412 BPoint where); 413 void DrawBitmapAsync(const BBitmap* aBitmap); 414 415 void DrawBitmap(const BBitmap* aBitmap, 416 BRect bitmapRect, BRect viewRect, 417 uint32 options); 418 void DrawBitmap(const BBitmap* aBitmap, 419 BRect bitmapRect, BRect viewRect); 420 void DrawBitmap(const BBitmap* aBitmap, 421 BRect viewRect); 422 void DrawBitmap(const BBitmap* aBitmap, 423 BPoint where); 424 void DrawBitmap(const BBitmap* aBitmap); 425 426 void DrawChar(char aChar); 427 void DrawChar(char aChar, BPoint location); 428 void DrawString(const char* aString, 429 escapement_delta* delta = NULL); 430 void DrawString(const char* aString, 431 BPoint location, 432 escapement_delta* delta = NULL); 433 void DrawString(const char* aString, int32 length, 434 escapement_delta* delta = NULL); 435 void DrawString(const char* aString, int32 length, 436 BPoint location, 437 escapement_delta* delta = 0L); 438 439 virtual void SetFont(const BFont* font, 440 uint32 mask = B_FONT_ALL); 441 442 void GetFont(BFont* font) const; 443 void TruncateString(BString* in_out, uint32 mode, 444 float width) const; 445 float StringWidth(const char* string) const; 446 float StringWidth(const char* string, 447 int32 length) const; 448 void GetStringWidths(char* stringArray[], 449 int32 lengthArray[], int32 numStrings, 450 float widthArray[]) const; 451 void SetFontSize(float size); 452 void ForceFontAliasing(bool enable); 453 void GetFontHeight(font_height* height) const; 454 455 void Invalidate(BRect invalRect); 456 void Invalidate(const BRegion* invalRegion); 457 void Invalidate(); 458 459 void SetDiskMode(char* filename, long offset); 460 461 void BeginPicture(BPicture* a_picture); 462 void AppendToPicture(BPicture* a_picture); 463 BPicture* EndPicture(); 464 465 void DrawPicture(const BPicture* a_picture); 466 void DrawPicture(const BPicture* a_picture, 467 BPoint where); 468 void DrawPicture(const char* filename, long offset, 469 BPoint where); 470 void DrawPictureAsync(const BPicture* a_picture); 471 void DrawPictureAsync(const BPicture* a_picture, 472 BPoint where); 473 void DrawPictureAsync(const char* filename, 474 long offset, BPoint where); 475 476 status_t SetEventMask(uint32 mask, uint32 options = 0); 477 uint32 EventMask(); 478 status_t SetMouseEventMask(uint32 mask, 479 uint32 options = 0); 480 481 virtual void SetFlags(uint32 flags); 482 uint32 Flags() const; 483 virtual void SetResizingMode(uint32 mode); 484 uint32 ResizingMode() const; 485 void MoveBy(float dh, float dv); 486 void MoveTo(BPoint where); 487 void MoveTo(float x, float y); 488 void ResizeBy(float dh, float dv); 489 void ResizeTo(float width, float height); 490 void ResizeTo(BSize size); 491 void ScrollBy(float dh, float dv); 492 void ScrollTo(float x, float y); 493 virtual void ScrollTo(BPoint where); 494 virtual void MakeFocus(bool focusState = true); 495 bool IsFocus() const; 496 497 virtual void Show(); 498 virtual void Hide(); 499 bool IsHidden() const; 500 bool IsHidden(const BView* looking_from) const; 501 502 void Flush() const; 503 void Sync() const; 504 505 virtual void GetPreferredSize(float* width, float* height); 506 virtual void ResizeToPreferred(); 507 508 BScrollBar* ScrollBar(orientation posture) const; 509 510 virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index, 511 BMessage* specifier, int32 form, 512 const char* property); 513 virtual status_t GetSupportedSuites(BMessage* data); 514 515 bool IsPrinting() const; 516 void SetScale(float scale) const; 517 float Scale() const; 518 // new for Haiku 519 520 virtual status_t Perform(perform_code code, void* data); 521 522 virtual void DrawAfterChildren(BRect r); 523 524 // layout related 525 526 virtual BSize MinSize(); 527 virtual BSize MaxSize(); 528 virtual BSize PreferredSize(); 529 virtual BAlignment LayoutAlignment(); 530 531 void SetExplicitMinSize(BSize size); 532 void SetExplicitMaxSize(BSize size); 533 void SetExplicitPreferredSize(BSize size); 534 void SetExplicitAlignment(BAlignment alignment); 535 536 BSize ExplicitMinSize() const; 537 BSize ExplicitMaxSize() const; 538 BSize ExplicitPreferredSize() const; 539 BAlignment ExplicitAlignment() const; 540 541 virtual bool HasHeightForWidth(); 542 virtual void GetHeightForWidth(float width, float* min, 543 float* max, float* preferred); 544 545 virtual void SetLayout(BLayout* layout); 546 BLayout* GetLayout() const; 547 548 virtual void InvalidateLayout(bool descendants = false); 549 void EnableLayoutInvalidation(); 550 void DisableLayoutInvalidation(); 551 bool IsLayoutValid() const; 552 void ResetLayoutInvalidation(); 553 554 BLayoutContext* LayoutContext() const; 555 556 void Layout(bool force); 557 void Relayout(); 558 559 protected: 560 virtual void DoLayout(); 561 562 public: 563 // tool tip support 564 565 void SetToolTip(const char* text); 566 void SetToolTip(BToolTip* tip); 567 BToolTip* ToolTip() const; 568 569 void ShowToolTip(BToolTip* tip = NULL); 570 void HideToolTip(); 571 572 protected: 573 virtual bool GetToolTipAt(BPoint point, BToolTip** _tip); 574 575 private: 576 void _Layout(bool force, BLayoutContext* context); 577 578 private: 579 // FBC padding and forbidden methods 580 virtual void _ReservedView12(); 581 virtual void _ReservedView13(); 582 virtual void _ReservedView14(); 583 virtual void _ReservedView15(); 584 virtual void _ReservedView16(); 585 586 BView(const BView&); 587 BView& operator=(const BView&); 588 589 private: 590 struct LayoutData; 591 592 friend class BBitmap; 593 friend class BLayout; 594 friend class BPrintJob; 595 friend class BScrollBar; 596 friend class BShelf; 597 friend class BTabView; 598 friend class BWindow; 599 600 void _InitData(BRect frame, const char* name, 601 uint32 resizeMask, uint32 flags); 602 status_t _SetViewBitmap(const BBitmap* bitmap, 603 BRect srcRect, BRect dstRect, 604 uint32 followFlags, uint32 options); 605 void _ClipToPicture(BPicture* picture, BPoint where, 606 bool invert, bool sync); 607 608 bool _CheckOwnerLockAndSwitchCurrent() const; 609 bool _CheckOwnerLock() const; 610 void _CheckLockAndSwitchCurrent() const; 611 void _CheckLock() const; 612 void _SwitchServerCurrentView() const; 613 614 void _SetOwner(BWindow* newOwner); 615 void _RemoveCommArray(); 616 617 BShelf* _Shelf() const; 618 void _SetShelf(BShelf* shelf); 619 620 void _MoveTo(int32 x, int32 y); 621 void _ResizeBy(int32 deltaWidth, int32 deltaHeight); 622 void _ParentResizedBy(int32 deltaWidth, 623 int32 deltaHeight); 624 625 void _ConvertToScreen(BPoint* pt, 626 bool checkLock) const; 627 void _ConvertFromScreen(BPoint* pt, 628 bool checkLock) const; 629 630 void _ConvertToParent(BPoint* pt, 631 bool checkLock) const; 632 void _ConvertFromParent(BPoint* pt, 633 bool checkLock) const; 634 635 void _Activate(bool state); 636 void _Attach(); 637 void _Detach(); 638 void _Draw(BRect screenUpdateRect); 639 void _DrawAfterChildren(BRect screenUpdateRect); 640 void _Pulse(); 641 642 void _UpdateStateForRemove(); 643 void _UpdatePattern(::pattern pattern); 644 645 void _FlushIfNotInTransaction(); 646 647 bool _CreateSelf(); 648 bool _AddChildToList(BView* child, 649 BView* before = NULL); 650 bool _RemoveChildFromList(BView* child); 651 652 bool _AddChild(BView *child, BView *before); 653 bool _RemoveSelf(); 654 655 // Debugging methods 656 void _PrintToStream(); 657 void _PrintTree(); 658 659 int32 _unused_int1; 660 661 uint32 fFlags; 662 BPoint fParentOffset; 663 BWindow* fOwner; 664 BView* fParent; 665 BView* fNextSibling; 666 BView* fPreviousSibling; 667 BView* fFirstChild; 668 669 int16 fShowLevel; 670 bool fTopLevelView; 671 bool fNoISInteraction; 672 BPicture* fCurrentPicture; 673 _array_data_* fCommArray; 674 675 BScrollBar* fVerScroller; 676 BScrollBar* fHorScroller; 677 bool fIsPrinting; 678 bool fAttached; 679 bool _unused_bool1; 680 bool _unused_bool2; 681 BPrivate::ViewState* fState; 682 BRect fBounds; 683 BShelf* fShelf; 684 uint32 fEventMask; 685 uint32 fEventOptions; 686 uint32 fMouseEventOptions; 687 688 LayoutData* fLayoutData; 689 BToolTip* fToolTip; 690 BToolTip* fVisibleToolTip; 691 692 uint32 _reserved[5]; 693 }; 694 695 696 // #pragma mark - inline definitions 697 698 699 inline void 700 BView::ScrollTo(float x, float y) 701 { 702 ScrollTo(BPoint(x, y)); 703 } 704 705 706 inline void 707 BView::SetViewColor(uchar r, uchar g, uchar b, uchar a) 708 { 709 rgb_color color; 710 color.red = r; 711 color.green = g; 712 color.blue = b; 713 color.alpha = a; 714 SetViewColor(color); 715 } 716 717 718 inline void 719 BView::SetHighColor(uchar r, uchar g, uchar b, uchar a) 720 { 721 rgb_color color; 722 color.red = r; 723 color.green = g; 724 color.blue = b; 725 color.alpha = a; 726 SetHighColor(color); 727 } 728 729 730 inline void 731 BView::SetLowColor(uchar r, uchar g, uchar b, uchar a) 732 { 733 rgb_color color; 734 color.red = r; 735 color.green = g; 736 color.blue = b; 737 color.alpha = a; 738 SetLowColor(color); 739 } 740 741 #endif // _VIEW_H 742