// Internal functions void wxGenericColourDialog::OnMouseEvent(wxMouseEvent& event) { if (event.ButtonDown(wxMOUSE_BTN_LEFT)) { int x = (int)event.GetX(); int y = (int)event.GetY(); if ((x >= m_standardColoursRect.x && x <= (m_standardColoursRect.x + m_standardColoursRect.width)) && (y >= m_standardColoursRect.y && y <= (m_standardColoursRect.y + m_standardColoursRect.height))) { int selX = (int)(x - m_standardColoursRect.x)/(m_smallRectangleSize.x + m_gridSpacing); int selY = (int)(y - m_standardColoursRect.y)/(m_smallRectangleSize.y + m_gridSpacing); int ptr = (int)(selX + selY*8); OnBasicColourClick(ptr); } // wxStaticBitmap (used to ARGB preview) events are handled in the dedicated handler. #if !wxCLRDLGG_USE_PREVIEW_WITH_ALPHA else if ((x >= m_customColoursRect.x && x <= (m_customColoursRect.x + m_customColoursRect.width)) && (y >= m_customColoursRect.y && y <= (m_customColoursRect.y + m_customColoursRect.height))) { int selX = (int)(x - m_customColoursRect.x)/(m_smallRectangleSize.x + m_gridSpacing); int selY = (int)(y - m_customColoursRect.y)/(m_smallRectangleSize.y + m_gridSpacing); int ptr = (int)(selX + selY*8); OnCustomColourClick(ptr); } #endif else event.Skip(); } else event.Skip(); }
// Internal functions void wxGenericColourDialog::OnMouseEvent(wxMouseEvent& event) { if (event.ButtonDown(1)) { int x = (int)event.GetX(); int y = (int)event.GetY(); if ((x >= m_standardColoursRect.x && x <= (m_standardColoursRect.x + m_standardColoursRect.width)) && (y >= m_standardColoursRect.y && y <= (m_standardColoursRect.y + m_standardColoursRect.height))) { int selX = (int)(x - m_standardColoursRect.x)/(m_smallRectangleSize.x + m_gridSpacing); int selY = (int)(y - m_standardColoursRect.y)/(m_smallRectangleSize.y + m_gridSpacing); int ptr = (int)(selX + selY*8); OnBasicColourClick(ptr); } else if ((x >= m_customColoursRect.x && x <= (m_customColoursRect.x + m_customColoursRect.width)) && (y >= m_customColoursRect.y && y <= (m_customColoursRect.y + m_customColoursRect.height))) { int selX = (int)(x - m_customColoursRect.x)/(m_smallRectangleSize.x + m_gridSpacing); int selY = (int)(y - m_customColoursRect.y)/(m_smallRectangleSize.y + m_gridSpacing); int ptr = (int)(selX + selY*8); OnCustomColourClick(ptr); } else event.Skip(); } else event.Skip(); }
void wxGenericColourDialog::OnCustomColourMouseClick(wxMouseEvent& event) { // Find index of custom colour // and call the handler. for (int i = 0; i < WXSIZEOF(m_customColoursBmp); i++) { if ( m_customColoursBmp[i]->GetId() == event.GetId() ) { OnCustomColourClick(i); return; } } event.Skip(); }
// Internal functions void wxGenericColourDialog::OnMouseEvent(wxMouseEvent& event) { if (event.ButtonDown(1)) { int x = (int)event.GetX(); int y = (int)event.GetY(); #ifdef __WXPM__ // Handle OS/2's reverse coordinate system and account for the dialog title int nClientHeight; GetClientSize(NULL, &nClientHeight); y = (nClientHeight - y) + 20; #endif if ((x >= standardColoursRect.x && x <= (standardColoursRect.x + standardColoursRect.width)) && (y >= standardColoursRect.y && y <= (standardColoursRect.y + standardColoursRect.height))) { int selX = (int)(x - standardColoursRect.x)/(smallRectangleSize.x + gridSpacing); int selY = (int)(y - standardColoursRect.y)/(smallRectangleSize.y + gridSpacing); int ptr = (int)(selX + selY*8); OnBasicColourClick(ptr); } else if ((x >= customColoursRect.x && x <= (customColoursRect.x + customColoursRect.width)) && (y >= customColoursRect.y && y <= (customColoursRect.y + customColoursRect.height))) { int selX = (int)(x - customColoursRect.x)/(smallRectangleSize.x + gridSpacing); int selY = (int)(y - customColoursRect.y)/(smallRectangleSize.y + gridSpacing); int ptr = (int)(selX + selY*8); OnCustomColourClick(ptr); } else event.Skip(); } else event.Skip(); }