1 //------------------------------------------------------------------------------ 2 // Copyright (c) 2001-2002, OpenBeOS 3 // 4 // Permission is hereby granted, free of charge, to any person obtaining a 5 // copy of this software and associated documentation files (the "Software"), 6 // to deal in the Software without restriction, including without limitation 7 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 // and/or sell copies of the Software, and to permit persons to whom the 9 // Software is furnished to do so, subject to the following conditions: 10 // 11 // The above copyright notice and this permission notice shall be included in 12 // all copies or substantial portions of the Software. 13 // 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 // DEALINGS IN THE SOFTWARE. 21 // 22 // File Name: View.h 23 // Author: Erik Jaesler (erik@cgsoftware.com) 24 // Description: BView is the base class for all views (clipped regions 25 // within a window). 26 //------------------------------------------------------------------------------ 27 28 #ifndef _VIEW_H 29 #define _VIEW_H 30 31 // Standard Includes ----------------------------------------------------------- 32 33 // System Includes ------------------------------------------------------------- 34 #include <BeBuild.h> 35 #include <Font.h> 36 #include <Handler.h> 37 #include <InterfaceDefs.h> 38 #include <Rect.h> 39 40 // Project Includes ------------------------------------------------------------ 41 42 // Local Includes -------------------------------------------------------------- 43 44 // Local Defines --------------------------------------------------------------- 45 46 // Globals --------------------------------------------------------------------- 47 48 49 // view definitions ------------------------------------------------------------ 50 51 enum { 52 B_PRIMARY_MOUSE_BUTTON = 0x01, 53 B_SECONDARY_MOUSE_BUTTON = 0x02, 54 B_TERTIARY_MOUSE_BUTTON = 0x04 55 }; 56 57 enum { 58 B_ENTERED_VIEW = 0, 59 B_INSIDE_VIEW, 60 B_EXITED_VIEW, 61 B_OUTSIDE_VIEW 62 }; 63 64 enum { 65 B_POINTER_EVENTS = 0x00000001, 66 B_KEYBOARD_EVENTS = 0x00000002 67 }; 68 69 enum { 70 B_LOCK_WINDOW_FOCUS = 0x00000001, 71 B_SUSPEND_VIEW_FOCUS = 0x00000002, 72 B_NO_POINTER_HISTORY = 0x00000004 73 }; 74 75 enum { 76 B_TRACK_WHOLE_RECT, 77 B_TRACK_RECT_CORNER 78 }; 79 80 enum { 81 B_FONT_FAMILY_AND_STYLE = 0x00000001, 82 B_FONT_SIZE = 0x00000002, 83 B_FONT_SHEAR = 0x00000004, 84 B_FONT_ROTATION = 0x00000008, 85 B_FONT_SPACING = 0x00000010, 86 B_FONT_ENCODING = 0x00000020, 87 B_FONT_FACE = 0x00000040, 88 B_FONT_FLAGS = 0x00000080, 89 B_FONT_ALL = 0x000000FF 90 }; 91 92 const uint32 B_FULL_UPDATE_ON_RESIZE = 0x80000000UL; /* 31 */ 93 const uint32 _B_RESERVED1_ = 0x40000000UL; /* 30 */ 94 const uint32 B_WILL_DRAW = 0x20000000UL; /* 29 */ 95 const uint32 B_PULSE_NEEDED = 0x10000000UL; /* 28 */ 96 const uint32 B_NAVIGABLE_JUMP = 0x08000000UL; /* 27 */ 97 const uint32 B_FRAME_EVENTS = 0x04000000UL; /* 26 */ 98 const uint32 B_NAVIGABLE = 0x02000000UL; /* 25 */ 99 const uint32 B_SUBPIXEL_PRECISE = 0x01000000UL; /* 24 */ 100 const uint32 B_DRAW_ON_CHILDREN = 0x00800000UL; /* 23 */ 101 const uint32 B_INPUT_METHOD_AWARE = 0x00400000UL; /* 23 */ 102 const uint32 _B_RESERVED7_ = 0x00200000UL; /* 22 */ 103 /* 104 #define _RESIZE_MASK_ ~(B_FULL_UPDATE_ON_RESIZE|_B_RESERVED1_|B_WILL_DRAW|\ 105 B_PULSE_NEEDED|B_NAVIGABLE_JUMP|B_FRAME_EVENTS|B_NAVIGABLE|\ 106 B_SUBPIXEL_PRECISE|B_DRAW_ON_CHILDREN|B_INPUT_METHOD_AWARE|_B_RESERVED7_) 107 */ 108 #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_) 109 110 const uint32 _VIEW_TOP_ = 1UL; 111 const uint32 _VIEW_LEFT_ = 2UL; 112 const uint32 _VIEW_BOTTOM_ = 3UL; 113 const uint32 _VIEW_RIGHT_ = 4UL; 114 const uint32 _VIEW_CENTER_ = 5UL; 115 116 inline uint32 _rule_(uint32 r1, uint32 r2, uint32 r3, uint32 r4) 117 { return ((r1 << 12) | (r2 << 8) | (r3 << 4) | r4); } 118 119 #define B_FOLLOW_NONE 0 120 #define B_FOLLOW_ALL_SIDES _rule_(_VIEW_TOP_, _VIEW_LEFT_, _VIEW_BOTTOM_, _VIEW_RIGHT_) 121 #define B_FOLLOW_ALL B_FOLLOW_ALL_SIDES 122 123 #define B_FOLLOW_LEFT _rule_(0, _VIEW_LEFT_, 0, _VIEW_LEFT_) 124 #define B_FOLLOW_RIGHT _rule_(0, _VIEW_RIGHT_, 0, _VIEW_RIGHT_) 125 #define B_FOLLOW_LEFT_RIGHT _rule_(0, _VIEW_LEFT_, 0, _VIEW_RIGHT_) 126 #define B_FOLLOW_H_CENTER _rule_(0, _VIEW_CENTER_, 0, _VIEW_CENTER_) 127 128 #define B_FOLLOW_TOP _rule_(_VIEW_TOP_, 0, _VIEW_TOP_, 0) 129 #define B_FOLLOW_BOTTOM _rule_(_VIEW_BOTTOM_, 0, _VIEW_BOTTOM_, 0) 130 #define B_FOLLOW_TOP_BOTTOM _rule_(_VIEW_TOP_, 0, _VIEW_BOTTOM_, 0) 131 #define B_FOLLOW_V_CENTER _rule_(_VIEW_CENTER_, 0, _VIEW_CENTER_, 0) 132 133 class BBitmap; 134 class BCursor; 135 class BMessage; 136 class BPicture; 137 class BPolygon; 138 class BRegion; 139 class BScrollBar; 140 class BScrollView; 141 class BShape; 142 class BShelf; 143 class BString; 144 class BWindow; 145 class ViewAttr; 146 struct _view_attr_; 147 struct _array_data_; 148 struct _array_hdr_; 149 struct overlay_restrictions; 150 151 // BView class ----------------------------------------------------------------- 152 class BView : public BHandler { 153 154 public: 155 BView(BRect frame, const char* name, 156 uint32 resizeMask, uint32 flags); 157 virtual ~BView(); 158 159 BView(BMessage* data); 160 static BArchivable* Instantiate(BMessage* data); 161 virtual status_t Archive(BMessage* data, bool deep = true) const; 162 163 virtual void AttachedToWindow(); 164 virtual void AllAttached(); 165 virtual void DetachedFromWindow(); 166 virtual void AllDetached(); 167 168 virtual void MessageReceived(BMessage* msg); 169 170 void AddChild(BView* child, BView* before = NULL); 171 bool RemoveChild(BView* child); 172 int32 CountChildren() const; 173 BView* ChildAt(int32 index) const; 174 BView* NextSibling() const; 175 BView* PreviousSibling() const; 176 bool RemoveSelf(); 177 178 BWindow *Window() const; 179 180 virtual void Draw(BRect updateRect); 181 virtual void MouseDown(BPoint where); 182 virtual void MouseUp(BPoint where); 183 virtual void MouseMoved(BPoint where, 184 uint32 code, 185 const BMessage* a_message); 186 virtual void WindowActivated(bool state); 187 virtual void KeyDown(const char* bytes, int32 numBytes); 188 virtual void KeyUp(const char* bytes, int32 numBytes); 189 virtual void Pulse(); 190 virtual void FrameMoved(BPoint new_position); 191 virtual void FrameResized(float new_width, float new_height); 192 193 virtual void TargetedByScrollView(BScrollView* scroll_view); 194 void BeginRectTracking(BRect startRect, 195 uint32 style = B_TRACK_WHOLE_RECT); 196 void EndRectTracking(); 197 198 void GetMouse(BPoint* location, 199 uint32* buttons, 200 bool checkMessageQueue = true); 201 202 void DragMessage(BMessage* aMessage, 203 BRect dragRect, 204 BHandler* reply_to = NULL); 205 void DragMessage(BMessage* aMessage, 206 BBitmap* anImage, 207 BPoint offset, 208 BHandler* reply_to = NULL); 209 void DragMessage(BMessage* aMessage, 210 BBitmap* anImage, 211 drawing_mode dragMode, 212 BPoint offset, 213 BHandler* reply_to = NULL); 214 215 BView* FindView(const char* name) const; 216 BView* Parent() const; 217 BRect Bounds() const; 218 BRect Frame() const; 219 void ConvertToScreen(BPoint* pt) const; 220 BPoint ConvertToScreen(BPoint pt) const; 221 void ConvertFromScreen(BPoint* pt) const; 222 BPoint ConvertFromScreen(BPoint pt) const; 223 void ConvertToScreen(BRect* r) const; 224 BRect ConvertToScreen(BRect r) const; 225 void ConvertFromScreen(BRect* r) const; 226 BRect ConvertFromScreen(BRect r) const; 227 void ConvertToParent(BPoint* pt) const; 228 BPoint ConvertToParent(BPoint pt) const; 229 void ConvertFromParent(BPoint* pt) const; 230 BPoint ConvertFromParent(BPoint pt) const; 231 void ConvertToParent(BRect* r) const; 232 BRect ConvertToParent(BRect r) const; 233 void ConvertFromParent(BRect* r) const; 234 BRect ConvertFromParent(BRect r) const; 235 BPoint LeftTop() const; 236 237 void GetClippingRegion(BRegion* region) const; 238 virtual void ConstrainClippingRegion(BRegion* region); 239 void ClipToPicture(BPicture* picture, 240 BPoint where = B_ORIGIN, 241 bool sync = true); 242 void ClipToInversePicture(BPicture* picture, 243 BPoint where = B_ORIGIN, 244 bool sync = true); 245 246 virtual void SetDrawingMode(drawing_mode mode); 247 drawing_mode DrawingMode() const; 248 249 void SetBlendingMode(source_alpha srcAlpha, 250 alpha_function alphaFunc); 251 void GetBlendingMode(source_alpha* srcAlpha, 252 alpha_function* alphaFunc) const; 253 254 virtual void SetPenSize(float size); 255 float PenSize() const; 256 257 void SetViewCursor(const BCursor* cursor, bool sync=true); 258 259 virtual void SetViewColor(rgb_color c); 260 void SetViewColor(uchar r, uchar g, uchar b, uchar a = 255); 261 rgb_color ViewColor() const; 262 263 void SetViewBitmap(const BBitmap* bitmap, 264 BRect srcRect, BRect dstRect, 265 uint32 followFlags = B_FOLLOW_TOP|B_FOLLOW_LEFT, 266 uint32 options = B_TILE_BITMAP); 267 void SetViewBitmap(const BBitmap* bitmap, 268 uint32 followFlags = B_FOLLOW_TOP|B_FOLLOW_LEFT, 269 uint32 options = B_TILE_BITMAP); 270 void ClearViewBitmap(); 271 272 status_t SetViewOverlay(const BBitmap* overlay, 273 BRect srcRect, BRect dstRect, 274 rgb_color* colorKey, 275 uint32 followFlags = B_FOLLOW_TOP|B_FOLLOW_LEFT, 276 uint32 options = 0); 277 status_t SetViewOverlay(const BBitmap* overlay, rgb_color* colorKey, 278 uint32 followFlags = B_FOLLOW_TOP|B_FOLLOW_LEFT, 279 uint32 options = 0); 280 void ClearViewOverlay(); 281 282 virtual void SetHighColor(rgb_color a_color); 283 void SetHighColor(uchar r, uchar g, uchar b, uchar a = 255); 284 rgb_color HighColor() const; 285 286 virtual void SetLowColor(rgb_color a_color); 287 void SetLowColor(uchar r, uchar g, uchar b, uchar a = 255); 288 rgb_color LowColor() const; 289 290 void SetLineMode(cap_mode lineCap, 291 join_mode lineJoin, 292 float miterLimit = B_DEFAULT_MITER_LIMIT); 293 join_mode LineJoinMode() const; 294 cap_mode LineCapMode() const; 295 float LineMiterLimit() const; 296 297 void SetOrigin(BPoint pt); 298 void SetOrigin(float x, float y); 299 BPoint Origin() const; 300 301 void PushState(); 302 void PopState(); 303 304 void MovePenTo(BPoint pt); 305 void MovePenTo(float x, float y); 306 void MovePenBy(float x, float y); 307 BPoint PenLocation() const; 308 void StrokeLine(BPoint toPt, 309 pattern p = B_SOLID_HIGH); 310 void StrokeLine(BPoint pt0, 311 BPoint pt1, 312 pattern p = B_SOLID_HIGH); 313 void BeginLineArray(int32 count); 314 void AddLine(BPoint pt0, BPoint pt1, rgb_color col); 315 void EndLineArray(); 316 317 void StrokePolygon(const BPolygon* aPolygon, 318 bool closed = true, 319 pattern p = B_SOLID_HIGH); 320 void StrokePolygon(const BPoint* ptArray, 321 int32 numPts, 322 bool closed = true, 323 pattern p = B_SOLID_HIGH); 324 void StrokePolygon(const BPoint* ptArray, 325 int32 numPts, 326 BRect bounds, 327 bool closed = true, 328 pattern p = B_SOLID_HIGH); 329 void FillPolygon(const BPolygon* aPolygon, 330 pattern p = B_SOLID_HIGH); 331 void FillPolygon(const BPoint* ptArray, 332 int32 numPts, 333 pattern p = B_SOLID_HIGH); 334 void FillPolygon(const BPoint* ptArray, 335 int32 numPts, 336 BRect bounds, 337 pattern p = B_SOLID_HIGH); 338 339 void StrokeTriangle(BPoint pt1, 340 BPoint pt2, 341 BPoint pt3, 342 BRect bounds, 343 pattern p = B_SOLID_HIGH); 344 void StrokeTriangle(BPoint pt1, 345 BPoint pt2, 346 BPoint pt3, 347 pattern p = B_SOLID_HIGH); 348 void FillTriangle(BPoint pt1, 349 BPoint pt2, 350 BPoint pt3, 351 pattern p = B_SOLID_HIGH); 352 void FillTriangle(BPoint pt1, 353 BPoint pt2, 354 BPoint pt3, 355 BRect bounds, 356 pattern p = B_SOLID_HIGH); 357 358 void StrokeRect(BRect r, pattern p = B_SOLID_HIGH); 359 void FillRect(BRect r, pattern p = B_SOLID_HIGH); 360 void FillRegion(BRegion* a_region, pattern p= B_SOLID_HIGH); 361 void InvertRect(BRect r); 362 363 void StrokeRoundRect(BRect r, 364 float xRadius, 365 float yRadius, 366 pattern p = B_SOLID_HIGH); 367 void FillRoundRect(BRect r, 368 float xRadius, 369 float yRadius, 370 pattern p = B_SOLID_HIGH); 371 372 void StrokeEllipse(BPoint center, 373 float xRadius, 374 float yRadius, 375 pattern p = B_SOLID_HIGH); 376 void StrokeEllipse(BRect r, pattern p = B_SOLID_HIGH); 377 void FillEllipse(BPoint center, 378 float xRadius, 379 float yRadius, 380 pattern p = B_SOLID_HIGH); 381 void FillEllipse(BRect r, pattern p = B_SOLID_HIGH); 382 383 void StrokeArc(BPoint center, 384 float xRadius, 385 float yRadius, 386 float start_angle, 387 float arc_angle, 388 pattern p = B_SOLID_HIGH); 389 void StrokeArc(BRect r, 390 float start_angle, 391 float arc_angle, 392 pattern p = B_SOLID_HIGH); 393 void FillArc(BPoint center, 394 float xRadius, 395 float yRadius, 396 float start_angle, 397 float arc_angle, 398 pattern p = B_SOLID_HIGH); 399 void FillArc(BRect r, 400 float start_angle, 401 float arc_angle, 402 pattern p = B_SOLID_HIGH); 403 404 void StrokeBezier(BPoint* controlPoints, 405 pattern p = B_SOLID_HIGH); 406 void FillBezier(BPoint* controlPoints, 407 pattern p = B_SOLID_HIGH); 408 409 void StrokeShape(BShape* shape, 410 pattern p = B_SOLID_HIGH); 411 void FillShape(BShape* shape, 412 pattern p = B_SOLID_HIGH); 413 414 void CopyBits(BRect src, BRect dst); 415 void DrawBitmapAsync(const BBitmap* aBitmap, 416 BRect srcRect, 417 BRect dstRect); 418 void DrawBitmapAsync(const BBitmap* aBitmap); 419 void DrawBitmapAsync(const BBitmap* aBitmap, BPoint where); 420 void DrawBitmapAsync(const BBitmap* aBitmap, BRect dstRect); 421 void DrawBitmap(const BBitmap* aBitmap, 422 BRect srcRect, 423 BRect dstRect); 424 void DrawBitmap(const BBitmap* aBitmap); 425 void DrawBitmap(const BBitmap* aBitmap, BPoint where); 426 void DrawBitmap(const BBitmap* aBitmap, BRect dstRect); 427 428 void DrawChar(char aChar); 429 void DrawChar(char aChar, BPoint location); 430 void DrawString(const char* aString, 431 escapement_delta* delta = NULL); 432 void DrawString(const char* aString, BPoint location, 433 escapement_delta* delta = NULL); 434 void DrawString(const char* aString, int32 length, 435 escapement_delta* delta = NULL); 436 void DrawString(const char* aString, 437 int32 length, 438 BPoint location, 439 escapement_delta* delta = 0L); 440 441 virtual void SetFont(const BFont* font, uint32 mask = B_FONT_ALL); 442 443 #if !_PR3_COMPATIBLE_ 444 void GetFont(BFont* font) const; 445 #else 446 void GetFont(BFont* font); 447 #endif 448 void TruncateString(BString* in_out, 449 uint32 mode, 450 float width) const; 451 float StringWidth(const char* string) const; 452 float StringWidth(const char* string, int32 length) const; 453 void GetStringWidths(char* stringArray[], 454 int32 lengthArray[], 455 int32 numStrings, 456 float widthArray[]) const; 457 void SetFontSize(float size); 458 void ForceFontAliasing(bool enable); 459 void GetFontHeight(font_height* height) const; 460 461 void Invalidate(BRect invalRect); 462 void Invalidate(const BRegion* invalRegion); 463 void Invalidate(); 464 465 void SetDiskMode(char* filename, long offset); 466 467 void BeginPicture(BPicture* a_picture); 468 void AppendToPicture(BPicture* a_picture); 469 BPicture* EndPicture(); 470 471 void DrawPicture(const BPicture* a_picture); 472 void DrawPicture(const BPicture* a_picture, BPoint where); 473 void DrawPicture(const char* filename, long offset, BPoint where); 474 void DrawPictureAsync(const BPicture* a_picture); 475 void DrawPictureAsync(const BPicture* a_picture, BPoint where); 476 void DrawPictureAsync(const char* filename, long offset, 477 BPoint where); 478 479 status_t SetEventMask(uint32 mask, uint32 options=0); 480 uint32 EventMask(); 481 status_t SetMouseEventMask(uint32 mask, uint32 options=0); 482 483 virtual void SetFlags(uint32 flags); 484 uint32 Flags() const; 485 virtual void SetResizingMode(uint32 mode); 486 uint32 ResizingMode() const; 487 void MoveBy(float dh, float dv); 488 void MoveTo(BPoint where); 489 void MoveTo(float x, float y); 490 void ResizeBy(float dh, float dv); 491 void ResizeTo(float width, float height); 492 void ScrollBy(float dh, float dv); 493 void ScrollTo(float x, float y); 494 virtual void ScrollTo(BPoint where); 495 virtual void MakeFocus(bool focusState = true); 496 bool IsFocus() const; 497 498 virtual void Show(); 499 virtual void Hide(); 500 bool IsHidden() const; 501 bool IsHidden(const BView* looking_from) const; 502 503 void Flush() const; 504 void Sync() const; 505 506 virtual void GetPreferredSize(float* width, float* height); 507 virtual void ResizeToPreferred(); 508 509 BScrollBar* ScrollBar(orientation posture) const; 510 511 virtual BHandler* ResolveSpecifier(BMessage* msg, 512 int32 index, 513 BMessage* specifier, 514 int32 form, 515 const char* property); 516 virtual status_t GetSupportedSuites(BMessage* data); 517 518 bool IsPrinting() const; 519 void SetScale(float scale) const; 520 521 // Private or reserved --------------------------------------------------------- 522 virtual status_t Perform(perform_code d, void* arg); 523 524 virtual void DrawAfterChildren(BRect r); 525 526 // added by OBOS - DO NOT use this when programming BeOS R5!!! 527 float Scale() const; 528 529 private: 530 531 friend class BScrollBar; 532 friend class BWindow; 533 friend class BBitmap; 534 friend class BPrintJob; 535 friend class BShelf; 536 friend class BTabView; 537 538 virtual void _ReservedView2(); 539 virtual void _ReservedView3(); 540 virtual void _ReservedView4(); 541 virtual void _ReservedView5(); 542 virtual void _ReservedView6(); 543 virtual void _ReservedView7(); 544 virtual void _ReservedView8(); 545 546 #if !_PR3_COMPATIBLE_ 547 virtual void _ReservedView9(); 548 virtual void _ReservedView10(); 549 virtual void _ReservedView11(); 550 virtual void _ReservedView12(); 551 virtual void _ReservedView13(); 552 virtual void _ReservedView14(); 553 virtual void _ReservedView15(); 554 virtual void _ReservedView16(); 555 #endif 556 557 BView(const BView&); 558 BView& operator=(const BView&); 559 560 void InitData(BRect f, const char* name, uint32 rs, uint32 fl); 561 status_t ArchiveChildren(BMessage* data, bool deep) const; 562 status_t UnarchiveChildren(BMessage* data, BWindow* w = NULL); 563 status_t setViewImage(const BBitmap* bitmap,BRect srcRect, BRect dstRect, 564 uint32 followFlags, uint32 options); 565 void BeginPicture_pr(BPicture* a_picture, BRect r); 566 void SetPattern(pattern pat); 567 void DoBezier(int32 gr, BPoint* controlPoints, pattern p); 568 void DoShape(int32 gr, BShape* shape, pattern p); 569 void DoPictureClip(BPicture* picture, BPoint where, bool invert, 570 bool sync); 571 bool removeFromList(BView* a_view); 572 bool removeSelf(); 573 bool do_owner_check() const; 574 void setOwner(BWindow* the_owner); 575 void do_activate(int32 state); 576 void check_lock() const; 577 void check_lock_no_pick() const; 578 void movesize(uint32 code, int32 h, int32 v); 579 void handle_tick(); 580 char *test_area(int32 length); 581 void removeCommArray(); 582 _array_hdr_ *new_comm_array(int32 cnt); 583 BView *RealParent() const; 584 void SetScroller(BScrollBar* sb); 585 void UnsetScroller(BScrollBar* sb); 586 void RealScrollTo(BPoint); 587 void initCachedState(); 588 void setCachedState(); 589 void updateCachedState(); 590 void setFontState(const BFont* font, uint16 mask); 591 void fetch_font(); 592 uchar font_encoding() const; 593 BShelf* shelf() const; 594 void set_shelf(BShelf* ); 595 596 void deleteView( BView* aView); 597 bool do_owner_check_no_pick() const; 598 BView* findView( const BView* aView, const char* viewName ) const; 599 bool attachView( BView *aView ); 600 bool addToList( BView *aView, BView *before = NULL); 601 bool removeFromList(); 602 bool callDetachHooks( BView *aView ); 603 604 // Debugging methods 605 void PrintToStream(); 606 void PrintTree(); 607 608 int32 server_token; 609 uint32 fFlags; // used // was: f_type 610 float originX; // used // was: origin_h 611 float originY; // used // was: origin_v 612 BWindow* owner; // used 613 BView* parent; // used 614 BView* next_sibling; // used 615 BView* prev_sibling; // used 616 BView* first_child; // used 617 618 int16 fShowLevel; // used 619 bool top_level_view; // used 620 bool fNoISInteraction; 621 BPicture* cpicture; // used 622 _array_data_* comm; // used 623 624 BScrollBar* fVerScroller; // used 625 BScrollBar* fHorScroller; // used 626 bool f_is_printing; 627 bool _unused_bool0; // was: attached; 628 bool _unused_bool1; 629 bool _unused_bool2; 630 ViewAttr* fPermanentState;// used 631 ViewAttr* fState; // used 632 BRect fBounds; // used 633 BShelf* fShelf; // used 634 void* pr_state; 635 uint32 fEventMask; // used 636 uint32 fEventOptions; // used 637 uint32 _reserved[4]; 638 #if !_PR3_COMPATIBLE_ 639 uint32 _more_reserved[3]; 640 #endif 641 }; 642 //------------------------------------------------------------------------------ 643 644 645 // inline definitions ---------------------------------------------------------- 646 inline void BView::ScrollTo(float x, float y) 647 { 648 ScrollTo(BPoint(x, y)); 649 } 650 //------------------------------------------------------------------------------ 651 inline void BView::SetViewColor(uchar r, uchar g, uchar b, uchar a) 652 { 653 rgb_color a_color; 654 a_color.red = r; a_color.green = g; 655 a_color.blue = b; a_color.alpha = a; 656 SetViewColor(a_color); 657 } 658 //------------------------------------------------------------------------------ 659 inline void BView::SetHighColor(uchar r, uchar g, uchar b, uchar a) 660 { 661 rgb_color a_color; 662 a_color.red = r; a_color.green = g; 663 a_color.blue = b; a_color.alpha = a; 664 SetHighColor(a_color); 665 } 666 //------------------------------------------------------------------------------ 667 inline void BView::SetLowColor(uchar r, uchar g, uchar b, uchar a) 668 { 669 rgb_color a_color; 670 a_color.red = r; a_color.green = g; 671 a_color.blue = b; a_color.alpha = a; 672 SetLowColor(a_color); 673 } 674 //------------------------------------------------------------------------------ 675 676 #endif // _VIEW_H 677 678 /* 679 @log 680 * added PrintToStream() method for debugging BView. 681 682 */ 683 684