| 31 | } |
| 32 | |
| 33 | void CEditWnd::Init(CEditUI* pOwner) |
| 34 | { |
| 35 | m_pOwner = pOwner; |
| 36 | RECT rcPos = CalPos(); |
| 37 | UINT uStyle = WS_CHILD | ES_AUTOHSCROLL; |
| 38 | if( m_pOwner->IsPasswordMode() ) uStyle |= ES_PASSWORD; |
| 39 | Create(m_pOwner->GetManager()->GetPaintWindow(), NULL, uStyle, 0, rcPos); |
| 40 | HFONT hFont=NULL; |
| 41 | int iFontIndex=m_pOwner->GetFont(); |
| 42 | if (iFontIndex!=-1) |
| 43 | hFont=m_pOwner->GetManager()->GetFont(iFontIndex); |
| 44 | if (hFont==NULL) |
| 45 | hFont=m_pOwner->GetManager()->GetDefaultFontInfo()->hFont; |
| 46 | |
| 47 | SetWindowFont(m_hWnd, hFont, TRUE); |
| 48 | Edit_LimitText(m_hWnd, m_pOwner->GetMaxChar()); |
| 49 | if( m_pOwner->IsPasswordMode() ) Edit_SetPasswordChar(m_hWnd, m_pOwner->GetPasswordChar()); |
| 50 | Edit_SetText(m_hWnd, m_pOwner->GetText()); |
| 51 | Edit_SetModify(m_hWnd, FALSE); |
| 52 | SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELPARAM(0, 0)); |
| 53 | Edit_Enable(m_hWnd, m_pOwner->IsEnabled() == true); |
| 54 | Edit_SetReadOnly(m_hWnd, m_pOwner->IsReadOnly() == true); |
| 55 | //Styls |
| 56 | LONG styleValue = ::GetWindowLong(m_hWnd, GWL_STYLE); |
| 57 | styleValue |= pOwner->GetWindowStyls(); |
| 58 | ::SetWindowLong(GetHWND(), GWL_STYLE, styleValue); |
| 59 | ::ShowWindow(m_hWnd, SW_SHOWNOACTIVATE); |
| 60 | ::SetFocus(m_hWnd); |
| 61 | m_bInit = true; |
| 62 | } |
| 63 | |
| 64 | RECT CEditWnd::CalPos() |
| 65 | { |
no test coverage detected