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