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>
#endif
#ifdef __SMARTPHONE__
#include "wx/msw/wince/resources.h"
#endif // __SMARTPHONE__
// ----------------------------------------------------------------------------
// wxWin macros
// ----------------------------------------------------------------------------
@ -106,9 +110,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow)
#endif
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_APPLY, wxDialog::OnApply)
EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
#endif
EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged)
@ -182,6 +192,10 @@ bool wxDialog::Create(wxWindow *parent,
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
#ifdef __SMARTPHONE__
SetLeftMenu(wxID_OK, _("OK"));
#endif
return true;
}
@ -437,18 +451,28 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar
#ifdef __WXWINCE__
// react to pressing the OK button in the title
case WM_COMMAND:
if (LOWORD(wParam) == IDOK)
{
switch ( LOWORD(wParam) )
{
wxButton *btn = wxDynamicCast(FindWindow(wxID_CANCEL), wxButton);
if ( btn && btn->IsEnabled() )
{
// if we do have a cancel button, do press it
btn->MSWCommand(BN_CLICKED, 0 /* unused */);
processed = true;
#ifndef __SMARTPHONE__
case IDOK:
wxButton *btn = wxDynamicCast(FindWindow(wxID_CANCEL), wxButton);
if ( btn && btn->IsEnabled() )
{
// 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;
}
#endif // __SMARTPHONE__
}
break;
}
#endif
case WM_CLOSE:
// 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)
{
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
return FALSE;
return false;
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
return TRUE;
#ifdef __SMARTPHONE__
SetLeftMenu(wxID_EXIT, _("Done"));
#endif
return true;
}
wxFrame::~wxFrame()

View File

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