1 /** DGui project file. 2 3 Copyright: Trogu Antonio Davide 2011-2013 4 5 License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0). 6 7 Authors: Trogu Antonio Davide 8 */ 9 10 /* 11 From MSDN 12 13 Rich Edit version DLL Window Class 14 ---- 15 1.0 Riched32.dll RICHEDIT_CLASS 16 2.0 Riched20.dll RICHEDIT_CLASS 17 3.0 Riched20.dll RICHEDIT_CLASS 18 4.1 Msftedit.dll MSFTEDIT_CLASS 19 20 Windows XP SP1: Includes Microsoft Rich Edit 4.1, Microsoft Rich Edit 3.0, and a Microsoft Rich Edit 1.0 emulator. 21 Windows XP: Includes Microsoft Rich Edit 3.0 with a Microsoft Rich Edit 1.0 emulator. 22 Windows Me: Includes Microsoft Rich Edit 1.0 and 3.0. 23 Windows 2000: Includes Microsoft Rich Edit 3.0 with a Microsoft Rich Edit 1.0 emulator. 24 Windows NT 4.0: Includes Microsoft Rich Edit 1.0 and 2.0. 25 Windows 98: Includes Microsoft Rich Edit 1.0 and 2.0. 26 Windows 95: Includes only Microsoft Rich Edit 1.0. However, Riched20.dll is compatible with Windows 95 and may be installed by an application that requires it. 27 */ 28 29 module dguihub.richtextbox; 30 31 public import dguihub.core.controls.textcontrol; 32 33 class RichTextBox : TextControl { 34 private static int _refCount = 0; 35 private static HMODULE _hRichDLL; 36 37 public override void dispose() { 38 --_refCount; 39 40 if (!_refCount) { 41 FreeLibrary(_hRichDLL); 42 _hRichDLL = null; 43 } 44 45 super.dispose(); 46 } 47 48 public void redo() { 49 this.sendMessage(EM_REDO, 0, 0); 50 } 51 52 protected override void createControlParams(ref CreateControlParams ccp) { 53 // Probably the RichTextbox ignores the wParam parameter in WM_PAINT 54 55 ++_refCount; 56 57 if (!_hRichDLL) { 58 _hRichDLL = loadLibrary("RichEd20.dll"); // Load the standard version 59 } 60 61 this.setStyle(ES_MULTILINE | ES_WANTRETURN, true); 62 ccp.superclassName = WC_RICHEDIT; 63 ccp.className = WC_DRICHEDIT; 64 65 super.createControlParams(ccp); 66 } 67 68 protected override void onHandleCreated(EventArgs e) { 69 super.onHandleCreated(e); 70 71 this.sendMessage(EM_SETEVENTMASK, 0, ENM_CHANGE | ENM_UPDATE); 72 this.sendMessage(EM_SETBKGNDCOLOR, 0, this._backColor.colorref); 73 } 74 }