Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef MAINSHELL_INCLUDED
Toshihiro Shimizu 890ddd
#define MAINSHELL_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//#include "tcommon.h"
Toshihiro Shimizu 890ddd
#include "menubar.h"
Toshihiro Shimizu 890ddd
//#include "toolbar.h"
Toshihiro Shimizu 890ddd
//#include "label.h"
Toshihiro Shimizu 890ddd
//#include "panel.h"
Toshihiro Shimizu 890ddd
// #include "tcli.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TWIN_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TGenericCommandAction;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
namespace TCli
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
class Usage;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TMainshell : public TWidget
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	static TMainshell *theShell;
Toshihiro Shimizu 890ddd
	virtual void create();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
#ifndef WIN32
Toshihiro Shimizu 890ddd
	bool m_ending;
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	static TMainshell *getMainshell()
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return theShell;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	static TMainshell *instance() { return theShell; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TMainshell(string name);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void init() {}
Toshihiro Shimizu 890ddd
	virtual void atExit() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual bool beforeShow() { return true; }
Toshihiro Shimizu 890ddd
	virtual void close();
Toshihiro Shimizu 890ddd
	virtual void closeWithoutQuestion();
Toshihiro Shimizu 890ddd
	//void pushStatusMessage(string );
Toshihiro Shimizu 890ddd
	//virtual void pushStatusMessage(std::wstring ) {}
Toshihiro Shimizu 890ddd
	//virtual void popStatusMessage() {};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//static void errorMessage(const string &str);
Toshihiro Shimizu 890ddd
	//static bool questionMessage(const string &str);
Toshihiro Shimizu 890ddd
	// static int multipleChoicesMessage(const string &str, vector<string> &choices);</string>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	// brutto (ma veloce da implementare :-)
Toshihiro Shimizu 890ddd
	// restituisce 0=yes, 1=no, 2=cancel
Toshihiro Shimizu 890ddd
	//static int yesNoCancelMessage(const string &str);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual TDimension getPreferredSize()
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return TDimension(800, 600);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual bool isResizable() const { return true; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual int getMainIconId() { return 0; }			// ha senso solo su NT
Toshihiro Shimizu 890ddd
	virtual int getSplashScreenBitmapId() { return 0; } // ha senso solo su NT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//void setAccelerator(
Toshihiro Shimizu 890ddd
	//    string acc,
Toshihiro Shimizu 890ddd
	//    TGenericCommandAction *onKeyDown);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void setAccelerator(string acc, string guiCommandName);
Toshihiro Shimizu 890ddd
	string getAccelerator(string guiCommandName);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void forwardMessage(string msg) {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void contextHelp();
Toshihiro Shimizu 890ddd
	virtual void onContextHelp(string reference) {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual string getAppId() const = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void defineUsage(TCli::Usage &usage);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TKeyListener
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	string m_keyName;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TKeyListener(string keyName);
Toshihiro Shimizu 890ddd
	virtual ~TKeyListener();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void onKeyDown() = 0;
Toshihiro Shimizu 890ddd
	virtual void onKeyUp(bool mouseEventReceived) = 0;
Toshihiro Shimizu 890ddd
	virtual bool autoreatIsEnabled() { return false; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	string getKeyName() const { return m_keyName; }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Toshihiro Shimizu 890ddd
class TCommandKey : public TKeyListener
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	typedef void (T::*Method)();
Toshihiro Shimizu 890ddd
	T *m_target;
Toshihiro Shimizu 890ddd
	Method m_method;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TCommandKey(string keyName, T *target, Method method)
Toshihiro Shimizu 890ddd
		: TKeyListener(keyName), m_target(target), m_method(method) {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void onKeyDown()
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		(m_target->*m_method)();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	void onKeyUp(bool mouseEventReceived) {}
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void enableShortcuts(bool on);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void enableShortcuts(bool on);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
DVAPI void enableShortcuts(bool on);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif