MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / OnMouseDown

Method OnMouseDown

LibLemon/src/gui/window.cpp:319–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317 }
318
319 void WindowMenuBar::OnMouseDown(vector2i_t mousePos){
320 fixedBounds = {0, 0, window->GetSize().x, WINDOW_MENUBAR_HEIGHT};
321
322 int xpos = 0;
323 for(auto& item : items){
324 int oldpos = xpos;
325 xpos += Graphics::GetTextLength(item.first.c_str()) + 8; // 4 pixels on each side of padding
326 if(xpos >= mousePos.x){
327 window->DisplayContextMenu(item.second, {oldpos, WINDOW_MENUBAR_HEIGHT});
328 break;
329 }
330 }
331 }
332
333 void WindowMenuBar::OnMouseUp(__attribute__((unused)) vector2i_t mousePos){
334

Callers 1

GUIHandleEventMethod · 0.45

Calls 3

GetTextLengthFunction · 0.85
DisplayContextMenuMethod · 0.80
GetSizeMethod · 0.45

Tested by

no test coverage detected