OSDN Git Service

レンダーターゲットが変わった時に再作成し忘れていたやつがあった
[fooeditengine/FooEditEngine.git] / DotNetTextStore / TextStore2.cs
1 //#define TSF_DEBUG_OUTPUT
2 #define METRO
3 using System;
4 using System.Text;
5 using System.Diagnostics;
6 using System.Reflection;
7 using System.Runtime.InteropServices;
8 using System.Globalization;
9
10 using DotNetTextStore.UnmanagedAPI.TSF;
11 using DotNetTextStore.UnmanagedAPI.TSF.TextStore;
12 using DotNetTextStore.UnmanagedAPI.WinDef;
13 using DotNetTextStore.UnmanagedAPI.WinError;
14
15 namespace DotNetTextStore
16 {
17     public sealed class TextStore2 : TextStoreBase, IDisposable, ITextStoreACP2, ITfContextOwnerCompositionSink
18     {
19         #region 生成と破棄
20         public void Dispose()
21         {
22             base.Dispose(false);
23             GC.SuppressFinalize(this);
24         }
25
26         protected override void CreateThreadMgr()
27         {
28             if (_threadMgr == null)
29             {
30                 Type clsid = Marshal.GetTypeFromCLSID(TfDeclarations.CLSID_TF_ThreadMgr);
31                 ITfThreadMgr2 threadMgr = Activator.CreateInstance(clsid) as ITfThreadMgr2;
32
33                 if (threadMgr == null)
34                 {
35                     const string message = "スレッドマネージャーの生成に失敗しました。";
36                     Debug.WriteLine(message);
37                     throw new COMException(message, HRESULT.E_NOTIMPL);
38                 }
39
40                 this._threadMgr = threadMgr;
41             }
42         }
43
44         #endregion
45     }
46 }