bool GraphicsWindow::ToolbarMouseMoved(int x, int y) { x += ((int)width/2); y += ((int)height/2); int nh = 0; bool withinToolbar = ToolbarDrawOrHitTest(x, y, false, &nh); if(!withinToolbar) nh = 0; if(nh != toolbarTooltipped) { // Don't let the tool tip move around if the mouse moves within the // same item. toolbarMouseX = x; toolbarMouseY = y; toolbarTooltipped = 0; } if(nh != toolbarHovered) { toolbarHovered = nh; SetTimerFor(1000); PaintGraphics(); } // So if we moved off the toolbar, then toolbarHovered is now equal to // zero, so it doesn't matter if the tool tip timer expires. And if // we moved from one item to another, we reset the timer, so also okay. return withinToolbar; }
bool GraphicsWindow::ToolbarMouseDown(int x, int y) { x += ((int)width/2); y += ((int)height/2); int nh = -1; bool withinToolbar = ToolbarDrawOrHitTest(x, y, false, &nh); // They might have clicked within the toolbar, but not on a button. if(withinToolbar && nh >= 0) { for(int i = 0; SS.GW.menu[i].level >= 0; i++) { if(nh == SS.GW.menu[i].id) { (SS.GW.menu[i].fn)((GraphicsWindow::MenuId)SS.GW.menu[i].id); break; } } } return withinToolbar; }
bool GraphicsWindow::ToolbarMouseDown(int x, int y) { x += ((int)width/2); y += ((int)height/2); Command nh = Command::NONE; bool withinToolbar = ToolbarDrawOrHitTest(x, y, /*paint=*/false, &nh); // They might have clicked within the toolbar, but not on a button. if(withinToolbar && nh != Command::NONE) { for(int i = 0; SS.GW.menu[i].level >= 0; i++) { if(nh == SS.GW.menu[i].id) { (SS.GW.menu[i].fn)((Command)SS.GW.menu[i].id); break; } } } return withinToolbar; }
void GraphicsWindow::ToolbarDraw(void) { ToolbarDrawOrHitTest(0, 0, true, NULL); }
void GraphicsWindow::ToolbarDraw() { ToolbarDrawOrHitTest(0, 0, /*paint=*/true, NULL); }