[ 1557326 ] Remove redundant code from wxComboCtrl
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41264 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -293,6 +293,12 @@ public:
|
|||||||
return m_absIndent;
|
return m_absIndent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns area covered by the text field.
|
||||||
|
const wxRect& GetTextRect() const
|
||||||
|
{
|
||||||
|
return m_tcArea;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Utilies needed by the popups or native implementations
|
// Utilies needed by the popups or native implementations
|
||||||
//
|
//
|
||||||
@@ -370,9 +376,7 @@ protected:
|
|||||||
//bool HandleButtonMouseEvent( wxMouseEvent& event, bool isInside );
|
//bool HandleButtonMouseEvent( wxMouseEvent& event, bool isInside );
|
||||||
bool HandleButtonMouseEvent( wxMouseEvent& event, int flags );
|
bool HandleButtonMouseEvent( wxMouseEvent& event, int flags );
|
||||||
|
|
||||||
// Conversion to double-clicks and some basic filtering
|
|
||||||
// returns true if event was consumed or filtered (event type is also set to 0 in this case)
|
// returns true if event was consumed or filtered (event type is also set to 0 in this case)
|
||||||
//bool PreprocessMouseEvent( wxMouseEvent& event, bool isOnButtonArea );
|
|
||||||
bool PreprocessMouseEvent( wxMouseEvent& event, int flags );
|
bool PreprocessMouseEvent( wxMouseEvent& event, int flags );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -452,9 +456,6 @@ protected:
|
|||||||
// this is for the control in popup
|
// this is for the control in popup
|
||||||
wxEvtHandler* m_popupExtraHandler;
|
wxEvtHandler* m_popupExtraHandler;
|
||||||
|
|
||||||
// needed for "instant" double-click handling
|
|
||||||
wxLongLong m_timeLastMouseUp;
|
|
||||||
|
|
||||||
// used to prevent immediate re-popupping incase closed popup
|
// used to prevent immediate re-popupping incase closed popup
|
||||||
// by clicking on the combo control (needed because of inconsistent
|
// by clicking on the combo control (needed because of inconsistent
|
||||||
// transient implementation across platforms).
|
// transient implementation across platforms).
|
||||||
@@ -518,9 +519,6 @@ protected:
|
|||||||
// is the popup window currenty shown?
|
// is the popup window currenty shown?
|
||||||
bool m_isPopupShown;
|
bool m_isPopupShown;
|
||||||
|
|
||||||
// Set to 1 on mouse down, 0 on mouse up. Used to eliminate down-less mouse ups.
|
|
||||||
bool m_downReceived;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
@@ -646,7 +646,6 @@ void wxComboCtrlBase::Init()
|
|||||||
m_extRight = 0;
|
m_extRight = 0;
|
||||||
m_absIndent = -1;
|
m_absIndent = -1;
|
||||||
m_iFlags = 0;
|
m_iFlags = 0;
|
||||||
m_downReceived = false;
|
|
||||||
m_timeCanAcceptClick = 0;
|
m_timeCanAcceptClick = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1346,11 +1345,9 @@ bool wxComboCtrlBase::HandleButtonMouseEvent( wxMouseEvent& event,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Conversion to double-clicks and some basic filtering
|
|
||||||
// returns true if event was consumed or filtered
|
// returns true if event was consumed or filtered
|
||||||
//bool wxComboCtrlBase::PreprocessMouseEvent( wxMouseEvent& event, bool isOnButtonArea )
|
|
||||||
bool wxComboCtrlBase::PreprocessMouseEvent( wxMouseEvent& event,
|
bool wxComboCtrlBase::PreprocessMouseEvent( wxMouseEvent& event,
|
||||||
int flags )
|
int WXUNUSED(flags) )
|
||||||
{
|
{
|
||||||
wxLongLong t = ::wxGetLocalTimeMillis();
|
wxLongLong t = ::wxGetLocalTimeMillis();
|
||||||
int evtType = event.GetEventType();
|
int evtType = event.GetEventType();
|
||||||
@@ -1364,48 +1361,6 @@ bool wxComboCtrlBase::PreprocessMouseEvent( wxMouseEvent& event,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
|
||||||
// Generate our own double-clicks
|
|
||||||
// (to allow on-focus dc-event on double-clicks instead of triple-clicks)
|
|
||||||
if ( (m_windowStyle & wxCC_SPECIAL_DCLICK) &&
|
|
||||||
!m_isPopupShown &&
|
|
||||||
//!(handlerFlags & wxCC_MF_ON_BUTTON) )
|
|
||||||
!(flags & wxCC_MF_ON_BUTTON) )
|
|
||||||
{
|
|
||||||
if ( evtType == wxEVT_LEFT_DOWN )
|
|
||||||
{
|
|
||||||
// Set value to avoid up-events without corresponding downs
|
|
||||||
m_downReceived = true;
|
|
||||||
}
|
|
||||||
else if ( evtType == wxEVT_LEFT_DCLICK )
|
|
||||||
{
|
|
||||||
// We'll make our own double-clicks
|
|
||||||
//evtType = 0;
|
|
||||||
event.SetEventType(0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if ( evtType == wxEVT_LEFT_UP )
|
|
||||||
{
|
|
||||||
if ( m_downReceived || m_timeLastMouseUp == 1 )
|
|
||||||
{
|
|
||||||
wxLongLong timeFromLastUp = (t-m_timeLastMouseUp);
|
|
||||||
|
|
||||||
if ( timeFromLastUp < DOUBLE_CLICK_CONVERSION_TRESHOLD )
|
|
||||||
{
|
|
||||||
//type = wxEVT_LEFT_DCLICK;
|
|
||||||
event.SetEventType(wxEVT_LEFT_DCLICK);
|
|
||||||
m_timeLastMouseUp = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_timeLastMouseUp = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
//m_downReceived = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter out clicks on button immediately after popup dismiss (Windows like behaviour)
|
// Filter out clicks on button immediately after popup dismiss (Windows like behaviour)
|
||||||
if ( evtType == wxEVT_LEFT_DOWN && t < m_timeCanAcceptClick )
|
if ( evtType == wxEVT_LEFT_DOWN && t < m_timeCanAcceptClick )
|
||||||
{
|
{
|
||||||
@@ -1511,12 +1466,6 @@ void wxComboCtrlBase::OnFocusEvent( wxFocusEvent& event )
|
|||||||
{
|
{
|
||||||
if ( event.GetEventType() == wxEVT_SET_FOCUS )
|
if ( event.GetEventType() == wxEVT_SET_FOCUS )
|
||||||
{
|
{
|
||||||
// First click is the first part of double-click
|
|
||||||
// Some platforms don't generate down-less mouse up-event
|
|
||||||
// (Windows does, GTK+2 doesn't), so that's why we have
|
|
||||||
// to do this.
|
|
||||||
m_timeLastMouseUp = ::wxGetLocalTimeMillis();
|
|
||||||
|
|
||||||
if ( m_text && m_text != ::wxWindow::FindFocus() )
|
if ( m_text && m_text != ::wxWindow::FindFocus() )
|
||||||
m_text->SetFocus();
|
m_text->SetFocus();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user