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