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