/*	Copyright  (c)	Günter Woigk 2016 - 2016
					mailto:kio@little-bat.de

	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.

	Permission to use, copy, modify, distribute, and sell this software and
	its documentation for any purpose is hereby granted without fee, provided
	that the above copyright notice appear in all copies and that both that
	copyright notice and this permission notice appear in supporting
	documentation, and that the name of the copyright holder not be used
	in advertising or publicity pertaining to distribution of the software
	without specific, written prior permission.  The copyright holder makes no
	representations about the suitability of this software for any purpose.
	It is provided "as is" without express or implied warranty.

	THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
	INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
	EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
	CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
	DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
	TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
	PERFORMANCE OF THIS SOFTWARE.
*/


#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "kio/kio.h"
#include <QOpenGLWindow>
//#include "Object.h"
#include <QThread>
#include <QPainter>
class Object;



// settings:

extern QColor background_color;
extern bool   enable_fs;			// expose file system?
extern bool   enable_kbd;			// expose keyboard?	 default = yes
extern bool   enable_joy;			// expose joysticks?
extern bool   enable_ptr;			// expose pointer device (mouse)?
extern uint32 max_mem;				// ram usage limit
//extern uint32 max_streams;			// max. logical streams


extern bool update_flag;			// screen update flag


extern void resetTerminal();
extern void readPreferences();
extern void writePreferences();
extern void handleEscape(uint);




// GTerm Window:
extern class MainWindow* main_window;



class MainWindow : public QOpenGLWindow
{
	Q_OBJECT

public:
	MainWindow(QWindow* parent = 0);
	~MainWindow();

protected:
//	void	paintEvent(QPaintEvent*) override;
//	void	resizeEvent(QResizeEvent*) override;

	void	initializeGL()			  override;
	void	paintGL()				  override;
//	void	paintOverGL()			  override;
//	void	paintUnderGL()			  override;
	void	resizeGL(int w, int h)	  override;

	void	keyPressEvent(QKeyEvent*)		override;
	void	keyReleaseEvent(QKeyEvent*)		override;
	void	mouseMoveEvent(QMouseEvent*)	override;
	void	mousePressEvent(QMouseEvent*)	override;
	void	mouseReleaseEvent(QMouseEvent*)	override;

public slots:
	void	slotSetTCPPort();
	void	slotSetPipeName();
	void	slotShowAbout();
	void	slotShowPreferences();
	void	slotResetTerminal();
};








/*
QOpenGLWindow:
virtual void	initializeGL()
virtual void	paintGL()
virtual void	paintOverGL()
virtual void	paintUnderGL()
virtual void	resizeGL(int w, int h)
reimplemented:
virtual void	paintEvent(QPaintEvent * event)
virtual void	resizeEvent(QResizeEvent * event)

QWindow:
virtual void	exposeEvent(QExposeEvent * ev)
virtual void	focusInEvent(QFocusEvent * ev)
virtual void	focusOutEvent(QFocusEvent * ev)
virtual void	hideEvent(QHideEvent * ev)
virtual void	keyPressEvent(QKeyEvent * ev)
virtual void	keyReleaseEvent(QKeyEvent * ev)
virtual void	mouseDoubleClickEvent(QMouseEvent * ev)
virtual void	mouseMoveEvent(QMouseEvent * ev)
virtual void	mousePressEvent(QMouseEvent * ev)
virtual void	mouseReleaseEvent(QMouseEvent * ev)
virtual void	moveEvent(QMoveEvent * ev)
virtual bool	nativeEvent(const QByteArray & eventType, void * message, long * result)
virtual void	resizeEvent(QResizeEvent * ev)
virtual void	showEvent(QShowEvent * ev)
virtual void	tabletEvent(QTabletEvent * ev)
virtual void	touchEvent(QTouchEvent * ev)
virtual void	wheelEvent(QWheelEvent * ev)
*/

#endif































