Add wxActivateEvent::GetActivationReason().
This method is implemented for wxMSW-only currently and allows to check whether the window is being activated by a mouse click or in some other way there. Closes #15516. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74915 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -581,6 +581,7 @@ All (GUI):
|
|||||||
- Fix alignment and transparency of bitmaps in wxDataViewCtrl (Eric Jensen).
|
- Fix alignment and transparency of bitmaps in wxDataViewCtrl (Eric Jensen).
|
||||||
- Fix crash when auto-sizing a wxDataViewCtrl column (Spencer T. Parkin).
|
- Fix crash when auto-sizing a wxDataViewCtrl column (Spencer T. Parkin).
|
||||||
- Add wxHtmlTag::GetParamAsString() convenience method.
|
- Add wxHtmlTag::GetParamAsString() convenience method.
|
||||||
|
- Add wxActivateEvent::GetActivationReason() (Trigve).
|
||||||
|
|
||||||
wxGTK:
|
wxGTK:
|
||||||
|
|
||||||
|
@@ -2275,19 +2275,36 @@ private:
|
|||||||
class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent
|
class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, int Id = 0)
|
// Type of activation. For now we can only detect if it was by mouse or by
|
||||||
: wxEvent(Id, type)
|
// some other method and even this is only available under wxMSW.
|
||||||
{ m_active = active; }
|
enum Reason
|
||||||
|
{
|
||||||
|
Reason_Mouse,
|
||||||
|
Reason_Unknown
|
||||||
|
};
|
||||||
|
|
||||||
|
wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true,
|
||||||
|
int Id = 0, Reason activationReason = Reason_Unknown)
|
||||||
|
: wxEvent(Id, type),
|
||||||
|
m_activationReason(activationReason)
|
||||||
|
{
|
||||||
|
m_active = active;
|
||||||
|
}
|
||||||
wxActivateEvent(const wxActivateEvent& event)
|
wxActivateEvent(const wxActivateEvent& event)
|
||||||
: wxEvent(event)
|
: wxEvent(event)
|
||||||
{ m_active = event.m_active; }
|
{
|
||||||
|
m_active = event.m_active;
|
||||||
|
m_activationReason = event.m_activationReason;
|
||||||
|
}
|
||||||
|
|
||||||
bool GetActive() const { return m_active; }
|
bool GetActive() const { return m_active; }
|
||||||
|
Reason GetActivationReason() const { return m_activationReason;}
|
||||||
|
|
||||||
virtual wxEvent *Clone() const { return new wxActivateEvent(*this); }
|
virtual wxEvent *Clone() const { return new wxActivateEvent(*this); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_active;
|
bool m_active;
|
||||||
|
Reason m_activationReason;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent)
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent)
|
||||||
|
@@ -2976,16 +2976,46 @@ public:
|
|||||||
class wxActivateEvent : public wxEvent
|
class wxActivateEvent : public wxEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
Specifies the reason for the generation of this event.
|
||||||
|
|
||||||
|
See GetActivationReason().
|
||||||
|
|
||||||
|
@since 3.0
|
||||||
|
*/
|
||||||
|
enum Reason
|
||||||
|
{
|
||||||
|
/// Window activated by mouse click.
|
||||||
|
Reason_Mouse,
|
||||||
|
/// Window was activated with some other method than mouse click.
|
||||||
|
Reason_Unknown
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructor.
|
Constructor.
|
||||||
*/
|
*/
|
||||||
wxActivateEvent(wxEventType eventType = wxEVT_NULL, bool active = true,
|
wxActivateEvent(wxEventType eventType = wxEVT_NULL, bool active = true,
|
||||||
int id = 0);
|
int id = 0, Reason ActivationReason = Reason_Unknown);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns @true if the application or window is being activated, @false otherwise.
|
Returns @true if the application or window is being activated, @false otherwise.
|
||||||
*/
|
*/
|
||||||
bool GetActive() const;
|
bool GetActive() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Allows to check if the window was activated by clicking it with the
|
||||||
|
mouse or in some other way.
|
||||||
|
|
||||||
|
This method is currently only implemented in wxMSW and returns @c
|
||||||
|
Reason_Mouse there if the window was activated by a mouse click and @c
|
||||||
|
Reason_Unknown if it was activated in any other way (e.g. from
|
||||||
|
keyboard or programmatically).
|
||||||
|
|
||||||
|
Under all the other platforms, @c Reason_Unknown is always returned.
|
||||||
|
|
||||||
|
@since 3.0
|
||||||
|
*/
|
||||||
|
Reason GetActivationReason() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -4049,7 +4049,10 @@ bool wxWindowMSW::HandleActivate(int state,
|
|||||||
{
|
{
|
||||||
wxActivateEvent event(wxEVT_ACTIVATE,
|
wxActivateEvent event(wxEVT_ACTIVATE,
|
||||||
(state == WA_ACTIVE) || (state == WA_CLICKACTIVE),
|
(state == WA_ACTIVE) || (state == WA_CLICKACTIVE),
|
||||||
m_windowId);
|
m_windowId,
|
||||||
|
state == WA_CLICKACTIVE
|
||||||
|
? wxActivateEvent::Reason_Mouse
|
||||||
|
: wxActivateEvent::Reason_Unknown);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
return HandleWindowEvent(event);
|
return HandleWindowEvent(event);
|
||||||
|
Reference in New Issue
Block a user