メインページ   クラス階層   構成   ファイル一覧   構成メンバ  

tanuki_app.h

解説を見る。
00001 
00009 #ifndef INCLUDE_TANUKI_APP_H__
00010 #define INCLUDE_TANUKI_APP_H__
00011 
00012 // 本ライブラリが必ず参照する WIN32 関連ヘッダ
00013 #include <WINDOWS.H>
00014 #include <TCHAR.H>
00015 #include <CRTDBG.H>
00016 
00017 // ライブラリを DLL として使用する場合は、
00018 // シンボル TANUKI_USED_DLL_EXPORT を有効にして下さい
00019 #ifdef TANUKI_USED_DLL_EXPORT
00020 #define TANUKI_API      __declspec( dllexport )
00021 #else   //TANUKI_USED_DLL_EXPORT
00022 #define TANUKI_API
00023 #endif  //TANUKI_USED_DLL_EXPORT
00024 
00025 // 本ライブラリでは、常に以下の名前空間を使用します。
00026 namespace tanuki {
00027 
00028 
00029 #ifndef INCLUDE_TANUKI_EXCEPTION_BASE_CL__
00030 #define INCLUDE_TANUKI_EXCEPTION_BASE_CL__
00031 
00037 class TANUKI_API exc_base {
00038         //
00039         // 構築・破棄
00040         //
00041 protected:
00043         exc_base(LPCTSTR msg) : m_msg(msg) {}
00045         virtual ~exc_base() {}
00046         
00047         //
00048         // 取得
00049         //
00050 public:
00052         LPCTSTR What() const { return m_msg; }
00053         
00054         //
00055         // フィールド
00056         //
00057 private:
00058         // エラーメッセージ
00059         LPCTSTR         m_msg;
00060 };
00061 
00062 #endif  //INCLUDE_TANUKI_EXCEPTION_BASE_CL__
00063 
00064 
00070 class TANUKI_API exc_application : public exc_base {
00071         //
00072         // 構築・破棄
00073         //
00074 public:
00078         exc_application(LPCTSTR msg) : exc_base(msg) {}
00080         virtual ~exc_application() {}
00081 };
00082 
00083 
00144 class TANUKI_API cl_application {
00145         //
00146         // 定数
00147         //
00148 private:
00149         enum {
00150                 // アプリケーションが同時に扱えるモードレスダイアログの最大数
00151                 MAX_MODELESS_DIALOG     = 127,
00152         };
00153         
00154         //
00155         // 構築・破棄
00156         //
00157 protected:
00159         cl_application()
00160                 : M_ReturnValue(0), m_h_instance(NULL),
00161                   m_is_use_message_loop(true),
00162                   m_is_use_translate_message(true),
00163                   m_is_use_translate_accelerator(true),
00164                   m_is_use_modeless_dialog(true)
00165         {
00166                 // 今まさに生成しているこのインスタンスへのポインタを、
00167                 // GetApplicationPtr() メソッドにて取得できるよう登録する。
00168                 m_p_instance = this;
00169         }
00171         virtual ~cl_application() = 0;
00172 private:
00173         // コピーコンストラクタ、代入演算子は使用禁止
00174         cl_application(const cl_application &);
00175         cl_application & operator =(const cl_application &);
00176         
00177         //
00178         // 操作
00179         //
00180 public:
00199         virtual void Initialize(HINSTANCE h_instance,
00200                                 LPCTSTR argv,
00201                                 int show_flag)
00202         {
00203                 // 基底クラスの本メソッドでは、アプリケーションインスタンスの
00204                 // ハンドルを登録するだけである
00205                 m_h_instance = h_instance;
00206         }
00214         virtual void Terminate() {}
00215 protected:
00229         void useMessageLoop(bool is_use = true)
00230         { m_is_use_message_loop = is_use; }
00246         void useTranslateMessage(bool is_use = true)
00247         { m_is_use_translate_message = is_use; }
00263         void useTranslateAccelerator(bool is_use = true)
00264         { m_is_use_translate_accelerator = is_use; }
00278         void useModelessDialog(bool is_use = true)
00279         { m_is_use_modeless_dialog = is_use; }
00280 public:
00293         bool RegisterModelessDialog(HWND h_dlg);
00297         bool RemoveModelessDialog(HWND h_dlg);
00301         bool DispatchModelessDialogMessage(LPMSG p_msg);
00302         
00303         //
00304         // 取得
00305         //
00306 public:
00310         HINSTANCE GetInstanceHandle() const { return m_h_instance; }
00318         bool IsUseMessageLoop() const { return m_is_use_message_loop; }
00326         bool IsUseTranslateMessage() const
00327         { return m_is_use_translate_message; }
00335         bool IsUseTranslateAccelerator() const
00336         { return m_is_use_translate_accelerator; }
00344         bool IsUseModelessDialog() const { return m_is_use_modeless_dialog; }
00348         static cl_application * GetApplicationPtr() { return m_p_instance; }
00349         
00350         //
00351         // フィールド
00352         //
00353 public:
00360         int                     M_ReturnValue;
00361 private:
00362         // アプリケーションインスタンスのハンドル
00363         HINSTANCE               m_h_instance;
00364         // メッセージループを行うか
00365         bool                    m_is_use_message_loop;
00366         // 仮想キーメッセージを文字メッセージに変換するか
00367         bool                    m_is_use_translate_message;
00368         // アクセラレータキーを使用するか
00369         bool                    m_is_use_translate_accelerator;
00370         // モードレスダイアログを使用するか
00371         bool                    m_is_use_modeless_dialog;
00372         // モードレスダイアログ登録用ハッシュテーブル
00373         HWND                    m_modeless_dialog_table[MAX_MODELESS_DIALOG];
00374         
00375         // アプリケーションに唯一のインスタンスへのポインタ
00376         static cl_application * m_p_instance;
00377 };
00378 
00379 
00380 }       //namespace tanuki
00381 
00382 
00383 #endif  //INCLUDE_TANUKI_APP_H__
00384 
00385 //
00386 // (C)2002 T.MURACHI, all right reserved. //////////////////////////////////

Tanuki Libraryに対してWed Aug 21 22:49:02 2002に生成されました。 doxygen1.2.17