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