Different default buttons for native menubars on Smartphones.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-06-21 08:31:04 +00:00
parent eaee975aca
commit ef6d716b00
3 changed files with 43 additions and 13 deletions

View File

@@ -47,6 +47,10 @@
#include <commdlg.h> #include <commdlg.h>
#endif #endif
#ifdef __SMARTPHONE__
#include "wx/msw/wince/resources.h"
#endif // __SMARTPHONE__
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxWin macros // wxWin macros
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -106,9 +110,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow)
#endif #endif
BEGIN_EVENT_TABLE(wxDialog, wxDialogBase) BEGIN_EVENT_TABLE(wxDialog, wxDialogBase)
#ifdef __SMARTPHONE__
EVT_MENU(wxID_OK, wxDialog::OnOK)
EVT_MENU(wxID_APPLY, wxDialog::OnApply)
EVT_MENU(wxID_CANCEL, wxDialog::OnCancel)
#else
EVT_BUTTON(wxID_OK, wxDialog::OnOK) EVT_BUTTON(wxID_OK, wxDialog::OnOK)
EVT_BUTTON(wxID_APPLY, wxDialog::OnApply) EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel) EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
#endif
EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged) EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged)
@@ -182,6 +192,10 @@ bool wxDialog::Create(wxWindow *parent,
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
#ifdef __SMARTPHONE__
SetLeftMenu(wxID_OK, _("OK"));
#endif
return true; return true;
} }
@@ -437,18 +451,28 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar
#ifdef __WXWINCE__ #ifdef __WXWINCE__
// react to pressing the OK button in the title // react to pressing the OK button in the title
case WM_COMMAND: case WM_COMMAND:
if (LOWORD(wParam) == IDOK) {
switch ( LOWORD(wParam) )
{ {
wxButton *btn = wxDynamicCast(FindWindow(wxID_CANCEL), wxButton); #ifndef __SMARTPHONE__
if ( btn && btn->IsEnabled() ) case IDOK:
{ wxButton *btn = wxDynamicCast(FindWindow(wxID_CANCEL), wxButton);
// if we do have a cancel button, do press it if ( btn && btn->IsEnabled() )
btn->MSWCommand(BN_CLICKED, 0 /* unused */); {
processed = true; // if we do have a cancel button, do press it
btn->MSWCommand(BN_CLICKED, 0 /* unused */);
processed = true;
break;
}
#else // ifdef __SMARTPHONE__
case IDM_LEFT:
case IDM_RIGHT:
processed = HandleCommand( LOWORD(wParam) , 0 , NULL );
break; break;
} #endif // __SMARTPHONE__
} }
break; break;
}
#endif #endif
case WM_CLOSE: case WM_CLOSE:
// if we can't close, tell the system that we processed the // if we can't close, tell the system that we processed the

View File

@@ -190,11 +190,15 @@ bool wxFrame::Create(wxWindow *parent,
const wxString& name) const wxString& name)
{ {
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
return FALSE; return false;
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
return TRUE; #ifdef __SMARTPHONE__
SetLeftMenu(wxID_EXIT, _("Done"));
#endif
return true;
} }
wxFrame::~wxFrame() wxFrame::~wxFrame()

View File

@@ -529,7 +529,6 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent,
#endif #endif
#ifdef __SMARTPHONE__ #ifdef __SMARTPHONE__
SetLeftMenu(wxID_EXIT, _("Done"));
SetRightMenu(); // to nothing for initialization SetRightMenu(); // to nothing for initialization
#endif #endif
@@ -977,8 +976,11 @@ wxDlgProc(HWND hDlg,
#if defined(__WXWINCE__) && !defined(__WINCE_STANDARDSDK__) && !defined(__HANDHELDPC__) #if defined(__WXWINCE__) && !defined(__WINCE_STANDARDSDK__) && !defined(__HANDHELDPC__)
SHINITDLGINFO shidi; SHINITDLGINFO shidi;
shidi.dwMask = SHIDIM_FLAGS; shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_DONEBUTTON | shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN
SHIDIF_SIZEDLGFULLSCREEN; #ifndef __SMARTPHONE__
| SHIDIF_DONEBUTTON
#endif
;
shidi.hDlg = hDlg; shidi.hDlg = hDlg;
SHInitDialog( &shidi ); SHInitDialog( &shidi );
#else // no SHInitDialog() #else // no SHInitDialog()