2010-04-25 00:31:27 +00:00
|
|
|
/*
|
2009-02-09 21:15:56 +00:00
|
|
|
* Copyright (C) 2007-2009 Gabest
|
|
|
|
* http://www.gabest.org
|
|
|
|
*
|
|
|
|
* This Program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* This Program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Make; see the file COPYING. If not, write to
|
2012-09-09 18:16:11 +00:00
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
|
2009-02-09 21:15:56 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2009-06-03 12:09:04 +00:00
|
|
|
#include "GSVector.h"
|
|
|
|
|
2011-02-23 09:16:00 +00:00
|
|
|
#ifdef _WINDOWS
|
|
|
|
|
2009-06-03 12:09:04 +00:00
|
|
|
class GSWnd
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
2011-02-23 09:25:13 +00:00
|
|
|
HWND m_hWnd;
|
2011-02-19 03:36:30 +00:00
|
|
|
|
2011-02-23 09:16:00 +00:00
|
|
|
bool m_managed; // set true when we're attached to a 3rdparty window that's amanged by the emulator
|
|
|
|
bool m_frame;
|
2011-02-18 01:56:05 +00:00
|
|
|
|
2009-06-03 12:09:04 +00:00
|
|
|
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
|
|
|
virtual LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
GSWnd();
|
|
|
|
virtual ~GSWnd();
|
|
|
|
|
2009-07-17 23:45:32 +00:00
|
|
|
bool Create(const string& title, int w, int h);
|
2011-02-23 09:16:00 +00:00
|
|
|
bool Attach(void* handle, bool managed = true);
|
2009-09-17 07:40:38 +00:00
|
|
|
void Detach();
|
2011-02-23 09:16:00 +00:00
|
|
|
bool IsManaged() const {return m_managed;}
|
2009-06-03 12:09:04 +00:00
|
|
|
|
2011-02-23 09:16:00 +00:00
|
|
|
void* GetDisplay() {return m_hWnd;}
|
2011-02-19 03:36:30 +00:00
|
|
|
void* GetHandle() {return m_hWnd;}
|
2009-06-03 12:09:04 +00:00
|
|
|
GSVector4i GetClientRect();
|
2009-09-17 07:40:38 +00:00
|
|
|
bool SetWindowText(const char* title);
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
void Show();
|
|
|
|
void Hide();
|
2011-02-23 09:16:00 +00:00
|
|
|
void HideFrame();
|
|
|
|
};
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2011-02-24 23:46:26 +00:00
|
|
|
#include <X11/Xlib.h>
|
2011-02-23 09:16:00 +00:00
|
|
|
|
2011-02-24 23:46:26 +00:00
|
|
|
class GSWnd
|
|
|
|
{
|
2012-01-04 23:19:17 +00:00
|
|
|
void* m_window;
|
2012-01-06 21:43:39 +00:00
|
|
|
Window m_Xwindow;
|
|
|
|
Display* m_XDisplay;
|
|
|
|
|
2012-06-12 18:14:01 +00:00
|
|
|
bool m_ctx_attached;
|
2011-06-12 14:48:36 +00:00
|
|
|
bool m_managed;
|
2011-12-07 22:05:46 +00:00
|
|
|
int m_renderer;
|
|
|
|
GLXContext m_context;
|
2011-02-23 09:16:00 +00:00
|
|
|
|
2011-02-24 23:46:26 +00:00
|
|
|
public:
|
|
|
|
GSWnd();
|
|
|
|
virtual ~GSWnd();
|
|
|
|
|
|
|
|
bool Create(const string& title, int w, int h);
|
2011-06-12 14:48:36 +00:00
|
|
|
bool Attach(void* handle, bool managed = true);
|
2011-03-12 22:38:07 +00:00
|
|
|
void Detach();
|
2011-06-12 14:48:36 +00:00
|
|
|
bool IsManaged() const {return m_managed;}
|
2012-06-12 18:14:01 +00:00
|
|
|
bool IsContextAttached() const { return m_ctx_attached; }
|
2011-02-24 23:46:26 +00:00
|
|
|
|
|
|
|
Display* GetDisplay();
|
2011-08-20 12:17:47 +00:00
|
|
|
void* GetHandle() {return (void*)m_Xwindow;}
|
2011-02-24 23:46:26 +00:00
|
|
|
GSVector4i GetClientRect();
|
|
|
|
bool SetWindowText(const char* title);
|
|
|
|
|
2012-01-06 21:43:39 +00:00
|
|
|
bool CreateContext(int major, int minor);
|
|
|
|
void AttachContext();
|
|
|
|
void DetachContext();
|
|
|
|
void CheckContext();
|
|
|
|
|
2011-02-24 23:46:26 +00:00
|
|
|
void Show();
|
|
|
|
void Hide();
|
|
|
|
void HideFrame();
|
2011-12-07 22:05:46 +00:00
|
|
|
void Flip();
|
2011-02-24 23:46:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|