wxComboPopupExtraEventHandler Class Reference

List of all members.

Public Member Functions

 wxComboPopupExtraEventHandler (wxComboCtrlBase *combo)
 ~wxComboPopupExtraEventHandler ()
void OnMouseEvent (wxMouseEvent &event)
void OnPopupDismiss ()

Protected Attributes

wxComboCtrlBasem_combo
bool m_beenInside

Detailed Description

Definition at line 522 of file combo.cpp.


Constructor & Destructor Documentation

wxComboPopupExtraEventHandler::wxComboPopupExtraEventHandler wxComboCtrlBase combo  )  [inline]
 

Definition at line 526 of file combo.cpp.

00527         : wxEvtHandler()
00528     {
00529         m_combo = combo;
00530         m_beenInside = false;
00531     }

wxComboPopupExtraEventHandler::~wxComboPopupExtraEventHandler  )  [inline]
 

Definition at line 532 of file combo.cpp.

00532 { }


Member Function Documentation

void wxComboPopupExtraEventHandler::OnMouseEvent wxMouseEvent &  event  ) 
 

Definition at line 557 of file combo.cpp.

00558 {
00559     wxPoint pt = event.GetPosition();
00560     wxSize sz = m_combo->GetPopupControl()->GetControl()->GetClientSize();
00561     int evtType = event.GetEventType();
00562     bool isInside = pt.x >= 0 && pt.y >= 0 && pt.x < sz.x && pt.y < sz.y;
00563 
00564     if ( evtType == wxEVT_MOTION ||
00565          evtType == wxEVT_LEFT_DOWN ||
00566          evtType == wxEVT_RIGHT_DOWN )
00567     {
00568         // Block motion and click events outside the popup
00569         if ( !isInside )
00570         {
00571             event.Skip(false);
00572             return;
00573         }
00574     }
00575     else if ( evtType == wxEVT_LEFT_UP )
00576     {
00577         // Don't let left-down events in if outside
00578         if ( evtType == wxEVT_LEFT_DOWN )
00579         {
00580             if ( !isInside )
00581                 return;
00582         }
00583 
00584         if ( !m_beenInside )
00585         {
00586             if ( isInside )
00587             {
00588                 m_beenInside = true;
00589             }
00590             else
00591             {
00592                 //
00593                 // Some mouse events to popup that happen outside it, before cursor
00594                 // has been inside the popu, need to be ignored by it but relayed to
00595                 // the dropbutton.
00596                 //
00597                 wxWindow* btn = m_combo->GetButton();
00598                 if ( btn )
00599                     btn->GetEventHandler()->AddPendingEvent(event);
00600                 else
00601                     m_combo->GetEventHandler()->AddPendingEvent(event);
00602 
00603                 return;
00604             }
00605 
00606             event.Skip();
00607         }
00608     }
00609 
00610     event.Skip();
00611 }

void wxComboPopupExtraEventHandler::OnPopupDismiss  )  [inline]
 

Definition at line 537 of file combo.cpp.

00538     {
00539         m_beenInside = false;
00540     }


Member Data Documentation

bool wxComboPopupExtraEventHandler::m_beenInside [protected]
 

Definition at line 545 of file combo.cpp.

wxComboCtrlBase* wxComboPopupExtraEventHandler::m_combo [protected]
 

Definition at line 543 of file combo.cpp.


The documentation for this class was generated from the following file:
Generated on Sat Nov 10 04:03:17 2007 for Camelot by  doxygen 1.4.4