xref: /haiku/headers/os/interface/View.h (revision b06a48ab8f30b45916a9c157b992827779182163)
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 	// new in Haiku (unless this flag is
48 	// specified, both BWindow and BView::GetMouse()
49 	// will filter out older mouse moved messages)
50 	B_FULL_POINTER_HISTORY		= 0x00000008
51 };
52 
53 enum {
54 	B_TRACK_WHOLE_RECT,
55 	B_TRACK_RECT_CORNER
56 };
57 
58 // bitmap drawing options
59 enum {
60 	B_FILTER_BITMAP_BILINEAR	= 0x00000001,
61 		// TODO: Make this simply "SMOOTH_SCALE" and use
62 		// better quality methods the faster the computer?
63 };
64 
65 // set font mask
66 enum {
67 	B_FONT_FAMILY_AND_STYLE		= 0x00000001,
68 	B_FONT_SIZE					= 0x00000002,
69 	B_FONT_SHEAR				= 0x00000004,
70 	B_FONT_ROTATION				= 0x00000008,
71 	B_FONT_SPACING     			= 0x00000010,
72 	B_FONT_ENCODING				= 0x00000020,
73 	B_FONT_FACE					= 0x00000040,
74 	B_FONT_FLAGS				= 0x00000080,
75 	B_FONT_FALSE_BOLD_WIDTH		= 0x00000100,
76 	B_FONT_ALL					= 0x000001FF
77 };
78 
79 // view flags
80 const uint32 B_FULL_UPDATE_ON_RESIZE 	= 0x80000000UL;	/* 31 */
81 const uint32 _B_RESERVED1_ 				= 0x40000000UL;	/* 30 */
82 const uint32 B_WILL_DRAW 				= 0x20000000UL;	/* 29 */
83 const uint32 B_PULSE_NEEDED 			= 0x10000000UL;	/* 28 */
84 const uint32 B_NAVIGABLE_JUMP 			= 0x08000000UL;	/* 27 */
85 const uint32 B_FRAME_EVENTS				= 0x04000000UL;	/* 26 */
86 const uint32 B_NAVIGABLE 				= 0x02000000UL;	/* 25 */
87 const uint32 B_SUBPIXEL_PRECISE 		= 0x01000000UL;	/* 24 */
88 const uint32 B_DRAW_ON_CHILDREN 		= 0x00800000UL;	/* 23 */
89 const uint32 B_INPUT_METHOD_AWARE 		= 0x00400000UL;	/* 23 */
90 const uint32 _B_RESERVED7_ 				= 0x00200000UL;	/* 22 */
91 const uint32 B_SUPPORTS_LAYOUT			= 0x00100000UL;	/* 21 */
92 const uint32 B_INVALIDATE_AFTER_LAYOUT	= 0x00080000UL;	/* 20 */
93 
94 #define _RESIZE_MASK_ (0xffff)
95 
96 const uint32 _VIEW_TOP_ 	= 1UL;
97 const uint32 _VIEW_LEFT_ 	= 2UL;
98 const uint32 _VIEW_BOTTOM_ 	= 3UL;
99 const uint32 _VIEW_RIGHT_ 	= 4UL;
100 const uint32 _VIEW_CENTER_ 	= 5UL;
101 
102 inline uint32 _rule_(uint32 r1, uint32 r2, uint32 r3, uint32 r4)
103 	{ return ((r1 << 12) | (r2 << 8) | (r3 << 4) | r4); }
104 
105 #define B_FOLLOW_NONE 0
106 #define B_FOLLOW_ALL_SIDES	_rule_(_VIEW_TOP_, _VIEW_LEFT_, _VIEW_BOTTOM_, _VIEW_RIGHT_)
107 #define B_FOLLOW_ALL  		B_FOLLOW_ALL_SIDES
108 
109 #define B_FOLLOW_LEFT		_rule_(0, _VIEW_LEFT_, 0, _VIEW_LEFT_)
110 #define B_FOLLOW_RIGHT		_rule_(0, _VIEW_RIGHT_, 0, _VIEW_RIGHT_)
111 #define B_FOLLOW_LEFT_RIGHT	_rule_(0, _VIEW_LEFT_, 0, _VIEW_RIGHT_)
112 #define B_FOLLOW_H_CENTER	_rule_(0, _VIEW_CENTER_, 0, _VIEW_CENTER_)
113 
114 #define B_FOLLOW_TOP		_rule_(_VIEW_TOP_, 0, _VIEW_TOP_, 0)
115 #define B_FOLLOW_BOTTOM		_rule_(_VIEW_BOTTOM_, 0, _VIEW_BOTTOM_, 0)
116 #define B_FOLLOW_TOP_BOTTOM	_rule_(_VIEW_TOP_, 0, _VIEW_BOTTOM_, 0)
117 #define B_FOLLOW_V_CENTER	_rule_(_VIEW_CENTER_, 0, _VIEW_CENTER_, 0)
118 
119 class BBitmap;
120 class BCursor;
121 class BLayout;
122 class BLayoutContext;
123 class BLayoutItem;
124 class BMessage;
125 class BPicture;
126 class BPolygon;
127 class BRegion;
128 class BScrollBar;
129 class BScrollView;
130 class BShape;
131 class BShelf;
132 class BString;
133 class BWindow;
134 struct _array_data_;
135 struct _array_hdr_;
136 struct overlay_restrictions;
137 
138 namespace BPrivate {
139 	class ViewState;
140 };
141 
142 
143 class BView : public BHandler {
144 public:
145 							BView(const char* name, uint32 flags,
146 								BLayout* layout = NULL);
147 							BView(BRect frame, const char* name,
148 								uint32 resizeMask, uint32 flags);
149 	virtual					~BView();
150 
151 							BView(BMessage* data);
152 	static	BArchivable*	Instantiate(BMessage* data);
153 	virtual	status_t		Archive(BMessage* data, bool deep = true) const;
154 
155 	virtual	void			AttachedToWindow();
156 	virtual	void			AllAttached();
157 	virtual	void			DetachedFromWindow();
158 	virtual	void			AllDetached();
159 
160 	virtual	void			MessageReceived(BMessage* msg);
161 
162 			void			AddChild(BView* child, BView* before = NULL);
163 			bool			AddChild(BLayoutItem* child);
164 			bool			RemoveChild(BView* child);
165 			int32			CountChildren() const;
166 			BView*			ChildAt(int32 index) const;
167 			BView*			NextSibling() const;
168 			BView*			PreviousSibling() const;
169 			bool			RemoveSelf();
170 
171 			BWindow*		Window() const;
172 
173 	virtual	void			Draw(BRect updateRect);
174 	virtual	void			MouseDown(BPoint where);
175 	virtual	void			MouseUp(BPoint where);
176 	virtual	void			MouseMoved(BPoint where, uint32 code,
177 								const BMessage* dragMessage);
178 	virtual	void			WindowActivated(bool state);
179 	virtual	void			KeyDown(const char* bytes, int32 numBytes);
180 	virtual	void			KeyUp(const char* bytes, int32 numBytes);
181 	virtual	void			Pulse();
182 	virtual	void			FrameMoved(BPoint newPosition);
183 	virtual	void			FrameResized(float newWidth, float newHeight);
184 
185 	virtual	void			TargetedByScrollView(BScrollView* scrollView);
186 			void			BeginRectTracking(BRect startRect,
187 								uint32 style = B_TRACK_WHOLE_RECT);
188 			void			EndRectTracking();
189 
190 			void			GetMouse(BPoint* location, uint32* buttons,
191 								bool checkMessageQueue = true);
192 
193 			void			DragMessage(BMessage* message, BRect dragRect,
194 								BHandler* replyTo = NULL);
195 			void			DragMessage(BMessage* message, BBitmap* bitmap,
196 								BPoint offset, BHandler* replyTo = NULL);
197 			void			DragMessage(BMessage* message, BBitmap* bitmap,
198 								drawing_mode dragMode, BPoint offset,
199 								BHandler* replyTo = NULL);
200 
201 			BView*			FindView(const char* name) const;
202 			BView*			Parent() const;
203 			BRect			Bounds() const;
204 			BRect			Frame() const;
205 			void			ConvertToScreen(BPoint* pt) const;
206 			BPoint			ConvertToScreen(BPoint pt) const;
207 			void			ConvertFromScreen(BPoint* pt) const;
208 			BPoint			ConvertFromScreen(BPoint pt) const;
209 			void			ConvertToScreen(BRect* r) const;
210 			BRect			ConvertToScreen(BRect r) const;
211 			void			ConvertFromScreen(BRect* r) const;
212 			BRect			ConvertFromScreen(BRect r) const;
213 			void			ConvertToParent(BPoint* pt) const;
214 			BPoint			ConvertToParent(BPoint pt) const;
215 			void			ConvertFromParent(BPoint* pt) const;
216 			BPoint			ConvertFromParent(BPoint pt) const;
217 			void			ConvertToParent(BRect* r) const;
218 			BRect			ConvertToParent(BRect r) const;
219 			void			ConvertFromParent(BRect* r) const;
220 			BRect			ConvertFromParent(BRect r) const;
221 			BPoint			LeftTop() const;
222 
223 			void			GetClippingRegion(BRegion* region) const;
224 	virtual	void			ConstrainClippingRegion(BRegion* region);
225 			void			ClipToPicture(BPicture* picture,
226 								BPoint where = B_ORIGIN, bool sync = true);
227 			void			ClipToInversePicture(BPicture* picture,
228 								BPoint where = B_ORIGIN, bool sync = true);
229 
230 	virtual	void			SetDrawingMode(drawing_mode mode);
231 			drawing_mode 	DrawingMode() const;
232 
233 			void			SetBlendingMode(source_alpha srcAlpha,
234 								alpha_function alphaFunc);
235 			void	 		GetBlendingMode(source_alpha* srcAlpha,
236 								alpha_function* alphaFunc) const;
237 
238 	virtual	void			SetPenSize(float size);
239 			float			PenSize() const;
240 
241 			void			SetViewCursor(const BCursor* cursor,
242 								bool sync = true);
243 
244 	virtual	void			SetViewColor(rgb_color c);
245 			void			SetViewColor(uchar r, uchar g, uchar b,
246 								uchar a = 255);
247 			rgb_color		ViewColor() const;
248 
249 			void			SetViewBitmap(const BBitmap* bitmap,
250 								BRect srcRect, BRect dstRect,
251 								uint32 followFlags
252 									= B_FOLLOW_TOP | B_FOLLOW_LEFT,
253 								uint32 options = B_TILE_BITMAP);
254 			void			SetViewBitmap(const BBitmap* bitmap,
255 								uint32 followFlags
256 									= B_FOLLOW_TOP | B_FOLLOW_LEFT,
257 								uint32 options = B_TILE_BITMAP);
258 			void			ClearViewBitmap();
259 
260 			status_t		SetViewOverlay(const BBitmap* overlay,
261 								BRect srcRect, BRect dstRect,
262 								rgb_color* colorKey,
263 								uint32 followFlags
264 									= B_FOLLOW_TOP | B_FOLLOW_LEFT,
265 								uint32 options = 0);
266 			status_t		SetViewOverlay(const BBitmap* overlay,
267 								rgb_color* colorKey,
268 								uint32 followFlags
269 									= B_FOLLOW_TOP | B_FOLLOW_LEFT,
270 								uint32 options = 0);
271 			void			ClearViewOverlay();
272 
273 	virtual	void			SetHighColor(rgb_color a_color);
274 			void			SetHighColor(uchar r, uchar g, uchar b,
275 								uchar a = 255);
276 			rgb_color		HighColor() const;
277 
278 	virtual	void			SetLowColor(rgb_color a_color);
279 			void			SetLowColor(uchar r, uchar g, uchar b,
280 								uchar a = 255);
281 			rgb_color		LowColor() const;
282 
283 			void			SetLineMode(cap_mode lineCap, join_mode lineJoin,
284 								float miterLimit = B_DEFAULT_MITER_LIMIT);
285 			join_mode		LineJoinMode() const;
286 			cap_mode		LineCapMode() const;
287 			float			LineMiterLimit() const;
288 
289 			void			SetOrigin(BPoint pt);
290 			void			SetOrigin(float x, float y);
291 			BPoint			Origin() const;
292 
293 			void			PushState();
294 			void			PopState();
295 
296 			void			MovePenTo(BPoint pt);
297 			void			MovePenTo(float x, float y);
298 			void			MovePenBy(float x, float y);
299 			BPoint			PenLocation() const;
300 			void			StrokeLine(BPoint toPt, pattern p = B_SOLID_HIGH);
301 			void			StrokeLine(BPoint a, BPoint b,
302 								pattern p = B_SOLID_HIGH);
303 			void			BeginLineArray(int32 count);
304 			void			AddLine(BPoint a, BPoint b, rgb_color color);
305 			void			EndLineArray();
306 
307 			void			StrokePolygon(const BPolygon* polygon,
308 								bool closed = true, pattern p = B_SOLID_HIGH);
309 			void			StrokePolygon(const BPoint* ptArray, int32 numPts,
310 								bool closed = true, pattern p = B_SOLID_HIGH);
311 			void			StrokePolygon(const BPoint* ptArray, int32 numPts,
312 								BRect bounds, bool closed = true,
313 								pattern p = B_SOLID_HIGH);
314 			void			FillPolygon(const BPolygon* polygon,
315 								pattern p = B_SOLID_HIGH);
316 			void			FillPolygon(const BPoint* ptArray, int32 numPts,
317 								pattern p = B_SOLID_HIGH);
318 			void			FillPolygon(const BPoint* ptArray, int32 numPts,
319 								BRect bounds, pattern p = B_SOLID_HIGH);
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 
330 			void			StrokeRect(BRect r, pattern p = B_SOLID_HIGH);
331 			void			FillRect(BRect r, pattern p = B_SOLID_HIGH);
332 			void			FillRegion(BRegion* region,
333 								pattern p = B_SOLID_HIGH);
334 			void			InvertRect(BRect r);
335 
336 			void			StrokeRoundRect(BRect r, float xRadius,
337 								float yRadius, pattern p = B_SOLID_HIGH);
338 			void			FillRoundRect(BRect r, float xRadius, float yRadius,
339 								pattern p = B_SOLID_HIGH);
340 
341 			void			StrokeEllipse(BPoint center, float xRadius,
342 								float yRadius, pattern p = B_SOLID_HIGH);
343 			void			StrokeEllipse(BRect r, pattern p = B_SOLID_HIGH);
344 			void			FillEllipse(BPoint center, float xRadius,
345 								float yRadius, pattern p = B_SOLID_HIGH);
346 			void			FillEllipse(BRect r, pattern p = B_SOLID_HIGH);
347 
348 			void			StrokeArc(BPoint center, float xRadius,
349 								float yRadius, float startAngle, float arcAngle,
350 								pattern p = B_SOLID_HIGH);
351 			void			StrokeArc(BRect r, float startAngle,
352 								float arcAngle, pattern p = B_SOLID_HIGH);
353 			void			FillArc(BPoint center, float xRadius, float yRadius,
354 								float startAngle, float arcAngle,
355 								pattern p = B_SOLID_HIGH);
356 			void			FillArc(BRect r, float startAngle, float arcAngle,
357 								pattern p = B_SOLID_HIGH);
358 
359 			void			StrokeBezier(BPoint* controlPoints,
360 								pattern p = B_SOLID_HIGH);
361 			void			FillBezier(BPoint* controlPoints,
362 								pattern p = B_SOLID_HIGH);
363 
364 			void			StrokeShape(BShape* shape,
365 								pattern p = B_SOLID_HIGH);
366 			void			FillShape(BShape* shape, pattern p = B_SOLID_HIGH);
367 
368 			void			CopyBits(BRect src, BRect dst);
369 
370 			void			DrawBitmapAsync(const BBitmap* aBitmap,
371 								BRect bitmapRect, BRect viewRect,
372 								uint32 options);
373 			void			DrawBitmapAsync(const BBitmap* aBitmap,
374 								BRect bitmapRect, BRect viewRect);
375 			void			DrawBitmapAsync(const BBitmap* aBitmap,
376 								BRect viewRect);
377 			void			DrawBitmapAsync(const BBitmap* aBitmap,
378 								BPoint where);
379 			void			DrawBitmapAsync(const BBitmap* aBitmap);
380 
381 			void			DrawBitmap(const BBitmap* aBitmap,
382 								BRect bitmapRect, BRect viewRect,
383 								uint32 options);
384 			void			DrawBitmap(const BBitmap* aBitmap,
385 								BRect bitmapRect, BRect viewRect);
386 			void			DrawBitmap(const BBitmap* aBitmap,
387 								BRect viewRect);
388 			void			DrawBitmap(const BBitmap* aBitmap,
389 								BPoint where);
390 			void			DrawBitmap(const BBitmap* aBitmap);
391 
392 			void			DrawChar(char aChar);
393 			void			DrawChar(char aChar, BPoint location);
394 			void			DrawString(const char* aString,
395 								escapement_delta* delta = NULL);
396 			void			DrawString(const char* aString, BPoint location,
397 								escapement_delta* delta = NULL);
398 			void			DrawString(const char* aString, int32 length,
399 								escapement_delta* delta = NULL);
400 			void			DrawString(const char* aString, int32 length,
401 								BPoint location, escapement_delta* delta = 0L);
402 
403 	virtual void            SetFont(const BFont* font,
404 								uint32 mask = B_FONT_ALL);
405 
406 			void            GetFont(BFont* font) const;
407 			void			TruncateString(BString* in_out, uint32 mode,
408 								float width) const;
409 			float			StringWidth(const char* string) const;
410 			float			StringWidth(const char* string, int32 length) const;
411 			void			GetStringWidths(char* stringArray[],
412 								int32 lengthArray[], int32 numStrings,
413 								float widthArray[]) const;
414 			void			SetFontSize(float size);
415 			void			ForceFontAliasing(bool enable);
416 			void			GetFontHeight(font_height* height) const;
417 
418 			void			Invalidate(BRect invalRect);
419 			void			Invalidate(const BRegion* invalRegion);
420 			void			Invalidate();
421 
422 			void			SetDiskMode(char* filename, long offset);
423 
424 			void			BeginPicture(BPicture* a_picture);
425 			void			AppendToPicture(BPicture* a_picture);
426 			BPicture*		EndPicture();
427 
428 			void			DrawPicture(const BPicture* a_picture);
429 			void			DrawPicture(const BPicture* a_picture,
430 								BPoint where);
431 			void			DrawPicture(const char* filename, long offset,
432 								BPoint where);
433 			void			DrawPictureAsync(const BPicture* a_picture);
434 			void			DrawPictureAsync(const BPicture* a_picture,
435 								BPoint where);
436 			void			DrawPictureAsync(const char* filename, long offset,
437 								BPoint where);
438 
439 			status_t		SetEventMask(uint32 mask, uint32 options = 0);
440 			uint32			EventMask();
441 			status_t		SetMouseEventMask(uint32 mask, uint32 options = 0);
442 
443 	virtual	void			SetFlags(uint32 flags);
444 			uint32			Flags() const;
445 	virtual	void			SetResizingMode(uint32 mode);
446 			uint32			ResizingMode() const;
447 			void			MoveBy(float dh, float dv);
448 			void			MoveTo(BPoint where);
449 			void			MoveTo(float x, float y);
450 			void			ResizeBy(float dh, float dv);
451 			void			ResizeTo(float width, float height);
452 			void			ResizeTo(BSize size);
453 			void			ScrollBy(float dh, float dv);
454 			void			ScrollTo(float x, float y);
455 	virtual	void			ScrollTo(BPoint where);
456 	virtual	void			MakeFocus(bool focusState = true);
457 			bool			IsFocus() const;
458 
459 	virtual	void			Show();
460 	virtual	void			Hide();
461 			bool			IsHidden() const;
462 			bool			IsHidden(const BView* looking_from) const;
463 
464 			void			Flush() const;
465 			void			Sync() const;
466 
467 	virtual	void			GetPreferredSize(float* width, float* height);
468 	virtual	void			ResizeToPreferred();
469 
470 			BScrollBar*		ScrollBar(orientation posture) const;
471 
472 	virtual BHandler*		ResolveSpecifier(BMessage* msg, int32 index,
473 								BMessage* specifier, int32 form,
474 								const char* property);
475 	virtual status_t		GetSupportedSuites(BMessage* data);
476 
477 			bool			IsPrinting() const;
478 			void			SetScale(float scale) const;
479 			float			Scale() const;
480 								// new for Haiku
481 
482 	virtual status_t		Perform(perform_code d, void* arg);
483 
484 	virtual	void			DrawAfterChildren(BRect r);
485 
486 
487 			// layout related
488 
489 	virtual	BSize			MinSize();
490 	virtual	BSize			MaxSize();
491 	virtual	BSize			PreferredSize();
492 	virtual	BAlignment		LayoutAlignment();
493 
494 			void			SetExplicitMinSize(BSize size);
495 			void			SetExplicitMaxSize(BSize size);
496 			void			SetExplicitPreferredSize(BSize size);
497 			void			SetExplicitAlignment(BAlignment alignment);
498 
499 			BSize			ExplicitMinSize() const;
500 			BSize			ExplicitMaxSize() const;
501 			BSize			ExplicitPreferredSize() const;
502 			BAlignment		ExplicitAlignment() const;
503 
504 	virtual	bool			HasHeightForWidth();
505 	virtual	void			GetHeightForWidth(float width, float* min,
506 								float* max, float* preferred);
507 
508 	virtual	void			SetLayout(BLayout* layout);
509 			BLayout*		GetLayout() const;
510 
511 	virtual	void			InvalidateLayout(bool descendants = false);
512 			void			EnableLayoutInvalidation();
513 			void			DisableLayoutInvalidation();
514 			bool			IsLayoutValid() const;
515 
516 			BLayoutContext*	LayoutContext() const;
517 
518 			void			Layout(bool force);
519 			void			Relayout();
520 
521 protected:
522 	virtual	void			DoLayout();
523 
524 private:
525 			void			_Layout(bool force, BLayoutContext* context);
526 
527 private:
528 	struct LayoutData;
529 
530 	friend class BBitmap;
531 	friend class BLayout;
532 	friend class BPrintJob;
533 	friend class BScrollBar;
534 	friend class BShelf;
535 	friend class BTabView;
536 	friend class BWindow;
537 
538 	virtual	void			_ReservedView11();
539 	virtual	void			_ReservedView12();
540 	virtual	void			_ReservedView13();
541 	virtual	void			_ReservedView14();
542 	virtual	void			_ReservedView15();
543 	virtual	void			_ReservedView16();
544 
545 							BView(const BView&);
546 			BView&			operator=(const BView&);
547 
548 			void			_InitData(BRect frame, const char* name,
549 								uint32 resizeMask, uint32 flags);
550 			status_t		_SetViewBitmap(const BBitmap* bitmap,
551 								BRect srcRect, BRect dstRect,
552 								uint32 followFlags, uint32 options);
553 			void			_ClipToPicture(BPicture* picture, BPoint where,
554 								bool invert, bool sync);
555 
556 			bool			_CheckOwnerLockAndSwitchCurrent() const;
557 			bool			_CheckOwnerLock() const;
558 			void			_CheckLockAndSwitchCurrent() const;
559 			void			_CheckLock() const;
560 			void			_SwitchServerCurrentView() const;
561 
562 			void			_SetOwner(BWindow* newOwner);
563 			void			_RemoveCommArray();
564 
565 			BShelf*			_Shelf() const;
566 			void			_SetShelf(BShelf* shelf);
567 
568 			void			_MoveTo(int32 x, int32 y);
569 			void			_ResizeBy(int32 deltaWidth, int32 deltaHeight);
570 			void			_ParentResizedBy(int32 deltaWidth,
571 								int32 deltaHeight);
572 
573 			void			_ConvertToScreen(BPoint* pt, bool checkLock) const;
574 			void			_ConvertFromScreen(BPoint* pt,
575 								bool checkLock) const;
576 
577 			void			_ConvertToParent(BPoint* pt, bool checkLock) const;
578 			void			_ConvertFromParent(BPoint* pt,
579 								bool checkLock) const;
580 
581 
582 			void			_Activate(bool state);
583 			void			_Attach();
584 			void			_Detach();
585 			void			_Draw(BRect screenUpdateRect);
586 			void			_DrawAfterChildren(BRect screenUpdateRect);
587 			void			_Pulse();
588 
589 			void			_UpdateStateForRemove();
590 			void			_UpdatePattern(::pattern pattern);
591 
592 			void			_FlushIfNotInTransaction();
593 
594 			bool			_CreateSelf();
595 			bool			_AddChildToList(BView* child, BView* before = NULL);
596 			bool			_RemoveChildFromList(BView* child);
597 
598 			bool			_AddChild(BView *child, BView *before);
599 			bool			_RemoveSelf();
600 
601 			// Debugging methods
602 			void 			_PrintToStream();
603 			void			_PrintTree();
604 
605 			int32			server_token;
606 			uint32			fFlags;
607 			BPoint			fParentOffset;
608 			BWindow*		fOwner;
609 			BView*			fParent;
610 			BView*			fNextSibling;
611 			BView*			fPreviousSibling;
612 			BView*			fFirstChild;
613 
614 			int16 			fShowLevel;
615 			bool			fTopLevelView;
616 			bool			fNoISInteraction;
617 			BPicture*		fCurrentPicture;
618 			_array_data_*	fCommArray;
619 
620 			BScrollBar*		fVerScroller;
621 			BScrollBar*		fHorScroller;
622 			bool			fIsPrinting;
623 			bool			fAttached;
624 			bool			_unused_bool1;
625 			bool			_unused_bool2;
626 			BPrivate::ViewState*	fState;
627 			BRect			fBounds;
628 			BShelf*			fShelf;
629 			uint32			fEventMask;
630 			uint32			fEventOptions;
631 			uint32			fMouseEventOptions;
632 
633 			LayoutData*		fLayoutData;
634 
635 			uint32			_reserved[7];
636 };
637 
638 
639 // inline definitions ----------------------------------------------------------
640 
641 inline void
642 BView::ScrollTo(float x, float y)
643 {
644 	ScrollTo(BPoint(x, y));
645 }
646 
647 inline void
648 BView::SetViewColor(uchar r, uchar g, uchar b, uchar a)
649 {
650 	rgb_color color;
651 	color.red = r;
652 	color.green = g;
653 	color.blue = b;
654 	color.alpha = a;
655 	SetViewColor(color);
656 }
657 
658 inline void
659 BView::SetHighColor(uchar r, uchar g, uchar b, uchar a)
660 {
661 	rgb_color color;
662 	color.red = r;
663 	color.green = g;
664 	color.blue = b;
665 	color.alpha = a;
666 	SetHighColor(color);
667 }
668 
669 inline void
670 BView::SetLowColor(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 	SetLowColor(color);
678 }
679 
680 #endif	// _VIEW_H
681