| #pragma once |
| |
| #ifndef MAINSHELL_INCLUDED |
| #define MAINSHELL_INCLUDED |
| |
| |
| #include "menubar.h" |
| |
| |
| |
| |
| |
| #undef DVAPI |
| #undef DVVAR |
| #ifdef TWIN_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| class TGenericCommandAction; |
| |
| namespace TCli { |
| class Usage; |
| } |
| |
| class DVAPI TMainshell : public TWidget { |
| protected: |
| static TMainshell *theShell; |
| virtual void create(); |
| |
| public: |
| #ifndef WIN32 |
| bool m_ending; |
| #endif |
| |
| static TMainshell *getMainshell() { return theShell; } |
| static TMainshell *instance() { return theShell; } |
| |
| TMainshell(string name); |
| |
| virtual void init() {} |
| virtual void atExit() {} |
| |
| virtual bool beforeShow() { return true; } |
| virtual void close(); |
| virtual void closeWithoutQuestion(); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| virtual TDimension getPreferredSize() { return TDimension(800, 600); } |
| |
| virtual bool isResizable() const { return true; } |
| |
| virtual int getMainIconId() { return 0; } |
| virtual int getSplashScreenBitmapId() { return 0; } |
| |
| |
| |
| |
| |
| void setAccelerator(string acc, string guiCommandName); |
| string getAccelerator(string guiCommandName); |
| |
| virtual void forwardMessage(string msg) {} |
| |
| void contextHelp(); |
| virtual void onContextHelp(string reference) {} |
| |
| virtual string getAppId() const = 0; |
| |
| virtual void defineUsage(TCli::Usage &usage); |
| }; |
| |
| class DVAPI TKeyListener { |
| string m_keyName; |
| |
| public: |
| TKeyListener(string keyName); |
| virtual ~TKeyListener(); |
| |
| virtual void onKeyDown() = 0; |
| virtual void onKeyUp(bool mouseEventReceived) = 0; |
| virtual bool autoreatIsEnabled() { return false; } |
| |
| string getKeyName() const { return m_keyName; } |
| }; |
| |
| |
| |
| template <class T> |
| class TCommandKey : public TKeyListener { |
| typedef void (T::*Method)(); |
| T *m_target; |
| Method m_method; |
| |
| public: |
| TCommandKey(string keyName, T *target, Method method) |
| : TKeyListener(keyName), m_target(target), m_method(method) {} |
| |
| void onKeyDown() { (m_target->*m_method)(); } |
| void onKeyUp(bool mouseEventReceived) {} |
| }; |
| |
| DVAPI void enableShortcuts(bool on); |
| |
| DVAPI void enableShortcuts(bool on); |
| |
| DVAPI void enableShortcuts(bool on); |
| |
| #endif |