MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / onProcessMessage

Method onProcessMessage

src/ui/combobox.cpp:329–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327}
328
329bool ComboBox::onProcessMessage(Message* msg)
330{
331 switch (msg->type()) {
332
333 case kCloseMessage:
334 closeListBox();
335 break;
336
337 case kWinMoveMessage:
338 if (m_window)
339 m_window->moveWindow(getListBoxPos());
340 break;
341
342 case kKeyDownMessage:
343 if (m_window) {
344 KeyMessage* keymsg = static_cast<KeyMessage*>(msg);
345 KeyScancode scancode = keymsg->scancode();
346
347 // If the popup is opened
348 if (scancode == kKeyEsc) {
349 closeListBox();
350 return true;
351 }
352 }
353 break;
354
355 case kMouseDownMessage:
356 if (m_window) {
357 if (!View::getView(m_listbox)->hasMouse()) {
358 closeListBox();
359
360 MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
361 Widget* pick = manager()->pick(mouseMsg->position());
362 return (pick && pick->hasAncestor(this) ? true: false);
363 }
364 }
365 break;
366
367 case kFocusEnterMessage:
368 // Here we focus the entry field only if the combobox is
369 // editable and receives the focus in a direct way (e.g. when
370 // the window was just opened and the combobox is the first
371 // child or has the "focus magnet" flag enabled.)
372 if ((isEditable()) &&
373 (manager()->getFocus() == this)) {
374 m_entry->requestFocus();
375 }
376 break;
377
378 }
379
380 return Widget::onProcessMessage(msg);
381}
382
383void ComboBox::onResize(ResizeEvent& ev)
384{

Callers

nothing calls this directly

Calls 15

moveWindowMethod · 0.80
hasMouseMethod · 0.80
pickMethod · 0.80
hasAncestorMethod · 0.80
getFocusMethod · 0.80
requestFocusMethod · 0.80
switchListBoxMethod · 0.80
sendMessageMethod · 0.80
isClickOpenMethod · 0.80
buttonsMethod · 0.80
closeListBoxMethod · 0.80
getEntryWidgetMethod · 0.80

Tested by

no test coverage detected