From 7b504551c292ecb4296693983161ac5ad03745f6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Sat, 29 Oct 2005 12:48:07 +0000 Subject: [PATCH] Pressing build-in joystick on WinCE phones fires wxEVT_JOY_BUTTON_DOWN event. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36034 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 6 ++++-- include/wx/generic/choicdgg.h | 8 +++++++- src/generic/choicdgg.cpp | 27 +++++++++++++++++++++------ src/msw/window.cpp | 7 ++++++- 4 files changed, 38 insertions(+), 10 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 0ef71d499a..d356938603 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -31,6 +31,10 @@ wxMSW: - Switching page of a hidden notebook doesn't lose focus (Jamie Gadd). - Removed wxImageList *GetImageList(int) const. +wxWinCE: + +- Pressing build-in joystick on WinCE phones fires wxEVT_JOY_BUTTON_DOWN event. + Unix: - NO_GCC_PRAGMA is not used any more, remove checks for it if you used it. @@ -2526,5 +2530,3 @@ At this point, the following has been achieved: - utils/wxprop classes working (except maybe wxPropertyFormView) in preparation for use in Dialog Editor. - GNU-WIN32 compilation verified (a month or so ago). - - diff --git a/include/wx/generic/choicdgg.h b/include/wx/generic/choicdgg.h index 074e9685e5..6678bc16b4 100644 --- a/include/wx/generic/choicdgg.h +++ b/include/wx/generic/choicdgg.h @@ -138,12 +138,19 @@ public: // implementation from now on void OnOK(wxCommandEvent& event); +#ifndef __SMARTPHONE__ void OnListBoxDClick(wxCommandEvent& event); +#endif +#ifdef __WXWINCE__ + void OnJoystickButtonDown(wxJoystickEvent& event); +#endif protected: int m_selection; wxString m_stringSelection; + void DoChoice(); + private: DECLARE_DYNAMIC_CLASS_NO_COPY(wxSingleChoiceDialog) DECLARE_EVENT_TABLE() @@ -301,4 +308,3 @@ WXDLLEXPORT size_t wxGetMultipleChoices(wxArrayInt& selections, int height = wxCHOICE_HEIGHT); #endif // __CHOICEDLGH_G__ - diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index 9a4874208f..cd5743cbae 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: choicdgg.cpp +// Name: src/generic/choicdgg.cpp // Purpose: Choice dialogs // Author: Julian Smart // Modified by: 03.11.00: VZ to add wxArrayString and multiple sel functions @@ -332,7 +332,12 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent, BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog) EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK) +#ifndef __SMARTPHONE__ EVT_LISTBOX_DCLICK(wxID_LISTBOX, wxSingleChoiceDialog::OnListBoxDClick) +#endif +#ifdef __WXWINCE__ + EVT_JOY_BUTTON_DOWN(wxSingleChoiceDialog::OnJoystickButtonDown) +#endif END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxSingleChoiceDialog, wxDialog) @@ -407,14 +412,24 @@ void wxSingleChoiceDialog::SetSelection(int sel) void wxSingleChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event)) { - m_selection = m_listbox->GetSelection(); - m_stringSelection = m_listbox->GetStringSelection(); - if ( m_listbox->HasClientUntypedData() ) - SetClientData(m_listbox->GetClientData(m_selection)); - EndModal(wxID_OK); + DoChoice(); } +#ifndef __SMARTPHONE__ void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event)) +{ + DoChoice(); +} +#endif + +#ifdef __WXWINCE__ +void wxSingleChoiceDialog::OnJoystickButtonDown(wxJoystickEvent& WXUNUSED(event)) +{ + DoChoice(); +} +#endif + +void wxSingleChoiceDialog::DoChoice() { m_selection = m_listbox->GetSelection(); m_stringSelection = m_listbox->GetStringSelection(); diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 48d244b115..bc738d5058 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -2064,6 +2064,12 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) else // no default button #endif // wxUSE_BUTTON { +#ifdef __WXWINCE__ + wxJoystickEvent event(wxEVT_JOY_BUTTON_DOWN); + event.SetEventObject(this); + if(GetEventHandler()->ProcessEvent(event)) + return true; +#endif // this is a quick and dirty test for a text // control if ( !(lDlgCode & DLGC_HASSETSEL) ) @@ -6202,4 +6208,3 @@ void wxWindowMSW::OnInitDialog( wxInitDialogEvent& event ) event.Skip(); } #endif - -- 2.45.2