1 /* 2 Open Tracker License 3 4 Terms and Conditions 5 6 Copyright (c) 1991-2000, Be Incorporated. All rights reserved. 7 8 Permission is hereby granted, free of charge, to any person obtaining a copy of 9 this software and associated documentation files (the "Software"), to deal in 10 the Software without restriction, including without limitation the rights to 11 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 of the Software, and to permit persons to whom the Software is furnished to do 13 so, subject to the following conditions: 14 15 The above copyright notice and this permission notice applies to all licensees 16 and shall be included in all copies or substantial portions of the Software. 17 18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY, 20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 22 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION 23 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 25 Except as contained in this notice, the name of Be Incorporated shall not be 26 used in advertising or otherwise to promote the sale, use or other dealings in 27 this Software without prior written authorization from Be Incorporated. 28 29 Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks 30 of Be Incorporated in the United States and other countries. Other brand product 31 names are registered trademarks or trademarks of their respective holders. 32 All rights reserved. 33 */ 34 35 // Classes used for setting up and managing background images 36 // 37 38 #ifndef __BACKGROUND_IMAGE__ 39 #define __BACKGROUND_IMAGE__ 40 41 #include <String.h> 42 #include "ObjectList.h" 43 44 class BNode; 45 class BView; 46 class BBitmap; 47 48 namespace BPrivate { 49 50 class BackgroundImage; 51 class BPoseView; 52 53 extern const char *kBackgroundImageInfo; 54 extern const char *kBackgroundImageInfoOffset; 55 extern const char *kBackgroundImageInfoEraseText; 56 extern const char *kBackgroundImageInfoMode; 57 extern const char *kBackgroundImageInfoWorkspaces; 58 extern const char *kBackgroundImageInfoPath; 59 60 const uint32 kRestoreBackgroundImage = 'Tbgr'; 61 62 class BackgroundImage { 63 // This class knows everything about which bitmap to use for a given 64 // view and how. 65 // Unlike other windows, the Desktop window can have different backgrounds 66 // for each workspace 67 public: 68 69 enum Mode { 70 kAtOffset, 71 kCentered, // only works on Desktop 72 kScaledToFit, // only works on Desktop 73 kTiled 74 }; 75 76 class BackgroundImageInfo { 77 // element of the per-workspace list 78 public: 79 BackgroundImageInfo(uint32 workspace, BBitmap *bitmap, Mode mode, BPoint offset, 80 bool eraseTextWidget); 81 ~BackgroundImageInfo(); 82 83 uint32 fWorkspace; 84 BBitmap *fBitmap; 85 Mode fMode; 86 BPoint fOffset; 87 bool fEraseTextWidgetBackground; 88 }; 89 90 static BackgroundImage *GetBackgroundImage(const BNode *, bool isDesktop); 91 // create a BackgroundImage object by reading it from a node 92 virtual ~BackgroundImage(); 93 94 void Show(BView *view, int32 workspace); 95 // display the right background for a given workspace 96 void Remove(); 97 // remove the background from it's current view 98 99 void WorkspaceActivated(BView *view, int32 workspace, bool state); 100 // respond to a workspace change 101 void ScreenChanged(BRect , color_space); 102 // respond to a screen size change 103 static BackgroundImage *Refresh(BackgroundImage *oldBackgroundImage, 104 const BNode *fromNode, bool desktop, BPoseView *poseView); 105 // respond to a background image setting change 106 107 private: 108 BackgroundImageInfo *ImageInfoForWorkspace(int32) const; 109 void Show(BackgroundImageInfo *, BView *view); 110 111 BackgroundImage(const BNode *, bool); 112 // no public constructor, GetBackgroundImage factory function is 113 // used instead 114 115 void Add(BackgroundImageInfo *); 116 117 bool fIsDesktop; 118 BNode fDefinedByNode; 119 BView *fView; 120 BackgroundImageInfo *fShowingBitmap; 121 122 BObjectList<BackgroundImageInfo> fBitmapForWorkspaceList; 123 }; 124 125 126 } // namespace BPrivate 127 128 using namespace BPrivate; 129 130 #endif 131