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

Method HandleMessage

RedisStudio/DuiEx/UIMenu.cpp:224–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222}
223
224LRESULT CMenuWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
225{
226 if( uMsg == WM_CREATE ) {
227 if( m_pOwner != NULL) {
228 LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
229 styleValue &= ~WS_CAPTION;
230 ::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
231 RECT rcClient;
232 ::GetClientRect(*this, &rcClient);
233 ::SetWindowPos(*this, NULL, rcClient.left, rcClient.top, rcClient.right - rcClient.left, \
234 rcClient.bottom - rcClient.top, SWP_FRAMECHANGED);
235
236 m_pm.Init(m_hWnd);
237 // The trick is to add the items to the new container. Their owner gets
238 // reassigned by this operation - which is why it is important to reassign
239 // the items back to the righfull owner/manager when the window closes.
240 m_pLayout = new CMenuUI();
241 m_pm.UseParentResource(m_pOwner->GetManager());
242 m_pLayout->SetManager(&m_pm, NULL, true);
243 LPCTSTR pDefaultAttributes = m_pOwner->GetManager()->GetDefaultAttributeList(kMenuUIInterfaceName);
244 if( pDefaultAttributes ) {
245 m_pLayout->ApplyAttributeList(pDefaultAttributes);
246 }
247 m_pLayout->SetBkColor(0xFFFFFFFF);
248 m_pLayout->SetBorderColor(0xFF85E4FF);
249 m_pLayout->SetBorderSize(0);
250 m_pLayout->SetAutoDestroy(false);
251 m_pLayout->EnableScrollBar();
252 for( int i = 0; i < m_pOwner->GetCount(); i++ ) {
253 if(m_pOwner->GetItemAt(i)->GetInterface(kMenuElementUIInterfaceName) != NULL ){
254 (static_cast<CMenuElementUI*>(m_pOwner->GetItemAt(i)))->SetOwner(m_pLayout);
255 m_pLayout->Add(static_cast<CControlUI*>(m_pOwner->GetItemAt(i)));
256 }
257 }
258 m_pm.AttachDialog(m_pLayout);
259
260 // Position the popup window in absolute space
261 RECT rcOwner = m_pOwner->GetPos();
262 RECT rc = rcOwner;
263
264 int cxFixed = 0;
265 int cyFixed = 0;
266
267#if defined(WIN32) && !defined(UNDER_CE)
268 MONITORINFO oMonitor = {};
269 oMonitor.cbSize = sizeof(oMonitor);
270 ::GetMonitorInfo(::MonitorFromWindow(*this, MONITOR_DEFAULTTOPRIMARY), &oMonitor);
271 CDuiRect rcWork = oMonitor.rcWork;
272#else
273 CDuiRect rcWork;
274 GetWindowRect(m_pOwner->GetManager()->GetPaintWindow(), &rcWork);
275#endif
276 SIZE szAvailable = { rcWork.right - rcWork.left, rcWork.bottom - rcWork.top };
277
278 for( int it = 0; it < m_pOwner->GetCount(); it++ ) {
279 if(m_pOwner->GetItemAt(it)->GetInterface(kMenuElementUIInterfaceName) != NULL ){
280 CControlUI* pControl = static_cast<CControlUI*>(m_pOwner->GetItemAt(it));
281 SIZE sz = pControl->EstimateSize(szAvailable);

Callers

nothing calls this directly

Calls 15

UseParentResourceMethod · 0.80
GetManagerMethod · 0.80
ApplyAttributeListMethod · 0.80
SetBkColorMethod · 0.80
SetBorderColorMethod · 0.80
SetBorderSizeMethod · 0.80
SetAutoDestroyMethod · 0.80
AttachDialogMethod · 0.80
GetPaintWindowMethod · 0.80
nextMethod · 0.80
SetInitSizeMethod · 0.80

Tested by

no test coverage detected