Gets the timestamp for the event. The timestamp is the time in milliseconds
since some fixed moment (not necessarily the standard Unix Epoch, so only
differences between the timestamps and not their absolute values usually make sense).
+
+ @warning
+ wxWidgets returns a non-NULL timestamp only for mouse and key events
+ (see wxMouseEvent and wxKeyEvent).
*/
long GetTimestamp() const;
/**
Sets the timestamp for the event.
*/
- void SetTimestamp(long = 0);
+ void SetTimestamp(long timeStamp = 0);
/**
Test if this event should be propagated or not, i.e. if the propagation level
Note that the @a win window @b must remain alive until the
wxEventBlocker object destruction.
*/
- wxEventBlocker(wxWindow* win, wxEventType type = wxEVT_ANY);
+ wxEventBlocker(wxWindow* win, wxEventType type = -1);
/**
Destructor. The blocker will remove itself from the chain of event handlers for
share the same string buffer internally. Use QueueEvent() to avoid
this.
- A copy of event is made by the function, so the original can be deleted
+ A copy of @a event is made by the function, so the original can be deleted
as soon as function returns (it is common that the original is created
on the stack). This requires that the wxEvent::Clone() method be
implemented by event so that it can be duplicated and stored until it
@param eventSink
Object whose member function should be called.
*/
- bool Disconnect(wxEventType eventType = wxEVT_NULL,
- wxObjectEventFunction function = NULL,
+ bool Disconnect(wxEventType eventType,
+ wxObjectEventFunction function,
wxObject* userData = NULL,
wxEvtHandler* eventSink = NULL);
This overload takes an additional range of source IDs.
*/
- bool Disconnect(int id, int lastId = wxID_ANY,
- wxEventType eventType = wxEVT_NULL,
+ bool Disconnect(int id, int lastId,
+ wxEventType eventType,
wxObjectEventFunction function = NULL,
wxObject* userData = NULL,
wxEvtHandler* eventSink = NULL);
The value of wxCommandEvent::GetSelection() is the tool id, or -1 if the mouse cursor
has moved off a tool.
@event{EVT_COMMAND_LEFT_CLICK(id, func)}
- Process a wxEVT_COMMAND_LEFT_CLICK command, which is generated by a control (Windows 95 and NT only).
+ Process a wxEVT_COMMAND_LEFT_CLICK command, which is generated by a control (wxMSW only).
@event{EVT_COMMAND_LEFT_DCLICK(id, func)}
- Process a wxEVT_COMMAND_LEFT_DCLICK command, which is generated by a control (Windows 95 and NT only).
+ Process a wxEVT_COMMAND_LEFT_DCLICK command, which is generated by a control (wxMSW only).
@event{EVT_COMMAND_RIGHT_CLICK(id, func)}
- Process a wxEVT_COMMAND_RIGHT_CLICK command, which is generated by a control (Windows 95 and NT only).
+ Process a wxEVT_COMMAND_RIGHT_CLICK command, which is generated by a control (wxMSW only).
@event{EVT_COMMAND_SET_FOCUS(id, func)}
- Process a wxEVT_COMMAND_SET_FOCUS command, which is generated by a control (Windows 95 and NT only).
+ Process a wxEVT_COMMAND_SET_FOCUS command, which is generated by a control (wxMSW only).
@event{EVT_COMMAND_KILL_FOCUS(id, func)}
- Process a wxEVT_COMMAND_KILL_FOCUS command, which is generated by a control (Windows 95 and NT only).
+ Process a wxEVT_COMMAND_KILL_FOCUS command, which is generated by a control (wxMSW only).
@event{EVT_COMMAND_ENTER(id, func)}
Process a wxEVT_COMMAND_ENTER command, which is generated by a control.
@endEventTable
/**
Constructor.
*/
- wxCommandEvent(wxEventType commandEventType = 0, int id = 0);
+ wxCommandEvent(wxEventType commandEventType = wxEVT_NULL, int id = 0);
/**
Returns client data pointer for a listbox or choice selection event
-/**
- Indicates how a wxHelpEvent was generated.
-*/
enum wxHelpEventOrigin
{
- wxHE_ORIGIN_UNKNOWN = -1, /**< unrecognized event source. */
- wxHE_ORIGIN_KEYBOARD, /**< event generated from F1 key press. */
+ wxHE_ORIGIN_UNKNOWN = -1,
+ wxHE_ORIGIN_KEYBOARD,
/** event generated by wxContextHelp or from the [?] button on
the title bar (Windows). */
class wxHelpEvent : public wxCommandEvent
{
public:
+ /**
+ Indicates how a wxHelpEvent was generated.
+ */
+ enum Origin
+ {
+ Origin_Unknown, /**< unrecognized event source. */
+ Origin_Keyboard, /**< event generated from F1 key press. */
+
+ /** event generated by wxContextHelp or from the [?] button on
+ the title bar (Windows). */
+ Origin_HelpButton
+ };
+
/**
Constructor.
*/
wxHelpEvent(wxEventType type = wxEVT_NULL,
wxWindowID winid = 0,
const wxPoint& pt = wxDefaultPosition,
- wxHelpEventOrigin origin = wxHE_ORIGIN_UNKNOWN);
+ wxHelpEvent::Origin origin = Origin_Unknown);
/**
Returns the origin of the help event which is one of the ::wxHelpEventOrigin
@see SetOrigin()
*/
- wxHelpEventOrigin GetOrigin() const;
+ wxHelpEvent::Origin GetOrigin() const;
/**
Returns the left-click position of the mouse, in screen coordinates.
@see GetOrigin()
*/
- void SetOrigin(wxHelpEventOrigin);
+ void SetOrigin(wxHelpEvent::Origin origin);
/**
Sets the left-click position of the mouse, in screen coordinates.
This allows the wxWindow::Close function to return @true or @false depending
on whether the close instruction was honoured or not.
+ Example of a wxCloseEvent handler:
+
+ @code
+ void MyFrame::OnClose(wxCloseEvent& event)
+ {
+ if ( event.CanVeto() && m_bFileNotSaved )
+ {
+ if ( wxMessageBox("The file has not been saved... continue closing?",
+ "Please confirm",
+ wxICON_QUESTION | wxYES_NO) != wxYES )
+ {
+ event.Veto();
+ return;
+ }
+ }
+
+ Destroy(); // you may also do: event.Skip();
+ // since the default event handler does call Destroy(), too
+ }
+ @endcode
+
The EVT_END_SESSION event is slightly different as it is sent by the system
when the user session is ending (e.g. because of log out or shutdown) and
so all windows are being forcefully closed. At least under MSW, after the
*/
void SetCanVeto(bool canVeto);
- /**
- Sets the 'force' flag.
- */
- void SetForce(bool force) const;
-
/**
Sets the 'logging off' flag.
*/