1 //------------------------------------------------------------------------------ 2 // Copyright (c) 2002-2004, OpenBeOS 3 // 4 // Permission is hereby granted, free of charge, to any person obtaining a 5 // copy of this software and associated documentation files (the "Software"), 6 // to deal in the Software without restriction, including without limitation 7 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 // and/or sell copies of the Software, and to permit persons to whom the 9 // Software is furnished to do so, subject to the following conditions: 10 // 11 // The above copyright notice and this permission notice shall be included in 12 // all copies or substantial portions of the Software. 13 // 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 // DEALINGS IN THE SOFTWARE. 21 // 22 // File Name: PrivateScreen.h 23 // Author: Stefano Ceccherini (burton666@libero.it) 24 // Description: BPrivateScreen is the class which does the real work 25 // for the proxy class BScreen (it interacts with the app server). 26 //------------------------------------------------------------------------------ 27 28 #ifndef __PRIVATESCREEN_H 29 #define __PRIVATESCREEN_H 30 31 #include <Accelerant.h> 32 #include <GraphicsDefs.h> 33 34 struct screen_desc; 35 class BApplication; 36 class BWindow; 37 38 class BPrivateScreen 39 { 40 // Constructor and destructor are private. Use the static methods 41 // CheckOut() and Return() instead. 42 public: 43 static BPrivateScreen* CheckOut(BWindow *win); 44 static BPrivateScreen* CheckOut(screen_id id); 45 static void Return(BPrivateScreen *screen); 46 47 status_t SetToNext(); 48 49 color_space ColorSpace(); 50 BRect Frame(); 51 screen_id ID(); 52 53 status_t WaitForRetrace(bigtime_t timeout); 54 sem_id RetraceSemaphore(); 55 56 uint8 IndexForColor(uint8 red, uint8 green, uint8 blue, uint8 alpha); 57 rgb_color ColorForIndex(const uint8 index); 58 uint8 InvertIndex(uint8 index); 59 60 const color_map *ColorMap(); 61 62 status_t GetBitmap(BBitmap **bitmap, bool drawCursor, BRect *bound); 63 status_t ReadBitmap(BBitmap *bitmap, bool drawCursor, BRect *bound); 64 65 rgb_color DesktopColor(uint32 index); 66 void SetDesktopColor(rgb_color, uint32, bool); 67 68 status_t ProposeMode(display_mode *target, const display_mode *low, const display_mode *high); 69 70 status_t GetModeList(display_mode **mode_list, uint32 *count); 71 status_t GetMode(uint32 workspace, display_mode *mode); 72 status_t SetMode(uint32 workspace, display_mode *mode, bool makeDefault); 73 status_t GetDeviceInfo(accelerant_device_info *info); 74 status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high); 75 status_t GetTimingConstraints(display_timing_constraints *dtc); 76 status_t SetDPMS(uint32 dpmsState); 77 uint32 DPMSState(); 78 uint32 DPMSCapabilites(); 79 80 void* BaseAddress(); 81 uint32 BytesPerRow(); 82 83 status_t get_screen_desc(screen_desc *desc); 84 85 private: 86 87 friend class BApplication; 88 89 color_map *fColorMap; 90 sem_id fRetraceSem; 91 bool fOwnsColorMap; 92 93 BPrivateScreen(); 94 ~BPrivateScreen(); 95 }; 96 97 #endif // __PRIVATESCREEN_H 98