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
Shinya Kitaoka 120a6e
namespace TCli {
Toshihiro Shimizu 890ddd
class Usage;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI TMainshell : public TWidget {
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  static TMainshell *theShell;
Shinya Kitaoka 120a6e
  virtual void create();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
#ifndef WIN32
Shinya Kitaoka 120a6e
  bool m_ending;
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  static TMainshell *getMainshell() { return theShell; }
Shinya Kitaoka 120a6e
  static TMainshell *instance() { return theShell; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TMainshell(string name);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual void init() {}
Shinya Kitaoka 120a6e
  virtual void atExit() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual bool beforeShow() { return true; }
Shinya Kitaoka 120a6e
  virtual void close();
Shinya Kitaoka 120a6e
  virtual void closeWithoutQuestion();
Shinya Kitaoka 120a6e
  // void pushStatusMessage(string );
Shinya Kitaoka 120a6e
  // virtual void pushStatusMessage(std::wstring ) {}
Shinya Kitaoka 120a6e
  // virtual void popStatusMessage() {};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // static void errorMessage(const string &str);
Shinya Kitaoka 120a6e
  // static bool questionMessage(const string &str);
Shinya Kitaoka 120a6e
  // static int multipleChoicesMessage(const string &str, vector<string></string>
Shinya Kitaoka 120a6e
  // &choices);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // brutto (ma veloce da implementare :-)
Shinya Kitaoka 120a6e
  // restituisce 0=yes, 1=no, 2=cancel
Shinya Kitaoka 120a6e
  // static int yesNoCancelMessage(const string &str);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual TDimension getPreferredSize() { return TDimension(800, 600); }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual bool isResizable() const { return true; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual int getMainIconId() { return 0; }            // ha senso solo su NT
Shinya Kitaoka 120a6e
  virtual int getSplashScreenBitmapId() { return 0; }  // ha senso solo su NT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // void setAccelerator(
Shinya Kitaoka 120a6e
  //    string acc,
Shinya Kitaoka 120a6e
  //    TGenericCommandAction *onKeyDown);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setAccelerator(string acc, string guiCommandName);
Shinya Kitaoka 120a6e
  string getAccelerator(string guiCommandName);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual void forwardMessage(string msg) {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void contextHelp();
Shinya Kitaoka 120a6e
  virtual void onContextHelp(string reference) {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual string getAppId() const = 0;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual void defineUsage(TCli::Usage &usage);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI TKeyListener {
Shinya Kitaoka 120a6e
  string m_keyName;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TKeyListener(string keyName);
Shinya Kitaoka 120a6e
  virtual ~TKeyListener();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual void onKeyDown()                      = 0;
Shinya Kitaoka 120a6e
  virtual void onKeyUp(bool mouseEventReceived) = 0;
Shinya Kitaoka 120a6e
  virtual bool autoreatIsEnabled() { return false; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  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>
Shinya Kitaoka 120a6e
class TCommandKey : public TKeyListener {
Shinya Kitaoka 120a6e
  typedef void (T::*Method)();
Shinya Kitaoka 120a6e
  T *m_target;
Shinya Kitaoka 120a6e
  Method m_method;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TCommandKey(string keyName, T *target, Method method)
Shinya Kitaoka 120a6e
      : TKeyListener(keyName), m_target(target), m_method(method) {}
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void onKeyDown() { (m_target->*m_method)(); }
Shinya Kitaoka 120a6e
  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