1621a8324SAxel Dörfler /*
2b617d006SAxel Dörfler * Copyright 2003-2015, Haiku.
3621a8324SAxel Dörfler * Distributed under the terms of the MIT License.
4621a8324SAxel Dörfler *
5621a8324SAxel Dörfler * Authors:
6621a8324SAxel Dörfler * Adrian Oanca <adioanca@cotty.iren.ro>
7621a8324SAxel Dörfler * Axel Dörfler, axeld@pinc-software.de
8621a8324SAxel Dörfler */
9621a8324SAxel Dörfler #ifndef VIEW_PRIVATE_H
10621a8324SAxel Dörfler #define VIEW_PRIVATE_H
11621a8324SAxel Dörfler
12621a8324SAxel Dörfler
13621a8324SAxel Dörfler #include <Font.h>
14621a8324SAxel Dörfler #include <InterfaceDefs.h>
15621a8324SAxel Dörfler #include <Point.h>
16621a8324SAxel Dörfler #include <Rect.h>
17621a8324SAxel Dörfler #include <Region.h>
1812349c7dSStephan Aßmus #include <ServerProtocolStructs.h>
191d6c7b6cSAlex Wilson #include <View.h>
20621a8324SAxel Dörfler
21b617d006SAxel Dörfler
22931aebe9SStefano Ceccherini const static uint32 kDeleteReplicant = 'JAHA';
23621a8324SAxel Dörfler
24f9bbab88SAxel Dörfler const static uint32 kWorkspacesViewFlag = 0x40000000UL;
25f9bbab88SAxel Dörfler // was/is _B_RESERVED1_ in View.h
26f9bbab88SAxel Dörfler
27621a8324SAxel Dörfler enum {
28621a8324SAxel Dörfler B_VIEW_FONT_BIT = 0x00000001,
29621a8324SAxel Dörfler B_VIEW_HIGH_COLOR_BIT = 0x00000002,
30621a8324SAxel Dörfler B_VIEW_DRAWING_MODE_BIT = 0x00000004,
31621a8324SAxel Dörfler B_VIEW_CLIP_REGION_BIT = 0x00000008,
32621a8324SAxel Dörfler B_VIEW_LINE_MODES_BIT = 0x00000010,
33621a8324SAxel Dörfler B_VIEW_BLENDING_BIT = 0x00000020,
34621a8324SAxel Dörfler B_VIEW_SCALE_BIT = 0x00000040,
35621a8324SAxel Dörfler B_VIEW_FONT_ALIASING_BIT = 0x00000080,
36621a8324SAxel Dörfler B_VIEW_FRAME_BIT = 0x00000100,
37621a8324SAxel Dörfler B_VIEW_ORIGIN_BIT = 0x00000200,
38621a8324SAxel Dörfler B_VIEW_PEN_SIZE_BIT = 0x00000400,
39621a8324SAxel Dörfler B_VIEW_PEN_LOCATION_BIT = 0x00000800,
40621a8324SAxel Dörfler B_VIEW_LOW_COLOR_BIT = 0x00008000,
41621a8324SAxel Dörfler B_VIEW_VIEW_COLOR_BIT = 0x00010000,
42621a8324SAxel Dörfler B_VIEW_PATTERN_BIT = 0x00020000,
43a6db6bd4SStephan Aßmus B_VIEW_TRANSFORM_BIT = 0x00040000,
44eb431663SAdrien Destugues B_VIEW_FILL_RULE_BIT = 0x00080000,
457f9368caSlooncraz B_VIEW_WHICH_VIEW_COLOR_BIT = 0x00100000,
467f9368caSlooncraz B_VIEW_WHICH_LOW_COLOR_BIT = 0x00200000,
477f9368caSlooncraz B_VIEW_WHICH_HIGH_COLOR_BIT = 0x00400000,
48*241f109cSMáximo Castañeda B_VIEW_PARENT_COMPOSITE_BIT = 0x00800000,
49621a8324SAxel Dörfler
507f9368caSlooncraz B_VIEW_ALL_BITS = 0x00ffffff,
51621a8324SAxel Dörfler
52621a8324SAxel Dörfler // these used for archiving only
53621a8324SAxel Dörfler B_VIEW_RESIZE_BIT = 0x00001000,
54621a8324SAxel Dörfler B_VIEW_FLAGS_BIT = 0x00002000,
55621a8324SAxel Dörfler B_VIEW_EVENT_MASK_BIT = 0x00004000
56621a8324SAxel Dörfler };
57621a8324SAxel Dörfler
58621a8324SAxel Dörfler
591d6c7b6cSAlex Wilson class BView::Private {
601d6c7b6cSAlex Wilson public:
Private(BView * view)611d6c7b6cSAlex Wilson Private(BView* view)
621d6c7b6cSAlex Wilson :
631d6c7b6cSAlex Wilson fView(view)
641d6c7b6cSAlex Wilson {
651d6c7b6cSAlex Wilson }
661d6c7b6cSAlex Wilson
ShowLevel()671d6c7b6cSAlex Wilson int16 ShowLevel()
68b617d006SAxel Dörfler { return fView->fShowLevel; }
691d6c7b6cSAlex Wilson
701d6c7b6cSAlex Wilson // defined in View.cpp
711d6c7b6cSAlex Wilson bool WillLayout();
721d6c7b6cSAlex Wilson bool MinMaxValid();
731d6c7b6cSAlex Wilson
74bd97b9adSAlex Wilson BLayoutItem* LayoutItemAt(int32 index);
75bd97b9adSAlex Wilson int32 CountLayoutItems();
76bd97b9adSAlex Wilson void RegisterLayoutItem(BLayoutItem* item);
77bd97b9adSAlex Wilson void DeregisterLayoutItem(BLayoutItem* item);
78bd97b9adSAlex Wilson
RemoveSelf()79edb4c824SAlex Wilson bool RemoveSelf()
80b617d006SAxel Dörfler { return fView->_RemoveSelf(); }
81edb4c824SAlex Wilson
82b617d006SAxel Dörfler private:
831d6c7b6cSAlex Wilson BView* fView;
841d6c7b6cSAlex Wilson };
851d6c7b6cSAlex Wilson
861d6c7b6cSAlex Wilson
87621a8324SAxel Dörfler namespace BPrivate {
88621a8324SAxel Dörfler
89b617d006SAxel Dörfler
90f9bbab88SAxel Dörfler class PortLink;
91f9bbab88SAxel Dörfler
92b617d006SAxel Dörfler
93621a8324SAxel Dörfler class ViewState {
94621a8324SAxel Dörfler public:
95621a8324SAxel Dörfler ViewState();
96621a8324SAxel Dörfler
97621a8324SAxel Dörfler inline bool IsValid(uint32 bit) const;
98621a8324SAxel Dörfler inline bool IsAllValid() const;
99621a8324SAxel Dörfler
100621a8324SAxel Dörfler void UpdateServerFontState(BPrivate::PortLink &link);
101621a8324SAxel Dörfler void UpdateServerState(BPrivate::PortLink &link);
102621a8324SAxel Dörfler
103621a8324SAxel Dörfler void UpdateFrom(BPrivate::PortLink &link);
104621a8324SAxel Dörfler
105621a8324SAxel Dörfler public:
106621a8324SAxel Dörfler BPoint pen_location;
107621a8324SAxel Dörfler float pen_size;
108621a8324SAxel Dörfler
109621a8324SAxel Dörfler rgb_color high_color;
110621a8324SAxel Dörfler rgb_color low_color;
111621a8324SAxel Dörfler
112621a8324SAxel Dörfler // This one is not affected by pop state/push state
113621a8324SAxel Dörfler rgb_color view_color;
1147f9368caSlooncraz color_which which_view_color;
1157f9368caSlooncraz float which_view_color_tint;
1167f9368caSlooncraz
1177f9368caSlooncraz // these are cached values
1187f9368caSlooncraz color_which which_low_color;
1197f9368caSlooncraz float which_low_color_tint;
1207f9368caSlooncraz
1217f9368caSlooncraz color_which which_high_color;
1227f9368caSlooncraz float which_high_color_tint;
123621a8324SAxel Dörfler
124621a8324SAxel Dörfler ::pattern pattern;
125621a8324SAxel Dörfler
126621a8324SAxel Dörfler ::drawing_mode drawing_mode;
127621a8324SAxel Dörfler BRegion clipping_region;
128621a8324SAxel Dörfler bool clipping_region_used;
129a6db6bd4SStephan Aßmus
130a6db6bd4SStephan Aßmus // transformation
131621a8324SAxel Dörfler BPoint origin;
132a6db6bd4SStephan Aßmus float scale;
133a6db6bd4SStephan Aßmus BAffineTransform transform;
134621a8324SAxel Dörfler
135*241f109cSMáximo Castañeda // composite transformation stack
136*241f109cSMáximo Castañeda BPoint parent_composite_origin;
137*241f109cSMáximo Castañeda float parent_composite_scale;
138*241f109cSMáximo Castañeda BAffineTransform parent_composite_transform;
139*241f109cSMáximo Castañeda
140621a8324SAxel Dörfler // line modes
141621a8324SAxel Dörfler join_mode line_join;
142621a8324SAxel Dörfler cap_mode line_cap;
143621a8324SAxel Dörfler float miter_limit;
144621a8324SAxel Dörfler
145eb431663SAdrien Destugues // fill rule
146eb431663SAdrien Destugues int32 fill_rule;
147eb431663SAdrien Destugues
148621a8324SAxel Dörfler // alpha blending
149621a8324SAxel Dörfler source_alpha alpha_source_mode;
150621a8324SAxel Dörfler alpha_function alpha_function_mode;
151621a8324SAxel Dörfler
152621a8324SAxel Dörfler // fonts
153621a8324SAxel Dörfler BFont font;
154621a8324SAxel Dörfler uint16 font_flags;
155621a8324SAxel Dörfler bool font_aliasing;
156621a8324SAxel Dörfler // font aliasing. Used for printing only!
157621a8324SAxel Dörfler
158621a8324SAxel Dörfler // flags used for synchronization with app_server
159621a8324SAxel Dörfler uint32 valid_flags;
160621a8324SAxel Dörfler // flags used for archiving
161621a8324SAxel Dörfler uint32 archiving_flags;
162f56301c9SKarsten Heimrich
163f56301c9SKarsten Heimrich // maintain our own rect as seen from the app while printing
164f56301c9SKarsten Heimrich BRect print_rect;
165621a8324SAxel Dörfler };
166621a8324SAxel Dörfler
167b617d006SAxel Dörfler
168621a8324SAxel Dörfler inline bool
IsValid(uint32 bit)169621a8324SAxel Dörfler ViewState::IsValid(uint32 bit) const
170621a8324SAxel Dörfler {
171621a8324SAxel Dörfler return valid_flags & bit;
172621a8324SAxel Dörfler }
173621a8324SAxel Dörfler
174b617d006SAxel Dörfler
175621a8324SAxel Dörfler inline bool
IsAllValid()176621a8324SAxel Dörfler ViewState::IsAllValid() const
177621a8324SAxel Dörfler {
178621a8324SAxel Dörfler return (valid_flags & B_VIEW_ALL_BITS & ~B_VIEW_CLIP_REGION_BIT)
179621a8324SAxel Dörfler == (B_VIEW_ALL_BITS & ~B_VIEW_CLIP_REGION_BIT);
180621a8324SAxel Dörfler }
181621a8324SAxel Dörfler
182b617d006SAxel Dörfler
183621a8324SAxel Dörfler } // namespace BPrivate
184621a8324SAxel Dörfler
185b617d006SAxel Dörfler
186621a8324SAxel Dörfler struct _array_data_{
187621a8324SAxel Dörfler // the max number of points in the array
188621a8324SAxel Dörfler uint32 maxCount;
189621a8324SAxel Dörfler // the current number of points in the array
190621a8324SAxel Dörfler uint32 count;
191621a8324SAxel Dörfler // the array of points
19212349c7dSStephan Aßmus ViewLineArrayInfo* array;
193621a8324SAxel Dörfler };
194621a8324SAxel Dörfler
195b617d006SAxel Dörfler
196621a8324SAxel Dörfler #endif /* VIEW_PRIVATE_H */
197