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