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 struct _view_attr_; 146 struct _array_data_; 147 struct _array_hdr_; 148 struct overlay_restrictions; 149 150 // BView class ----------------------------------------------------------------- 151 class BView : public BHandler { 152 153 public: 154 BView(BRect frame, const char* name, 155 uint32 resizeMask, uint32 flags); 156 virtual ~BView(); 157 158 BView(BMessage* data); 159 static BArchivable* Instantiate(BMessage* data); 160 virtual status_t Archive(BMessage* data, bool deep = true) const; 161 162 virtual void AttachedToWindow(); 163 virtual void AllAttached(); 164 virtual void DetachedFromWindow(); 165 virtual void AllDetached(); 166 167 virtual void MessageReceived(BMessage* msg); 168 169 void AddChild(BView* child, BView* before = NULL); 170 bool RemoveChild(BView* child); 171 int32 CountChildren() const; 172 BView* ChildAt(int32 index) const; 173 BView* NextSibling() const; 174 BView* PreviousSibling() const; 175 bool RemoveSelf(); 176 177 BWindow *Window() const; 178 179 virtual void Draw(BRect updateRect); 180 virtual void MouseDown(BPoint where); 181 virtual void MouseUp(BPoint where); 182 virtual void MouseMoved(BPoint where, 183 uint32 code, 184 const BMessage* a_message); 185 virtual void WindowActivated(bool state); 186 virtual void KeyDown(const char* bytes, int32 numBytes); 187 virtual void KeyUp(const char* bytes, int32 numBytes); 188 virtual void Pulse(); 189 virtual void FrameMoved(BPoint new_position); 190 virtual void FrameResized(float new_width, float new_height); 191 192 virtual void TargetedByScrollView(BScrollView* scroll_view); 193 void BeginRectTracking(BRect startRect, 194 uint32 style = B_TRACK_WHOLE_RECT); 195 void EndRectTracking(); 196 197 void GetMouse(BPoint* location, 198 uint32* buttons, 199 bool checkMessageQueue = true); 200 201 void DragMessage(BMessage* aMessage, 202 BRect dragRect, 203 BHandler* reply_to = NULL); 204 void DragMessage(BMessage* aMessage, 205 BBitmap* anImage, 206 BPoint offset, 207 BHandler* reply_to = NULL); 208 void DragMessage(BMessage* aMessage, 209 BBitmap* anImage, 210 drawing_mode dragMode, 211 BPoint offset, 212 BHandler* reply_to = NULL); 213 214 BView* FindView(const char* name) const; 215 BView* Parent() const; 216 BRect Bounds() const; 217 BRect Frame() const; 218 void ConvertToScreen(BPoint* pt) const; 219 BPoint ConvertToScreen(BPoint pt) const; 220 void ConvertFromScreen(BPoint* pt) const; 221 BPoint ConvertFromScreen(BPoint pt) const; 222 void ConvertToScreen(BRect* r) const; 223 BRect ConvertToScreen(BRect r) const; 224 void ConvertFromScreen(BRect* r) const; 225 BRect ConvertFromScreen(BRect r) const; 226 void ConvertToParent(BPoint* pt) const; 227 BPoint ConvertToParent(BPoint pt) const; 228 void ConvertFromParent(BPoint* pt) const; 229 BPoint ConvertFromParent(BPoint pt) const; 230 void ConvertToParent(BRect* r) const; 231 BRect ConvertToParent(BRect r) const; 232 void ConvertFromParent(BRect* r) const; 233 BRect ConvertFromParent(BRect r) const; 234 BPoint LeftTop() const; 235 236 void GetClippingRegion(BRegion* region) const; 237 virtual void ConstrainClippingRegion(BRegion* region); 238 void ClipToPicture(BPicture* picture, 239 BPoint where = B_ORIGIN, 240 bool sync = true); 241 void ClipToInversePicture(BPicture* picture, 242 BPoint where = B_ORIGIN, 243 bool sync = true); 244 245 virtual void SetDrawingMode(drawing_mode mode); 246 drawing_mode DrawingMode() const; 247 248 void SetBlendingMode(source_alpha srcAlpha, 249 alpha_function alphaFunc); 250 void GetBlendingMode(source_alpha* srcAlpha, 251 alpha_function* alphaFunc) const; 252 253 virtual void SetPenSize(float size); 254 float PenSize() const; 255 256 void SetViewCursor(const BCursor* cursor, bool sync=true); 257 258 virtual void SetViewColor(rgb_color c); 259 void SetViewColor(uchar r, uchar g, uchar b, uchar a = 255); 260 rgb_color ViewColor() const; 261 262 void SetViewBitmap(const BBitmap* bitmap, 263 BRect srcRect, BRect dstRect, 264 uint32 followFlags = B_FOLLOW_TOP|B_FOLLOW_LEFT, 265 uint32 options = B_TILE_BITMAP); 266 void SetViewBitmap(const BBitmap* bitmap, 267 uint32 followFlags = B_FOLLOW_TOP|B_FOLLOW_LEFT, 268 uint32 options = B_TILE_BITMAP); 269 void ClearViewBitmap(); 270 271 status_t SetViewOverlay(const BBitmap* overlay, 272 BRect srcRect, BRect dstRect, 273 rgb_color* colorKey, 274 uint32 followFlags = B_FOLLOW_TOP|B_FOLLOW_LEFT, 275 uint32 options = 0); 276 status_t SetViewOverlay(const BBitmap* overlay, rgb_color* colorKey, 277 uint32 followFlags = B_FOLLOW_TOP|B_FOLLOW_LEFT, 278 uint32 options = 0); 279 void ClearViewOverlay(); 280 281 virtual void SetHighColor(rgb_color a_color); 282 void SetHighColor(uchar r, uchar g, uchar b, uchar a = 255); 283 rgb_color HighColor() const; 284 285 virtual void SetLowColor(rgb_color a_color); 286 void SetLowColor(uchar r, uchar g, uchar b, uchar a = 255); 287 rgb_color LowColor() const; 288 289 void SetLineMode(cap_mode lineCap, 290 join_mode lineJoin, 291 float miterLimit = B_DEFAULT_MITER_LIMIT); 292 join_mode LineJoinMode() const; 293 cap_mode LineCapMode() const; 294 float LineMiterLimit() const; 295 296 void SetOrigin(BPoint pt); 297 void SetOrigin(float x, float y); 298 BPoint Origin() const; 299 300 void PushState(); 301 void PopState(); 302 303 void MovePenTo(BPoint pt); 304 void MovePenTo(float x, float y); 305 void MovePenBy(float x, float y); 306 BPoint PenLocation() const; 307 void StrokeLine(BPoint toPt, 308 pattern p = B_SOLID_HIGH); 309 void StrokeLine(BPoint pt0, 310 BPoint pt1, 311 pattern p = B_SOLID_HIGH); 312 void BeginLineArray(int32 count); 313 void AddLine(BPoint pt0, BPoint pt1, rgb_color col); 314 void EndLineArray(); 315 316 void StrokePolygon(const BPolygon* aPolygon, 317 bool closed = true, 318 pattern p = B_SOLID_HIGH); 319 void StrokePolygon(const BPoint* ptArray, 320 int32 numPts, 321 bool closed = true, 322 pattern p = B_SOLID_HIGH); 323 void StrokePolygon(const BPoint* ptArray, 324 int32 numPts, 325 BRect bounds, 326 bool closed = true, 327 pattern p = B_SOLID_HIGH); 328 void FillPolygon(const BPolygon* aPolygon, 329 pattern p = B_SOLID_HIGH); 330 void FillPolygon(const BPoint* ptArray, 331 int32 numPts, 332 pattern p = B_SOLID_HIGH); 333 void FillPolygon(const BPoint* ptArray, 334 int32 numPts, 335 BRect bounds, 336 pattern p = B_SOLID_HIGH); 337 338 void StrokeTriangle(BPoint pt1, 339 BPoint pt2, 340 BPoint pt3, 341 BRect bounds, 342 pattern p = B_SOLID_HIGH); 343 void StrokeTriangle(BPoint pt1, 344 BPoint pt2, 345 BPoint pt3, 346 pattern p = B_SOLID_HIGH); 347 void FillTriangle(BPoint pt1, 348 BPoint pt2, 349 BPoint pt3, 350 pattern p = B_SOLID_HIGH); 351 void FillTriangle(BPoint pt1, 352 BPoint pt2, 353 BPoint pt3, 354 BRect bounds, 355 pattern p = B_SOLID_HIGH); 356 357 void StrokeRect(BRect r, pattern p = B_SOLID_HIGH); 358 void FillRect(BRect r, pattern p = B_SOLID_HIGH); 359 void FillRegion(BRegion* a_region, pattern p= B_SOLID_HIGH); 360 void InvertRect(BRect r); 361 362 void StrokeRoundRect(BRect r, 363 float xRadius, 364 float yRadius, 365 pattern p = B_SOLID_HIGH); 366 void FillRoundRect(BRect r, 367 float xRadius, 368 float yRadius, 369 pattern p = B_SOLID_HIGH); 370 371 void StrokeEllipse(BPoint center, 372 float xRadius, 373 float yRadius, 374 pattern p = B_SOLID_HIGH); 375 void StrokeEllipse(BRect r, pattern p = B_SOLID_HIGH); 376 void FillEllipse(BPoint center, 377 float xRadius, 378 float yRadius, 379 pattern p = B_SOLID_HIGH); 380 void FillEllipse(BRect r, pattern p = B_SOLID_HIGH); 381 382 void StrokeArc(BPoint center, 383 float xRadius, 384 float yRadius, 385 float start_angle, 386 float arc_angle, 387 pattern p = B_SOLID_HIGH); 388 void StrokeArc(BRect r, 389 float start_angle, 390 float arc_angle, 391 pattern p = B_SOLID_HIGH); 392 void FillArc(BPoint center, 393 float xRadius, 394 float yRadius, 395 float start_angle, 396 float arc_angle, 397 pattern p = B_SOLID_HIGH); 398 void FillArc(BRect r, 399 float start_angle, 400 float arc_angle, 401 pattern p = B_SOLID_HIGH); 402 403 void StrokeBezier(BPoint* controlPoints, 404 pattern p = B_SOLID_HIGH); 405 void FillBezier(BPoint* controlPoints, 406 pattern p = B_SOLID_HIGH); 407 408 void StrokeShape(BShape* shape, 409 pattern p = B_SOLID_HIGH); 410 void FillShape(BShape* shape, 411 pattern p = B_SOLID_HIGH); 412 413 void CopyBits(BRect src, BRect dst); 414 void DrawBitmapAsync(const BBitmap* aBitmap, 415 BRect srcRect, 416 BRect dstRect); 417 void DrawBitmapAsync(const BBitmap* aBitmap); 418 void DrawBitmapAsync(const BBitmap* aBitmap, BPoint where); 419 void DrawBitmapAsync(const BBitmap* aBitmap, BRect dstRect); 420 void DrawBitmap(const BBitmap* aBitmap, 421 BRect srcRect, 422 BRect dstRect); 423 void DrawBitmap(const BBitmap* aBitmap); 424 void DrawBitmap(const BBitmap* aBitmap, BPoint where); 425 void DrawBitmap(const BBitmap* aBitmap, BRect dstRect); 426 427 void DrawChar(char aChar); 428 void DrawChar(char aChar, BPoint location); 429 void DrawString(const char* aString, 430 escapement_delta* delta = NULL); 431 void DrawString(const char* aString, 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, 436 int32 length, 437 BPoint location, 438 escapement_delta* delta = 0L); 439 440 virtual void SetFont(const BFont* font, uint32 mask = B_FONT_ALL); 441 442 #if !_PR3_COMPATIBLE_ 443 void GetFont(BFont* font) const; 444 #else 445 void GetFont(BFont* font); 446 #endif 447 void TruncateString(BString* in_out, 448 uint32 mode, 449 float width) const; 450 float StringWidth(const char* string) const; 451 float StringWidth(const char* string, int32 length) const; 452 void GetStringWidths(char* stringArray[], 453 int32 lengthArray[], 454 int32 numStrings, 455 float widthArray[]) const; 456 void SetFontSize(float size); 457 void ForceFontAliasing(bool enable); 458 void GetFontHeight(font_height* height) const; 459 460 void Invalidate(BRect invalRect); 461 void Invalidate(const BRegion* invalRegion); 462 void Invalidate(); 463 464 void SetDiskMode(char* filename, long offset); 465 466 void BeginPicture(BPicture* a_picture); 467 void AppendToPicture(BPicture* a_picture); 468 BPicture* EndPicture(); 469 470 void DrawPicture(const BPicture* a_picture); 471 void DrawPicture(const BPicture* a_picture, BPoint where); 472 void DrawPicture(const char* filename, long offset, BPoint where); 473 void DrawPictureAsync(const BPicture* a_picture); 474 void DrawPictureAsync(const BPicture* a_picture, BPoint where); 475 void DrawPictureAsync(const char* filename, long offset, 476 BPoint where); 477 478 status_t SetEventMask(uint32 mask, uint32 options=0); 479 uint32 EventMask(); 480 status_t SetMouseEventMask(uint32 mask, uint32 options=0); 481 482 virtual void SetFlags(uint32 flags); 483 uint32 Flags() const; 484 virtual void SetResizingMode(uint32 mode); 485 uint32 ResizingMode() const; 486 void MoveBy(float dh, float dv); 487 void MoveTo(BPoint where); 488 void MoveTo(float x, float y); 489 void ResizeBy(float dh, float dv); 490 void ResizeTo(float width, float height); 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, 511 int32 index, 512 BMessage* specifier, 513 int32 form, 514 const char* property); 515 virtual status_t GetSupportedSuites(BMessage* data); 516 517 bool IsPrinting() const; 518 void SetScale(float scale) const; 519 520 // Private or reserved --------------------------------------------------------- 521 virtual status_t Perform(perform_code d, void* arg); 522 523 virtual void DrawAfterChildren(BRect r); 524 525 // added by OBOS - DO NOT use this when programming BeOS R5!!! 526 float Scale() const; 527 528 private: 529 530 friend class BScrollBar; 531 friend class BWindow; 532 friend class BBitmap; 533 friend class BPrintJob; 534 friend class BShelf; 535 friend class BTabView; 536 537 virtual void _ReservedView2(); 538 virtual void _ReservedView3(); 539 virtual void _ReservedView4(); 540 virtual void _ReservedView5(); 541 virtual void _ReservedView6(); 542 virtual void _ReservedView7(); 543 virtual void _ReservedView8(); 544 545 #if !_PR3_COMPATIBLE_ 546 virtual void _ReservedView9(); 547 virtual void _ReservedView10(); 548 virtual void _ReservedView11(); 549 virtual void _ReservedView12(); 550 virtual void _ReservedView13(); 551 virtual void _ReservedView14(); 552 virtual void _ReservedView15(); 553 virtual void _ReservedView16(); 554 #endif 555 556 BView(const BView&); 557 BView& operator=(const BView&); 558 559 void InitData(BRect f, const char* name, uint32 rs, uint32 fl); 560 status_t ArchiveChildren(BMessage* data, bool deep) const; 561 status_t UnarchiveChildren(BMessage* data, BWindow* w = NULL); 562 status_t setViewImage(const BBitmap* bitmap,BRect srcRect, BRect dstRect, 563 uint32 followFlags, uint32 options); 564 void BeginPicture_pr(BPicture* a_picture, BRect r); 565 void SetPattern(pattern pat); 566 void DoBezier(int32 gr, BPoint* controlPoints, pattern p); 567 void DoShape(int32 gr, BShape* shape, pattern p); 568 void DoPictureClip(BPicture* picture, BPoint where, bool invert, 569 bool sync); 570 bool removeFromList(BView* a_view); 571 bool removeSelf(); 572 bool do_owner_check() const; 573 void setOwner(BWindow* the_owner); 574 void do_activate(int32 state); 575 void check_lock() const; 576 void check_lock_no_pick() const; 577 void movesize(uint32 code, int32 h, int32 v); 578 void handle_tick(); 579 char *test_area(int32 length); 580 void removeCommArray(); 581 _array_hdr_ *new_comm_array(int32 cnt); 582 BView *RealParent() const; 583 void SetScroller(BScrollBar* sb); 584 void UnsetScroller(BScrollBar* sb); 585 void RealScrollTo(BPoint); 586 void initCachedState(); 587 void setCachedState(); 588 void updateCachedState(); 589 void setFontState(const BFont* font, uint16 mask); 590 void fetch_font(); 591 uchar font_encoding() const; 592 BShelf* shelf() const; 593 void set_shelf(BShelf* ); 594 595 void deleteView( BView* aView); 596 bool do_owner_check_no_pick() const; 597 BView* findView( const BView* aView, const char* viewName ) const; 598 bool attachView( BView *aView ); 599 bool addToList( BView *aView, BView *before = NULL); 600 bool removeFromList(); 601 bool callDetachHooks( BView *aView ); 602 603 // Debugging methods 604 void PrintToStream(); 605 void PrintTree(); 606 607 int32 server_token; 608 uint32 fFlags; // used // was: f_type 609 float originX; // used // was: origin_h 610 float originY; // used // was: origin_v 611 BWindow* owner; // used 612 BView* parent; // used 613 BView* next_sibling; // used 614 BView* prev_sibling; // used 615 BView* first_child; // used 616 617 int16 fShowLevel; // used 618 bool top_level_view; // used 619 bool fNoISInteraction; 620 BPicture* cpicture; // used 621 _array_data_* comm; // used 622 623 BScrollBar* fVerScroller; // used 624 BScrollBar* fHorScroller; // used 625 bool f_is_printing; 626 bool _unused_bool0; // was: attached; 627 bool _unused_bool1; 628 bool _unused_bool2; 629 _view_attr_* fPermanentState;// used 630 _view_attr_* fState; // used 631 BRect fBounds; // used 632 BShelf* fShelf; // used 633 void* pr_state; 634 uint32 fEventMask; // used 635 uint32 fEventOptions; // used 636 uint32 _reserved[4]; 637 #if !_PR3_COMPATIBLE_ 638 uint32 _more_reserved[3]; 639 #endif 640 }; 641 //------------------------------------------------------------------------------ 642 643 644 // inline definitions ---------------------------------------------------------- 645 inline void BView::ScrollTo(float x, float y) 646 { 647 ScrollTo(BPoint(x, y)); 648 } 649 //------------------------------------------------------------------------------ 650 inline void BView::SetViewColor(uchar r, uchar g, uchar b, uchar a) 651 { 652 rgb_color a_color; 653 a_color.red = r; a_color.green = g; 654 a_color.blue = b; a_color.alpha = a; 655 SetViewColor(a_color); 656 } 657 //------------------------------------------------------------------------------ 658 inline void BView::SetHighColor(uchar r, uchar g, uchar b, uchar a) 659 { 660 rgb_color a_color; 661 a_color.red = r; a_color.green = g; 662 a_color.blue = b; a_color.alpha = a; 663 SetHighColor(a_color); 664 } 665 //------------------------------------------------------------------------------ 666 inline void BView::SetLowColor(uchar r, uchar g, uchar b, uchar a) 667 { 668 rgb_color a_color; 669 a_color.red = r; a_color.green = g; 670 a_color.blue = b; a_color.alpha = a; 671 SetLowColor(a_color); 672 } 673 //------------------------------------------------------------------------------ 674 675 #endif // _VIEW_H 676 677 /* 678 @log 679 * added PrintToStream() method for debugging BView. 680 681 */ 682 683