/*---------------------------------------------------------------------------* Copyright (C) 2010-2012 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. *---------------------------------------------------------------------------*/ #ifndef __DEMOWIN_WINDOW_MANAGER_H_ #define __DEMOWIN_WINDOW_MANAGER_H_ struct Peripheral; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // The manager that holds a set of windows struct WindowManager { // Initialization of a manager WindowManager(Peripheral* peripheral, GX2Texture** textureList = NULL, float screenWidth = 1.7777778); void SetPeripheral(Peripheral* peripheral); void SetTextureList(GX2Texture** textureList); void SetScreenWidth(float screenWidth); void Draw(); void Update(bool canBeOver); void BringWindowToFront(Window* window); void AddToWindowList(Window* window); void RemoveFromWindowList(Window* window); // Functions to get the textures, in case they get changed at some point GX2Texture** GetTexture(CWTextures num); GX2Texture** GetTextureList(); const std::vector& GetWindowList() {return windowList;} const std::vector& GetWindowOrder() {return windowOrder;} // The interface to the TV or DRC Peripheral* peripheral; private: // The width of the screen divided by the height of the screen (in pixels) float screenWidth; // The list of textures used by this manager GX2Texture* textureList[CW_NUM_TEXTURES]; // Various variables to handle window movement std::vector windowOrder; std::vector windowList; int windowOver; int windowActive; bool windowDragging; float oldWindowX; float oldWindowY; // How long the cursor has been held int cursorTime; // To know where we are tabbing TabObject* tabIndex; int tabSubIndex; // For tabbing that cannot be done generically int tabX; int tabY; // Tabbing starts from the dummy window and goes to the next window Window dummyWindow; // If something is in front of the custom window manager, this will let us know! bool canBeOver; // Internally ensures the front window is in front void BringWindowToFront(); // For updating the input void UpdateInput(); void UpdateCursor(); // Handles updating and drawing the windows bool UpdateCloseButton(Window* window); void DrawCloseButton(Window* window); // Handles tabbing void UpdateTabbing(); void ForceValidTabForward(); void ForceValidTabBack(); friend MenuItem; friend Peripheral; }; #include "demowin_peripheral.h" #endif