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