I've been doing more to this MUD client. This time working on my subclassed RichEdit (DruinkEdit). It's basically exactly the same as a RichEdit, just some functionality is overridden.
Cool things my control can do out of the box:
Here's the class interface for your amusement:
//============================================================================// DruinkEdit.h - Overridden RichEdit window class//============================================================================#ifndef __DRUINKEDIT_H__#define __DRUINKEDIT_H__#include #include #include #include #define TA2BIT 0x80#define TA2BIT_ENABLE 0x40#define TA2BIT_BOLD 0x20#define TA2BIT_ITALIC 0x10#define TA2BIT_UNDERLINE 0x08#define TA2BIT_TEXTCOLOUR 0x04#define TA2BIT_STRIKEOUT 0x02#define TA2BIT_URL 0x01 // Used internally//============================================================================// Main classclass CDruinkEdit{public: CDruinkEdit(); ~CDruinkEdit() {Release();} void Release(); // Only valid to call before control is created void SetDefaultTextColour(COLORREF crText); void SetDefaultBackColour(COLORREF crBack); // General functions bool Create(HINSTANCE hInstance, HWND hWndParent, DWORD x, DWORD y, DWORD w, DWORD h, bool bReadOnly); bool AddText(const std::string& strText); void Clear(); void SetFont(const std::string& strFont, int nSize); void SetURLFormat(BYTE byTA2Bits, COLORREF crText=0xffffffff, COLORREF crBack=0xffffffff); std::string GetText() const; void SetText(const std::string& str); std::string GetNextPMLTag(); // Accessors HWND GetWindow() const {return m_hWnd;} bool WasEnterPressed() const {return m_bEnterPressed;} bool HasPMLWaiting() const {return !m_vPMLTags.empty();}private: // Snip};#endif // __DRUINKEDIT_H__
I tinkered with making my own control completely, one which renders its own characters, but it ended up pretty complicated and buggy - and this was just for an output control, and input control would be even worse.
Anyway, back to work...