project64/Source/Project64/UserInterface/MainWindow.h

139 lines
4.3 KiB
C
Raw Normal View History

2016-01-27 09:11:59 +00:00
/****************************************************************************
* *
* Project64 - A Nintendo 64 emulator. *
* http://www.pj64-emu.com/ *
* Copyright (C) 2012 Project64. All rights reserved. *
* *
* License: *
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
* *
****************************************************************************/
#pragma once
#include "../Settings/GuiSettings.h"
#include <Project64/UserInterface/Debugger/debugger.h>
2016-01-27 09:11:59 +00:00
#include <Project64-core/Plugins/PluginClass.h>
#include <Project64\UserInterface\CheatClassUI.h>
2020-10-22 02:11:19 +00:00
#include <Project64\UserInterface\ProjectSupport.h>
2016-01-27 09:11:59 +00:00
class CGfxPlugin; //Plugin that controls the rendering
class CAudioPlugin; //Plugin for audio, need the hwnd
class CControl_Plugin; //Controller needs hwnd to see if it is the focused window
class CBaseMenu; //Menu for the gui
class CN64System;
class CriticalSection;
enum
{
WM_HIDE_CUROSR = WM_USER + 10,
WM_MAKE_FOCUS = WM_USER + 17,
WM_RESET_PLUGIN = WM_USER + 18,
WM_GAME_CLOSED = WM_USER + 19,
WM_BROWSER_TOP = WM_USER + 40,
};
class CMainGui :
public RenderWindow,
public CRomBrowser,
private CGuiSettings
{
enum { StatusBarID = 400 };
enum { Timer_SetWindowPos = 1 };
struct RESET_PLUGIN
{
CN64System * system;
CPlugins * plugins;
HANDLE hEvent;
bool res;
};
public:
CMainGui(bool bMainWindow, const char * WindowTitle = "");
~CMainGui(void);
WPARAM ProcessAllMessages(void);
bool ProcessGuiMessages(void);
void EnterLogOptions(void);
2020-11-09 09:12:30 +00:00
int Height(void);
int Width(void);
float DPIScale(HWND hWnd);
2016-01-27 09:11:59 +00:00
2020-11-09 09:12:30 +00:00
void SetPos(int X, int Y);
void Show(bool ShowWindow);
2016-01-27 09:11:59 +00:00
void MakeWindowOnTop(bool OnTop);
void BringToTop(void);
2020-11-09 09:12:30 +00:00
void Caption(LPCWSTR Caption);
2016-01-27 09:11:59 +00:00
void SaveWindowLoc(void);
void SetWindowMenu(CBaseMenu * Menu);
void RefreshMenu(void);
CBaseMenu * GetMenuClass(void) { return m_Menu; }
void SetStatusText(int Panel, const wchar_t * Text);
void ShowStatusBar(bool ShowBar);
bool ResetPluginsInUiThread(CPlugins * plugins, CN64System * System);
void DisplayCheatsUI(bool BlockExecution);
2016-01-27 09:11:59 +00:00
void * GetWindowHandle(void) const { return m_hMainWindow; }
void * GetStatusBar(void) const { return m_hStatusWnd; }
void * GetModuleInstance(void) const;
2020-10-22 02:11:19 +00:00
inline CProjectSupport & Support(void) { return m_Support; }
2016-01-27 09:11:59 +00:00
private:
2020-10-22 02:11:19 +00:00
CMainGui(void);
CMainGui(const CMainGui&);
CMainGui& operator=(const CMainGui&);
2016-01-27 09:11:59 +00:00
friend class CGfxPlugin;
friend class CAudioPlugin;
friend class CControl_Plugin;
2016-01-27 09:11:59 +00:00
bool RegisterWinClass(void);
void ChangeWinSize(long width, long height);
void Create(const char * WindowTitle);
void CreateStatusBar(void);
void Resize(DWORD fwSizeType, WORD nWidth, WORD nHeight); //responding to WM_SIZE
void AddRecentRom(const char * ImagePath);
void SetWindowCaption(const wchar_t * Caption);
void ShowRomBrowser(void);
static LRESULT CALLBACK MainGui_Proc(HWND, DWORD, DWORD, DWORD);
friend void RomBowserEnabledChanged(CMainGui * Gui);
friend void RomBowserColoumnsChanged(CMainGui * Gui);
friend void RomBrowserListChanged(CMainGui * Gui);
2019-10-23 21:12:12 +00:00
friend void DiscordRPCChanged(CMainGui * Gui);
2016-01-27 09:11:59 +00:00
static void LoadingInProgressChanged(CMainGui * Gui);
static void GameLoaded(CMainGui * Gui);
static void GamePaused(CMainGui * Gui);
static void GameCpuRunning(CMainGui * Gui);
2020-10-22 02:11:19 +00:00
CBaseMenu * m_Menu;
2016-01-27 09:11:59 +00:00
2020-10-22 02:11:19 +00:00
HWND m_hMainWindow, m_hStatusWnd;
DWORD m_ThreadId;
CCheatsUI m_CheatsUI;
CProjectSupport m_Support;
2016-01-27 09:11:59 +00:00
2020-10-22 02:11:19 +00:00
const bool m_bMainWindow;
bool m_Created;
bool m_AttachingMenu;
bool m_MakingVisible;
bool m_ResetPlugins;
2016-01-27 09:11:59 +00:00
RESET_PLUGIN * m_ResetInfo;
CriticalSection m_CS;
2020-10-22 02:11:19 +00:00
bool m_SaveMainWindowPos;
LONG m_SaveMainWindowTop;
LONG m_SaveMainWindowLeft;
2016-01-27 09:11:59 +00:00
2020-10-22 02:11:19 +00:00
bool m_SaveRomBrowserPos;
LONG m_SaveRomBrowserTop;
LONG m_SaveRomBrowserLeft;
2016-01-27 09:11:59 +00:00
};