root/juggler/tags/1.0.7/Kernel/vjDisplayManager.h
| Revision 8789, 5.9 kB (checked in by patrickh, 7 years ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | /*************** <auto-copyright.pl BEGIN do not edit this line> ************** |
| 2 | * |
| 3 | * VR Juggler is (C) Copyright 1998, 1999, 2000, 2001, 2002 |
| 4 | * by Iowa State University |
| 5 | * |
| 6 | * Original Authors: |
| 7 | * Allen Bierbaum, Christopher Just, |
| 8 | * Patrick Hartling, Kevin Meinert, |
| 9 | * Carolina Cruz-Neira, Albert Baker |
| 10 | * |
| 11 | * This library is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU Library General Public |
| 13 | * License as published by the Free Software Foundation; either |
| 14 | * version 2 of the License, or (at your option) any later version. |
| 15 | * |
| 16 | * This library is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 19 | * Library General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU Library General Public |
| 22 | * License along with this library; if not, write to the |
| 23 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 24 | * Boston, MA 02111-1307, USA. |
| 25 | * |
| 26 | * ----------------------------------------------------------------- |
| 27 | * File: $RCSfile$ |
| 28 | * Date modified: $Date$ |
| 29 | * Version: $Revision$ |
| 30 | * ----------------------------------------------------------------- |
| 31 | * |
| 32 | *************** <auto-copyright.pl END do not edit this line> ***************/ |
| 33 | |
| 34 | |
| 35 | #ifndef _VJ_DISPLAY_MANAGER_ |
| 36 | #define _VJ_DISPLAY_MANAGER_ |
| 37 | //#pragma once |
| 38 | |
| 39 | #include <vjConfig.h> |
| 40 | |
| 41 | class vjDrawManager; |
| 42 | class vjDisplay; |
| 43 | |
| 44 | #include <Input/vjPosition/vjPosition.h> |
| 45 | #include <Kernel/vjDebug.h> |
| 46 | #include <Input/InputManager/vjPosInterface.h> |
| 47 | #include <Kernel/vjConfigChunkHandler.h> |
| 48 | #include <Utils/vjSingleton.h> |
| 49 | |
| 50 | |
| 51 | //----------------------------------------------------------------------------- |
| 52 | //: Singleton Container class for all vjDisplays. |
| 53 | // |
| 54 | // PURPOSE: |
| 55 | // This class is responsible for holding the data about display aspects |
| 56 | // of the application. The display object are window/system independant |
| 57 | // this class is in charge of holding all the display data and keeping it |
| 58 | // current. This includes updating projections, adding/deleting new displays, etc. |
| 59 | // |
| 60 | // @author Allen Bierbaum |
| 61 | // Date: 9-7-97 |
| 62 | //----------------------------------------------------------------------------- |
| 63 | class vjDisplayManager : public vjConfigChunkHandler |
| 64 | { |
| 65 | public: // --- Config stuff -- // |
| 66 | //: Add the chunk to the configuration |
| 67 | //! PRE: configCanHandle(chunk) == true |
| 68 | virtual bool configAdd(vjConfigChunk* chunk); |
| 69 | |
| 70 | //: Remove the chunk from the current configuration |
| 71 | //! PRE: configCanHandle(chunk) == true |
| 72 | virtual bool configRemove(vjConfigChunk* chunk); |
| 73 | |
| 74 | //: Can the handler handle the given chunk? |
| 75 | //! RETURNS: true - Can handle it |
| 76 | //+ false - Can't handle it |
| 77 | virtual bool configCanHandle(vjConfigChunk* chunk); |
| 78 | |
| 79 | public: |
| 80 | //: This function updates the projections for all contained displays. |
| 81 | // It also tells the draw manager that the projections have changed |
| 82 | virtual void updateProjections(); |
| 83 | |
| 84 | //: Set the draw manager that the system is running |
| 85 | // We need to know this in order to notify the draw |
| 86 | // manager of any display changes |
| 87 | //! POST: draw manager is notified of any displays currently configured |
| 88 | void setDrawManager(vjDrawManager* drawMgr); |
| 89 | |
| 90 | //: Return a list of the current displays |
| 91 | //! NOTE: DO NOT EDIT THE DISPLAYS |
| 92 | std::vector<vjDisplay*> getActiveDisplays() |
| 93 | { return mActiveDisplays;} |
| 94 | |
| 95 | //: Return list of inactive displays |
| 96 | //! NOTE: DO NOT EDIT THE DISPLAYS |
| 97 | std::vector<vjDisplay*> getInActiveDisplays() |
| 98 | { return mInactiveDisplays;} |
| 99 | |
| 100 | //: Return list of all displays (inactive and active) |
| 101 | //! NOTE: DO NOT EDIT THE DISPLAYS |
| 102 | std::vector<vjDisplay*> getAllDisplays(); |
| 103 | |
| 104 | vjConfigChunk* getDisplaySystemChunk() |
| 105 | {return mDisplaySystemChunk;} |
| 106 | |
| 107 | private: |
| 108 | //: Add the chunk to the configuration |
| 109 | //! PRE: configCanHandle(chunk) == true |
| 110 | //! POST: (display of same name already loaded) ==> old display closed, new one opened |
| 111 | //+ (display is new) ==> (new display is added) |
| 112 | //+ draw manager is notified of the display change |
| 113 | bool configAddDisplay(vjConfigChunk* chunk); |
| 114 | |
| 115 | //: Remove the chunk from the current configuration |
| 116 | //! PRE: configCanHandle(chunk) == true |
| 117 | //!RETURNS: success |
| 118 | bool configRemoveDisplay(vjConfigChunk* chunk); |
| 119 | |
| 120 | |
| 121 | //: Add a display to the current system |
| 122 | //! PRE: disp is a valid display |
| 123 | //! POST: disp has been added to the list of displays |
| 124 | //+ (notifyDrawMgr == true) && (drawMgr != NULL) && (disp is active) |
| 125 | //+ ==> Draw manager now has been given new window to display |
| 126 | int addDisplay(vjDisplay* disp, bool notifyDrawMgr = true); |
| 127 | |
| 128 | //: Close the given display |
| 129 | //! PRE: disp is a display we know about |
| 130 | //! POST: disp has been removed from the list of displays |
| 131 | //+ (notifyDrawMgr == true) && (drawMgr != NULL) && (disp is active) |
| 132 | //+ ==> Draw manager has been told to clode the window for the display |
| 133 | int closeDisplay(vjDisplay* disp, bool notifyDrawMgr = true); |
| 134 | |
| 135 | // Is the display a member of the display manager |
| 136 | bool isMemberDisplay(vjDisplay* disp); |
| 137 | |
| 138 | //: Find a display given the display name |
| 139 | //! RETURNS: NULL - not found |
| 140 | vjDisplay* findDisplayNamed(std::string name); |
| 141 | |
| 142 | public: |
| 143 | std::vector<vjDisplay*> mActiveDisplays; //: List of currently active displays |
| 144 | std::vector<vjDisplay*> mInactiveDisplays; //: List of currently inactive displays |
| 145 | |
| 146 | protected: |
| 147 | vjDrawManager* mDrawManager; //: The current drawManager to communicate with |
| 148 | vjConfigChunk* mDisplaySystemChunk; //: Config chunk for the displaySystem |
| 149 | |
| 150 | |
| 151 | |
| 152 | protected: |
| 153 | vjDisplayManager() : mDrawManager(NULL) |
| 154 | { |
| 155 | mDisplaySystemChunk = NULL; |
| 156 | } |
| 157 | |
| 158 | virtual ~vjDisplayManager() |
| 159 | {;} |
| 160 | |
| 161 | vjSingletonHeader(vjDisplayManager); |
| 162 | /* |
| 163 | // ---- Singleton stuff ---- // |
| 164 | public: |
| 165 | static vjDisplayManager* instance() |
| 166 | { |
| 167 | if (_instance == NULL) |
| 168 | _instance = new vjDisplayManager(); |
| 169 | return _instance; |
| 170 | } |
| 171 | |
| 172 | |
| 173 | private: |
| 174 | static vjDisplayManager* _instance;' |
| 175 | */ |
| 176 | }; |
| 177 | |
| 178 | #endif |
Note: See TracBrowser for help on using the browser.
