]> git.saurik.com Git - wxWidgets.git/commitdiff
Different default buttons for native menubars on Smartphones.
authorWłodzimierz Skiba <abx@abx.art.pl>
Mon, 21 Jun 2004 08:31:04 +0000 (08:31 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Mon, 21 Jun 2004 08:31:04 +0000 (08:31 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/dialog.cpp
src/msw/frame.cpp
src/msw/toplevel.cpp

index 67f6fec03654f3dcfa533668a17d0af83f2321ac..5aee28f39c33adf77520e0a507c6a658b59aa451 100644 (file)
     #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
index 1ca248342e661b8e3ee169e84fe4491f04e7fee3..e8890f42f2e7e629b5abac75da4f95a465f0f48f 100644 (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()
index c8966ad7bba727d0296c856c90d2c146bcdefaad..3cf38606e30c27129d69df4d0c1fbbf5673698bc 100644 (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()