xref: /haiku/headers/os/interface/View.h (revision a381c8a06378de22ff08adf4282b4e3f7e50d250)
1 /*
2  * Copyright 2001-2006, 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 
20 
21 // mouse button
22 enum {
23 	B_PRIMARY_MOUSE_BUTTON = 0x01,
24 	B_SECONDARY_MOUSE_BUTTON = 0x02,
25 	B_TERTIARY_MOUSE_BUTTON = 0x04
26 };
27 
28 // mouse transit
29 enum {
30 	B_ENTERED_VIEW = 0,
31 	B_INSIDE_VIEW,
32 	B_EXITED_VIEW,
33 	B_OUTSIDE_VIEW
34 };
35 
36 // event mask
37 enum {
38 	B_POINTER_EVENTS		= 0x00000001,
39 	B_KEYBOARD_EVENTS		= 0x00000002
40 };
41 
42 // event mask options
43 enum {
44 	B_LOCK_WINDOW_FOCUS		= 0x00000001,
45 	B_SUSPEND_VIEW_FOCUS	= 0x00000002,
46 	B_NO_POINTER_HISTORY	= 0x00000004
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_, _VIEW_RIGHT_)
96 #define B_FOLLOW_ALL  		B_FOLLOW_ALL_SIDES
97 
98 #define B_FOLLOW_LEFT		_rule_(0, _VIEW_LEFT_, 0, _VIEW_LEFT_)
99 #define B_FOLLOW_RIGHT		_rule_(0, _VIEW_RIGHT_, 0, _VIEW_RIGHT_)
100 #define B_FOLLOW_LEFT_RIGHT	_rule_(0, _VIEW_LEFT_, 0, _VIEW_RIGHT_)
101 #define B_FOLLOW_H_CENTER	_rule_(0, _VIEW_CENTER_, 0, _VIEW_CENTER_)
102 
103 #define B_FOLLOW_TOP		_rule_(_VIEW_TOP_, 0, _VIEW_TOP_, 0)
104 #define B_FOLLOW_BOTTOM		_rule_(_VIEW_BOTTOM_, 0, _VIEW_BOTTOM_, 0)
105 #define B_FOLLOW_TOP_BOTTOM	_rule_(_VIEW_TOP_, 0, _VIEW_BOTTOM_, 0)
106 #define B_FOLLOW_V_CENTER	_rule_(_VIEW_CENTER_, 0, _VIEW_CENTER_, 0)
107 
108 class BBitmap;
109 class BCursor;
110 class BLayout;
111 class BLayoutContext;
112 class BLayoutItem;
113 class BMessage;
114 class BPicture;
115 class BPolygon;
116 class BRegion;
117 class BScrollBar;
118 class BScrollView;
119 class BShape;
120 class BShelf;
121 class BString;
122 class BWindow;
123 struct _array_data_;
124 struct _array_hdr_;
125 struct overlay_restrictions;
126 
127 namespace BPrivate {
128 	class ViewState;
129 };
130 
131 
132 class BView : public BHandler {
133 public:
134 							BView(const char* name, uint32 flags,
135 								BLayout* layout = NULL);
136 							BView(BRect frame, const char* name,
137 								  uint32 resizeMask, uint32 flags);
138 	virtual					~BView();
139 
140 							BView(BMessage* data);
141 	static	BArchivable*	Instantiate(BMessage* data);
142 	virtual	status_t		Archive(BMessage* data, bool deep = true) const;
143 
144 	virtual	void			AttachedToWindow();
145 	virtual	void			AllAttached();
146 	virtual	void			DetachedFromWindow();
147 	virtual	void			AllDetached();
148 
149 	virtual	void			MessageReceived(BMessage* msg);
150 
151 			void			AddChild(BView* child, BView* before = NULL);
152 			bool			AddChild(BLayoutItem* child);
153 			bool			RemoveChild(BView* child);
154 			int32			CountChildren() const;
155 			BView*			ChildAt(int32 index) const;
156 			BView*			NextSibling() const;
157 			BView*			PreviousSibling() const;
158 			bool			RemoveSelf();
159 
160 			BWindow*		Window() const;
161 
162 	virtual	void			Draw(BRect updateRect);
163 	virtual	void			MouseDown(BPoint where);
164 	virtual	void			MouseUp(BPoint where);
165 	virtual	void			MouseMoved(BPoint where,
166 									   uint32 code,
167 									   const BMessage* a_message);
168 	virtual	void			WindowActivated(bool state);
169 	virtual	void			KeyDown(const char* bytes, int32 numBytes);
170 	virtual	void			KeyUp(const char* bytes, int32 numBytes);
171 	virtual	void			Pulse();
172 	virtual	void			FrameMoved(BPoint new_position);
173 	virtual	void			FrameResized(float new_width, float new_height);
174 
175 	virtual	void			TargetedByScrollView(BScrollView* scroll_view);
176 			void			BeginRectTracking(BRect startRect,
177 											  uint32 style = B_TRACK_WHOLE_RECT);
178 			void			EndRectTracking();
179 
180 			void			GetMouse(BPoint* location,
181 									 uint32* buttons,
182 									 bool checkMessageQueue = true);
183 
184 			void			DragMessage(BMessage* aMessage,
185 										BRect dragRect,
186 										BHandler* reply_to = NULL);
187 			void			DragMessage(BMessage* aMessage,
188 										BBitmap* anImage,
189 										BPoint offset,
190 										BHandler* reply_to = NULL);
191 			void			DragMessage(BMessage* aMessage,
192 										BBitmap* anImage,
193 										drawing_mode dragMode,
194 										BPoint offset,
195 										BHandler* reply_to = NULL);
196 
197 			BView*			FindView(const char* name) const;
198 			BView*			Parent() const;
199 			BRect			Bounds() const;
200 			BRect			Frame() const;
201 			void			ConvertToScreen(BPoint* pt) const;
202 			BPoint			ConvertToScreen(BPoint pt) const;
203 			void			ConvertFromScreen(BPoint* pt) const;
204 			BPoint			ConvertFromScreen(BPoint pt) const;
205 			void			ConvertToScreen(BRect* r) const;
206 			BRect			ConvertToScreen(BRect r) const;
207 			void			ConvertFromScreen(BRect* r) const;
208 			BRect			ConvertFromScreen(BRect r) const;
209 			void			ConvertToParent(BPoint* pt) const;
210 			BPoint			ConvertToParent(BPoint pt) const;
211 			void			ConvertFromParent(BPoint* pt) const;
212 			BPoint			ConvertFromParent(BPoint pt) const;
213 			void			ConvertToParent(BRect* r) const;
214 			BRect			ConvertToParent(BRect r) const;
215 			void			ConvertFromParent(BRect* r) const;
216 			BRect			ConvertFromParent(BRect r) const;
217 			BPoint			LeftTop() const;
218 
219 			void			GetClippingRegion(BRegion* region) const;
220 	virtual	void			ConstrainClippingRegion(BRegion* region);
221 			void			ClipToPicture(BPicture* picture,
222 										  BPoint where = B_ORIGIN,
223 										  bool sync = true);
224 			void			ClipToInversePicture(BPicture* picture,
225 												 BPoint where = B_ORIGIN,
226 												 bool sync = true);
227 
228 	virtual	void			SetDrawingMode(drawing_mode mode);
229 			drawing_mode 	DrawingMode() const;
230 
231 			void			SetBlendingMode(source_alpha srcAlpha,
232 											alpha_function alphaFunc);
233 			void	 		GetBlendingMode(source_alpha* srcAlpha,
234 											alpha_function* alphaFunc) const;
235 
236 	virtual	void			SetPenSize(float size);
237 			float			PenSize() const;
238 
239 			void			SetViewCursor(const BCursor* cursor, bool sync=true);
240 
241 	virtual	void			SetViewColor(rgb_color c);
242 			void			SetViewColor(uchar r, uchar g, uchar b, uchar a = 255);
243 			rgb_color		ViewColor() const;
244 
245 			void			SetViewBitmap(const BBitmap* bitmap,
246 										  BRect srcRect, BRect dstRect,
247 										  uint32 followFlags = B_FOLLOW_TOP|B_FOLLOW_LEFT,
248 										  uint32 options = B_TILE_BITMAP);
249 			void			SetViewBitmap(const BBitmap* bitmap,
250 										  uint32 followFlags = 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 = B_FOLLOW_TOP|B_FOLLOW_LEFT,
258 										   uint32 options = 0);
259 			status_t		SetViewOverlay(const BBitmap* overlay, rgb_color* colorKey,
260 										   uint32 followFlags = B_FOLLOW_TOP|B_FOLLOW_LEFT,
261 										   uint32 options = 0);
262 			void			ClearViewOverlay();
263 
264 	virtual	void			SetHighColor(rgb_color a_color);
265 			void			SetHighColor(uchar r, uchar g, uchar b, uchar a = 255);
266 			rgb_color		HighColor() const;
267 
268 	virtual	void			SetLowColor(rgb_color a_color);
269 			void			SetLowColor(uchar r, uchar g, uchar b, uchar a = 255);
270 			rgb_color		LowColor() const;
271 
272 			void			SetLineMode(cap_mode lineCap,
273 										join_mode lineJoin,
274 										float miterLimit = B_DEFAULT_MITER_LIMIT);
275 			join_mode		LineJoinMode() const;
276 			cap_mode		LineCapMode() const;
277 			float			LineMiterLimit() const;
278 
279 			void			SetOrigin(BPoint pt);
280 			void			SetOrigin(float x, float y);
281 			BPoint			Origin() const;
282 
283 			void			PushState();
284 			void			PopState();
285 
286 			void			MovePenTo(BPoint pt);
287 			void			MovePenTo(float x, float y);
288 			void			MovePenBy(float x, float y);
289 			BPoint			PenLocation() const;
290 			void			StrokeLine(BPoint toPt,
291 									   pattern p = B_SOLID_HIGH);
292 			void			StrokeLine(BPoint pt0,
293 									   BPoint pt1,
294 									   pattern p = B_SOLID_HIGH);
295 			void			BeginLineArray(int32 count);
296 			void			AddLine(BPoint pt0, BPoint pt1, rgb_color col);
297 			void			EndLineArray();
298 
299 			void			StrokePolygon(const BPolygon* aPolygon,
300 										  bool closed = true,
301 										  pattern p = B_SOLID_HIGH);
302 			void			StrokePolygon(const BPoint* ptArray,
303 										  int32 numPts,
304 										  bool closed = true,
305 										  pattern p = B_SOLID_HIGH);
306 			void			StrokePolygon(const BPoint* ptArray,
307 										  int32 numPts,
308 										  BRect bounds,
309 										  bool closed = true,
310 										  pattern p = B_SOLID_HIGH);
311 			void			FillPolygon(const BPolygon* aPolygon,
312 										pattern p = B_SOLID_HIGH);
313 			void			FillPolygon(const BPoint* ptArray,
314 										int32 numPts,
315 										pattern p = B_SOLID_HIGH);
316 			void			FillPolygon(const BPoint* ptArray,
317 										int32 numPts,
318 										BRect bounds,
319 										pattern p = B_SOLID_HIGH);
320 
321 			void			StrokeTriangle(BPoint pt1,
322 										   BPoint pt2,
323 										   BPoint pt3,
324 										   BRect bounds,
325 										   pattern p = B_SOLID_HIGH);
326 			void			StrokeTriangle(BPoint pt1,
327 										   BPoint pt2,
328 										   BPoint pt3,
329 										   pattern p = B_SOLID_HIGH);
330 			void			FillTriangle(BPoint pt1,
331 										 BPoint pt2,
332 										 BPoint pt3,
333 										 pattern p = B_SOLID_HIGH);
334 			void			FillTriangle(BPoint pt1,
335 										 BPoint pt2,
336 										 BPoint pt3,
337 										 BRect bounds,
338 										 pattern p = B_SOLID_HIGH);
339 
340 			void			StrokeRect(BRect r, pattern p = B_SOLID_HIGH);
341 			void			FillRect(BRect r, pattern p = B_SOLID_HIGH);
342 			void			FillRegion(BRegion* a_region, pattern p= B_SOLID_HIGH);
343 			void			InvertRect(BRect r);
344 
345 			void			StrokeRoundRect(BRect r,
346 											float xRadius,
347 											float yRadius,
348 											pattern p = B_SOLID_HIGH);
349 			void			FillRoundRect(BRect r,
350 										  float xRadius,
351 										  float yRadius,
352 										  pattern p = B_SOLID_HIGH);
353 
354 			void			StrokeEllipse(BPoint center,
355 										  float xRadius,
356 										  float yRadius,
357 										  pattern p = B_SOLID_HIGH);
358 			void			StrokeEllipse(BRect r, pattern p = B_SOLID_HIGH);
359 			void			FillEllipse(BPoint center,
360 										float xRadius,
361 										float yRadius,
362 										pattern p = B_SOLID_HIGH);
363 			void			FillEllipse(BRect r, pattern p = B_SOLID_HIGH);
364 
365 			void			StrokeArc(BPoint center,
366 									  float xRadius,
367 									  float yRadius,
368 									  float start_angle,
369 									  float arc_angle,
370 									  pattern p = B_SOLID_HIGH);
371 			void			StrokeArc(BRect r,
372 									  float start_angle,
373 									  float arc_angle,
374 									  pattern p = B_SOLID_HIGH);
375 			void			FillArc(BPoint center,
376 									float xRadius,
377 									float yRadius,
378 									float start_angle,
379 									float arc_angle,
380 									pattern p = B_SOLID_HIGH);
381 			void			FillArc(BRect r,
382 									float start_angle,
383 									float arc_angle,
384 									pattern p = B_SOLID_HIGH);
385 
386 			void			StrokeBezier(BPoint* controlPoints,
387 										 pattern p = B_SOLID_HIGH);
388 			void			FillBezier(BPoint* controlPoints,
389 									   pattern p = B_SOLID_HIGH);
390 
391 			void			StrokeShape(BShape* shape,
392 										pattern p = B_SOLID_HIGH);
393 			void			FillShape(BShape* shape,
394 									  pattern p = B_SOLID_HIGH);
395 
396 			void			CopyBits(BRect src, BRect dst);
397 			void			DrawBitmapAsync(const BBitmap* aBitmap,
398 											BRect srcRect,
399 											BRect dstRect);
400 			void			DrawBitmapAsync(const BBitmap* aBitmap);
401 			void			DrawBitmapAsync(const BBitmap* aBitmap, BPoint where);
402 			void			DrawBitmapAsync(const BBitmap* aBitmap, BRect dstRect);
403 			void			DrawBitmap(const BBitmap* aBitmap,
404 									   BRect srcRect,
405 									   BRect dstRect);
406 			void			DrawBitmap(const BBitmap* aBitmap);
407 			void			DrawBitmap(const BBitmap* aBitmap, BPoint where);
408 			void			DrawBitmap(const BBitmap* aBitmap, BRect dstRect);
409 
410 			void			DrawChar(char aChar);
411 			void			DrawChar(char aChar, BPoint location);
412 			void			DrawString(const char* aString,
413 									   escapement_delta* delta = NULL);
414 			void			DrawString(const char* aString, BPoint location,
415 									   escapement_delta* delta = NULL);
416 			void			DrawString(const char* aString, int32 length,
417 									   escapement_delta* delta = NULL);
418 			void			DrawString(const char* aString,
419 									   int32 length,
420 									   BPoint location,
421 									   escapement_delta* delta = 0L);
422 
423 	virtual void            SetFont(const BFont* font, uint32 mask = B_FONT_ALL);
424 
425 			void            GetFont(BFont* font) const;
426 			void			TruncateString(BString* in_out,
427 										   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[],
433 											int32 numStrings,
434 											float widthArray[]) const;
435 			void			SetFontSize(float size);
436 			void			ForceFontAliasing(bool enable);
437 			void			GetFontHeight(font_height* height) const;
438 
439 			void			Invalidate(BRect invalRect);
440 			void			Invalidate(const BRegion* invalRegion);
441 			void			Invalidate();
442 
443 			void			SetDiskMode(char* filename, long offset);
444 
445 			void			BeginPicture(BPicture* a_picture);
446 			void			AppendToPicture(BPicture* a_picture);
447 			BPicture*		EndPicture();
448 
449 			void			DrawPicture(const BPicture* a_picture);
450 			void			DrawPicture(const BPicture* a_picture, BPoint where);
451 			void			DrawPicture(const char* filename, long offset, BPoint where);
452 			void			DrawPictureAsync(const BPicture* a_picture);
453 			void			DrawPictureAsync(const BPicture* a_picture, BPoint where);
454 			void			DrawPictureAsync(const char* filename, long offset,
455 											 BPoint where);
456 
457 			status_t		SetEventMask(uint32 mask, uint32 options=0);
458 			uint32			EventMask();
459 			status_t		SetMouseEventMask(uint32 mask, uint32 options=0);
460 
461 	virtual	void			SetFlags(uint32 flags);
462 			uint32			Flags() const;
463 	virtual	void			SetResizingMode(uint32 mode);
464 			uint32			ResizingMode() const;
465 			void			MoveBy(float dh, float dv);
466 			void			MoveTo(BPoint where);
467 			void			MoveTo(float x, float y);
468 			void			ResizeBy(float dh, float dv);
469 			void			ResizeTo(float width, float height);
470 			void			ResizeTo(BSize size);
471 			void			ScrollBy(float dh, float dv);
472 			void			ScrollTo(float x, float y);
473 	virtual	void			ScrollTo(BPoint where);
474 	virtual	void			MakeFocus(bool focusState = true);
475 			bool			IsFocus() const;
476 
477 	virtual	void			Show();
478 	virtual	void			Hide();
479 			bool			IsHidden() const;
480 			bool			IsHidden(const BView* looking_from) const;
481 
482 			void			Flush() const;
483 			void			Sync() const;
484 
485 	virtual	void			GetPreferredSize(float* width, float* height);
486 	virtual	void			ResizeToPreferred();
487 
488 			BScrollBar*		ScrollBar(orientation posture) const;
489 
490 	virtual BHandler*		ResolveSpecifier(BMessage* msg,
491 											 int32 index,
492 											 BMessage* specifier,
493 											 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 d, void* arg);
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		Alignment();
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 
536 			BLayoutContext*	LayoutContext() const;
537 
538 			void			Layout(bool force);
539 			void			Relayout();
540 
541 protected:
542 	virtual	void			DoLayout();
543 
544 private:
545 			void			_Layout(bool force, BLayoutContext* context);
546 
547 private:
548 	struct LayoutData;
549 
550 	friend class BBitmap;
551 	friend class BLayout;
552 	friend class BPrintJob;
553 	friend class BScrollBar;
554 	friend class BShelf;
555 	friend class BTabView;
556 	friend class BWindow;
557 
558 	virtual	void			_ReservedView11();
559 	virtual	void			_ReservedView12();
560 	virtual	void			_ReservedView13();
561 	virtual	void			_ReservedView14();
562 	virtual	void			_ReservedView15();
563 	virtual	void			_ReservedView16();
564 
565 							BView(const BView&);
566 			BView&			operator=(const BView&);
567 
568 			void			_InitData(BRect frame, const char* name,
569 								uint32 resizeMask, uint32 flags);
570 			status_t		_SetViewBitmap(const BBitmap* bitmap,
571 								BRect srcRect, BRect dstRect,
572 								uint32 followFlags, uint32 options);
573 			void			_ClipToPicture(BPicture* picture, BPoint where,
574 								bool invert, bool sync);
575 
576 			bool			_CheckOwnerLockAndSwitchCurrent() const;
577 			bool			_CheckOwnerLock() const;
578 			void			_CheckLockAndSwitchCurrent() const;
579 			void			_CheckLock() const;
580 			void			_SwitchServerCurrentView() const;
581 
582 			void			_SetOwner(BWindow* newOwner);
583 			void			_RemoveCommArray();
584 
585 			BShelf*			_Shelf() const;
586 			void			_SetShelf(BShelf* shelf);
587 
588 			void			_MoveTo(int32 x, int32 y);
589 			void			_ResizeBy(int32 deltaWidth, int32 deltaHeight);
590 			void			_ParentResizedBy(int32 deltaWidth,
591 								int32 deltaHeight);
592 
593 			void			_ConvertToScreen(BPoint* pt, bool checkLock) const;
594 			void			_ConvertFromScreen(BPoint* pt, bool checkLock) const;
595 
596 			void			_ConvertToParent(BPoint* pt, bool checkLock) const;
597 			void			_ConvertFromParent(BPoint* pt, bool checkLock) const;
598 
599 
600 			void			_Activate(bool state);
601 			void			_Attach();
602 			void			_Detach();
603 			void			_Draw(BRect screenUpdateRect);
604 			void			_DrawAfterChildren(BRect screenUpdateRect);
605 			void			_Pulse();
606 
607 			void			_UpdateStateForRemove();
608 			void			_UpdatePattern(::pattern pattern);
609 
610 			void			_FlushIfNotInTransaction();
611 
612 			bool			_CreateSelf();
613 			bool			_AddChildToList(BView* child, BView* before = NULL);
614 			bool			_RemoveChildFromList(BView* child);
615 
616 			bool			_AddChild(BView *child, BView *before);
617 			bool			_RemoveSelf();
618 
619 			// Debugging methods
620 			void 			_PrintToStream();
621 			void			_PrintTree();
622 
623 			int32			server_token;
624 			uint32			fFlags;
625 			BPoint			fParentOffset;
626 			BWindow*		fOwner;
627 			BView*			fParent;
628 			BView*			fNextSibling;
629 			BView*			fPreviousSibling;
630 			BView*			fFirstChild;
631 
632 			int16 			fShowLevel;
633 			bool			fTopLevelView;
634 			bool			fNoISInteraction;
635 			BPicture*		cpicture;
636 			_array_data_*	comm;
637 
638 			BScrollBar*		fVerScroller;
639 			BScrollBar*		fHorScroller;
640 			bool			f_is_printing;
641 			bool			fAttached;
642 			bool			_unused_bool1;
643 			bool			_unused_bool2;
644 			BPrivate::ViewState*	fState;
645 			BRect			fBounds;
646 			BShelf*			fShelf;
647 			uint32			fEventMask;
648 			uint32			fEventOptions;
649 			uint32			fMouseEventOptions;
650 
651 			LayoutData*		fLayoutData;
652 
653 			uint32			_reserved[7];
654 };
655 
656 
657 // inline definitions ----------------------------------------------------------
658 
659 inline void
660 BView::ScrollTo(float x, float y)
661 {
662 	ScrollTo(BPoint(x, y));
663 }
664 
665 inline void
666 BView::SetViewColor(uchar r, uchar g, uchar b, uchar a)
667 {
668 	rgb_color color;
669 	color.red = r;		color.green = g;
670 	color.blue = b;		color.alpha = a;
671 	SetViewColor(color);
672 }
673 
674 inline void
675 BView::SetHighColor(uchar r, uchar g, uchar b, uchar a)
676 {
677 	rgb_color color;
678 	color.red = r;		color.green = g;
679 	color.blue = b;		color.alpha = a;
680 	SetHighColor(color);
681 }
682 
683 inline void
684 BView::SetLowColor(uchar r, uchar g, uchar b, uchar a)
685 {
686 	rgb_color color;
687 	color.red = r;		color.green = g;
688 	color.blue = b;		color.alpha = a;
689 	SetLowColor(color);
690 }
691 
692 #endif	// _VIEW_H
693