MCPcopy Create free account
hub / github.com/cinience/RedisStudio / DoEvent

Method DoEvent

DuiLib/Control/UIEdit.cpp:184–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182 }
183
184 void CEditUI::DoEvent(TEventUI& event)
185 {
186 if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
187 if( m_pParent != NULL ) m_pParent->DoEvent(event);
188 else CLabelUI::DoEvent(event);
189 return;
190 }
191
192 if( event.Type == UIEVENT_SETCURSOR && IsEnabled() )
193 {
194 ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_IBEAM)));
195 return;
196 }
197 if( event.Type == UIEVENT_WINDOWSIZE )
198 {
199 if( m_pWindow != NULL ) m_pManager->SetFocusNeeded(this);
200 }
201 if( event.Type == UIEVENT_SCROLLWHEEL )
202 {
203 if( m_pWindow != NULL ) return;
204 }
205 if( event.Type == UIEVENT_SETFOCUS && IsEnabled() )
206 {
207 if( m_pWindow ) return;
208 m_pWindow = new CEditWnd();
209 ASSERT(m_pWindow);
210 m_pWindow->Init(this);
211 Invalidate();
212 }
213 if( event.Type == UIEVENT_KILLFOCUS && IsEnabled() )
214 {
215 Invalidate();
216 }
217 if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK || event.Type == UIEVENT_RBUTTONDOWN)
218 {
219 if( IsEnabled() ) {
220 GetManager()->ReleaseCapture();
221 if( IsFocused() && m_pWindow == NULL )
222 {
223 m_pWindow = new CEditWnd();
224 ASSERT(m_pWindow);
225 m_pWindow->Init(this);
226
227 if( PtInRect(&m_rcItem, event.ptMouse) )
228 {
229 int nSize = GetWindowTextLength(*m_pWindow);
230 if( nSize == 0 )
231 nSize = 1;
232
233 Edit_SetSel(*m_pWindow, 0, nSize);
234 }
235 }
236 else if( m_pWindow != NULL )
237 {
238#if 1
239 int nSize = GetWindowTextLength(*m_pWindow);
240 if( nSize == 0 )
241 nSize = 1;

Callers

nothing calls this directly

Calls 3

SetFocusNeededMethod · 0.80
ReleaseCaptureMethod · 0.80
InitMethod · 0.45

Tested by

no test coverage detected