[ 1572220 ] Show popup when wxComboCtrl image area clicked
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41731 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -90,7 +90,9 @@ enum
|
|||||||
// Flags used by PreprocessMouseEvent and HandleButtonMouseEvent
|
// Flags used by PreprocessMouseEvent and HandleButtonMouseEvent
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
wxCC_MF_ON_BUTTON = 0x0001 // cursor is on dropbutton area
|
wxCC_MF_ON_BUTTON = 0x0001, // cursor is on dropbutton area
|
||||||
|
wxCC_MF_ON_CLICK_AREA = 0x0002 // cursor is on dropbutton or other area
|
||||||
|
// that can be clicked to show the popup.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1302,11 +1302,7 @@ bool wxComboCtrlBase::HandleButtonMouseEvent( wxMouseEvent& event,
|
|||||||
}
|
}
|
||||||
else if ( type == wxEVT_LEFT_DOWN )
|
else if ( type == wxEVT_LEFT_DOWN )
|
||||||
{
|
{
|
||||||
// Only accept event if it wasn't right after popup dismiss
|
if ( flags & (wxCC_MF_ON_CLICK_AREA|wxCC_MF_ON_BUTTON) )
|
||||||
//if ( ::wxGetLocalTimeMillis() > m_timeCanClick )
|
|
||||||
{
|
|
||||||
// Need to test this, because it might be outside.
|
|
||||||
if ( flags & wxCC_MF_ON_BUTTON )
|
|
||||||
{
|
{
|
||||||
m_btnState |= wxCONTROL_PRESSED;
|
m_btnState |= wxCONTROL_PRESSED;
|
||||||
Refresh();
|
Refresh();
|
||||||
@@ -1318,11 +1314,6 @@ bool wxComboCtrlBase::HandleButtonMouseEvent( wxMouseEvent& event,
|
|||||||
CaptureMouse();
|
CaptureMouse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*else
|
|
||||||
{
|
|
||||||
m_btnState = 0;
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
else if ( type == wxEVT_LEFT_UP )
|
else if ( type == wxEVT_LEFT_UP )
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1335,7 +1326,7 @@ bool wxComboCtrlBase::HandleButtonMouseEvent( wxMouseEvent& event,
|
|||||||
// If mouse was inside, fire the click event.
|
// If mouse was inside, fire the click event.
|
||||||
if ( m_iFlags & wxCC_POPUP_ON_MOUSE_UP )
|
if ( m_iFlags & wxCC_POPUP_ON_MOUSE_UP )
|
||||||
{
|
{
|
||||||
if ( flags & wxCC_MF_ON_BUTTON )
|
if ( flags & (wxCC_MF_ON_CLICK_AREA|wxCC_MF_ON_BUTTON) )
|
||||||
OnButtonClick();
|
OnButtonClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -280,11 +280,10 @@ void wxGenericComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
|||||||
|
|
||||||
void wxGenericComboCtrl::OnMouseEvent( wxMouseEvent& event )
|
void wxGenericComboCtrl::OnMouseEvent( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
bool isOnButtonArea = m_btnArea.Contains(event.m_x,event.m_y);
|
int mx = event.m_x;
|
||||||
|
bool isOnButtonArea = m_btnArea.Contains(mx,event.m_y);
|
||||||
int handlerFlags = isOnButtonArea ? wxCC_MF_ON_BUTTON : 0;
|
int handlerFlags = isOnButtonArea ? wxCC_MF_ON_BUTTON : 0;
|
||||||
|
|
||||||
// Preprocessing fabricates double-clicks and prevents
|
|
||||||
// (it may also do other common things in future)
|
|
||||||
if ( PreprocessMouseEvent(event,handlerFlags) )
|
if ( PreprocessMouseEvent(event,handlerFlags) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -301,8 +300,11 @@ void wxGenericComboCtrl::OnMouseEvent( wxMouseEvent& event )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( isOnButtonArea || HasCapture() )
|
if ( isOnButtonArea || HasCapture() ||
|
||||||
|
(m_widthCustomPaint && mx < (m_tcArea.x+m_widthCustomPaint)) )
|
||||||
{
|
{
|
||||||
|
handlerFlags |= wxCC_MF_ON_CLICK_AREA;
|
||||||
|
|
||||||
if ( HandleButtonMouseEvent(event,handlerFlags) )
|
if ( HandleButtonMouseEvent(event,handlerFlags) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -489,11 +489,10 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
|||||||
|
|
||||||
void wxComboCtrl::OnMouseEvent( wxMouseEvent& event )
|
void wxComboCtrl::OnMouseEvent( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
bool isOnButtonArea = m_btnArea.Contains(event.m_x,event.m_y);
|
int mx = event.m_x;
|
||||||
|
bool isOnButtonArea = m_btnArea.Contains(mx,event.m_y);
|
||||||
int handlerFlags = isOnButtonArea ? wxCC_MF_ON_BUTTON : 0;
|
int handlerFlags = isOnButtonArea ? wxCC_MF_ON_BUTTON : 0;
|
||||||
|
|
||||||
// Preprocessing fabricates double-clicks and prevents
|
|
||||||
// (it may also do other common things in future)
|
|
||||||
if ( PreprocessMouseEvent(event,isOnButtonArea) )
|
if ( PreprocessMouseEvent(event,isOnButtonArea) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -507,8 +506,11 @@ void wxComboCtrl::OnMouseEvent( wxMouseEvent& event )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( isOnButtonArea || HasCapture() )
|
if ( isOnButtonArea || HasCapture() ||
|
||||||
|
(m_widthCustomPaint && mx < (m_tcArea.x+m_widthCustomPaint)) )
|
||||||
{
|
{
|
||||||
|
handlerFlags |= wxCC_MF_ON_CLICK_AREA;
|
||||||
|
|
||||||
if ( HandleButtonMouseEvent(event,handlerFlags) )
|
if ( HandleButtonMouseEvent(event,handlerFlags) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user