1 /* 2 * Copyright 2003-2008, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Adrian Oanca <adioanca@cotty.iren.ro> 7 * Axel Dörfler, axeld@pinc-software.de 8 */ 9 #ifndef VIEW_PRIVATE_H 10 #define VIEW_PRIVATE_H 11 12 13 #include <Font.h> 14 #include <InterfaceDefs.h> 15 #include <Point.h> 16 #include <Rect.h> 17 #include <Region.h> 18 19 const static uint32 kDeleteReplicant = 'JAHA'; 20 21 const static uint32 kWorkspacesViewFlag = 0x40000000UL; 22 // was/is _B_RESERVED1_ in View.h 23 24 enum { 25 B_VIEW_FONT_BIT = 0x00000001, 26 B_VIEW_HIGH_COLOR_BIT = 0x00000002, 27 B_VIEW_DRAWING_MODE_BIT = 0x00000004, 28 B_VIEW_CLIP_REGION_BIT = 0x00000008, 29 B_VIEW_LINE_MODES_BIT = 0x00000010, 30 B_VIEW_BLENDING_BIT = 0x00000020, 31 B_VIEW_SCALE_BIT = 0x00000040, 32 B_VIEW_FONT_ALIASING_BIT = 0x00000080, 33 B_VIEW_FRAME_BIT = 0x00000100, 34 B_VIEW_ORIGIN_BIT = 0x00000200, 35 B_VIEW_PEN_SIZE_BIT = 0x00000400, 36 B_VIEW_PEN_LOCATION_BIT = 0x00000800, 37 B_VIEW_LOW_COLOR_BIT = 0x00008000, 38 B_VIEW_VIEW_COLOR_BIT = 0x00010000, 39 B_VIEW_PATTERN_BIT = 0x00020000, 40 41 B_VIEW_ALL_BITS = 0x0003ffff, 42 43 // these used for archiving only 44 B_VIEW_RESIZE_BIT = 0x00001000, 45 B_VIEW_FLAGS_BIT = 0x00002000, 46 B_VIEW_EVENT_MASK_BIT = 0x00004000 47 }; 48 49 50 namespace BPrivate { 51 52 class PortLink; 53 54 class ViewState { 55 public: 56 ViewState(); 57 58 inline bool IsValid(uint32 bit) const; 59 inline bool IsAllValid() const; 60 61 void UpdateServerFontState(BPrivate::PortLink &link); 62 void UpdateServerState(BPrivate::PortLink &link); 63 64 void UpdateFrom(BPrivate::PortLink &link); 65 66 public: 67 BPoint pen_location; 68 float pen_size; 69 70 rgb_color high_color; 71 rgb_color low_color; 72 73 // This one is not affected by pop state/push state 74 rgb_color view_color; 75 76 ::pattern pattern; 77 78 ::drawing_mode drawing_mode; 79 BRegion clipping_region; 80 bool clipping_region_used; 81 BPoint origin; 82 83 // line modes 84 join_mode line_join; 85 cap_mode line_cap; 86 float miter_limit; 87 88 // alpha blending 89 source_alpha alpha_source_mode; 90 alpha_function alpha_function_mode; 91 92 float scale; 93 94 // fonts 95 BFont font; 96 uint16 font_flags; 97 bool font_aliasing; 98 // font aliasing. Used for printing only! 99 100 // flags used for synchronization with app_server 101 uint32 valid_flags; 102 // flags used for archiving 103 uint32 archiving_flags; 104 105 // maintain our own rect as seen from the app while printing 106 BRect print_rect; 107 }; 108 109 inline bool 110 ViewState::IsValid(uint32 bit) const 111 { 112 return valid_flags & bit; 113 } 114 115 inline bool 116 ViewState::IsAllValid() const 117 { 118 return (valid_flags & B_VIEW_ALL_BITS & ~B_VIEW_CLIP_REGION_BIT) 119 == (B_VIEW_ALL_BITS & ~B_VIEW_CLIP_REGION_BIT); 120 } 121 122 } // namespace BPrivate 123 124 struct _array_hdr_{ 125 float startX; 126 float startY; 127 float endX; 128 float endY; 129 rgb_color color; 130 }; 131 132 struct _array_data_{ 133 // the max number of points in the array 134 uint32 maxCount; 135 // the current number of points in the array 136 uint32 count; 137 // the array of points 138 _array_hdr_* array; 139 }; 140 141 #endif /* VIEW_PRIVATE_H */ 142