wxContextMenuEvent Class Reference
[Events]

#include <wx/event.h>

Inheritance diagram for wxContextMenuEvent:

wxCommandEvent wxEvent wxObject

List of all members.


Detailed Description

This class is used for context menu events, sent to give the application a chance to show a context (popup) menu.

Note that if wxContextMenuEvent::GetPosition returns wxDefaultPosition, this means that the event originated from a keyboard context button event, and you should compute a suitable position yourself, for example by calling wxGetMousePosition().

When a keyboard context menu button is pressed on Windows, a right-click event with default position is sent first, and if this event is not processed, the context menu event is sent. So if you process mouse events and you find your context menu event handler is not being called, you could call wxEvent::Skip() for mouse right-down events.

Events:

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxContextMenuEvent& event)

Event macros:
Library:  wxCore

Category:  Events

See also:
wxCommandEvent, Event Handling

Public Member Functions

 wxContextMenuEvent (wxEventType id=wxEVT_NULL, int id=0, const wxPoint &pos=wxDefaultPosition)
const wxPointGetPosition () const
void SetPosition (const wxPoint &point)

Constructor & Destructor Documentation

wxContextMenuEvent::wxContextMenuEvent ( wxEventType  id = wxEVT_NULL,
int  id = 0,
const wxPoint pos = wxDefaultPosition 
)

Constructor.


Member Function Documentation

const wxPoint& wxContextMenuEvent::GetPosition (  )  const

Returns the position in screen coordinates at which the menu should be shown. Use wxWindow::ScreenToClient to convert to client coordinates.

You can also omit a position from wxWindow::PopupMenu in order to use the current mouse pointer position.

If the event originated from a keyboard event, the value returned from this function will be wxDefaultPosition.

void wxContextMenuEvent::SetPosition ( const wxPoint point  ) 

Sets the position at which the menu should be shown.



wxWidgets logo

[ top ]