1 /*---------------------------------------------------------------------------* 2 3 Copyright (C) 2010-2012 Nintendo. All rights reserved. 4 5 These coded instructions, statements, and computer programs contain 6 proprietary information of Nintendo of America Inc. and/or Nintendo 7 Company Ltd., and are protected by Federal copyright law. They may 8 not be disclosed to third parties or copied or duplicated in any form, 9 in whole or in part, without the prior written consent of Nintendo. 10 11 *---------------------------------------------------------------------------*/ 12 13 #ifndef __DEMOWIN_WINDOW_MANAGER_H_ 14 #define __DEMOWIN_WINDOW_MANAGER_H_ 15 16 struct Peripheral; 17 18 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 19 // The manager that holds a set of windows 20 struct WindowManager 21 { 22 // Initialization of a manager 23 WindowManager(Peripheral* peripheral, GX2Texture** textureList = NULL, float screenWidth = 1.7777778); 24 25 void SetPeripheral(Peripheral* peripheral); 26 void SetTextureList(GX2Texture** textureList); 27 void SetScreenWidth(float screenWidth); 28 29 void Draw(); 30 void Update(bool canBeOver); 31 void BringWindowToFront(Window* window); 32 void AddToWindowList(Window* window); 33 void RemoveFromWindowList(Window* window); 34 35 // Functions to get the textures, in case they get changed at some point 36 GX2Texture** GetTexture(CWTextures num); 37 GX2Texture** GetTextureList(); 38 GetWindowListWindowManager39 const std::vector<Window*>& GetWindowList() {return windowList;} GetWindowOrderWindowManager40 const std::vector<int>& GetWindowOrder() {return windowOrder;} 41 42 // The interface to the TV or DRC 43 Peripheral* peripheral; 44 45 private: 46 47 // The width of the screen divided by the height of the screen (in pixels) 48 float screenWidth; 49 50 // The list of textures used by this manager 51 GX2Texture* textureList[CW_NUM_TEXTURES]; 52 53 // Various variables to handle window movement 54 std::vector<int> windowOrder; 55 std::vector<Window*> windowList; 56 int windowOver; 57 int windowActive; 58 bool windowDragging; 59 float oldWindowX; 60 float oldWindowY; 61 62 // How long the cursor has been held 63 int cursorTime; 64 65 // To know where we are tabbing 66 TabObject* tabIndex; 67 int tabSubIndex; 68 69 // For tabbing that cannot be done generically 70 int tabX; 71 int tabY; 72 73 // Tabbing starts from the dummy window and goes to the next window 74 Window dummyWindow; 75 76 // If something is in front of the custom window manager, this will let us know! 77 bool canBeOver; 78 79 // Internally ensures the front window is in front 80 void BringWindowToFront(); 81 82 // For updating the input 83 void UpdateInput(); 84 void UpdateCursor(); 85 86 // Handles updating and drawing the windows 87 bool UpdateCloseButton(Window* window); 88 void DrawCloseButton(Window* window); 89 90 // Handles tabbing 91 void UpdateTabbing(); 92 void ForceValidTabForward(); 93 void ForceValidTabBack(); 94 95 friend MenuItem; 96 friend Peripheral; 97 }; 98 99 #include "demowin_peripheral.h" 100 101 #endif 102