]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixes to FIXME about stock IDs usage.
authorWłodzimierz Skiba <abx@abx.art.pl>
Wed, 29 Dec 2004 21:15:57 +0000 (21:15 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Wed, 29 Dec 2004 21:15:57 +0000 (21:15 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31190 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/logg.cpp
src/generic/tipdlg.cpp
src/msw/wince/menuce.cpp
src/msw/window.cpp
src/palmos/button.cpp

index e8ed37b22a8ddd2f3afd91ee8c808625f7ccd1b6..a084cc8bc4c639a07fc9a6bb633fc6aa46be6d2f 100644 (file)
@@ -151,7 +151,7 @@ private:
 };
 
 BEGIN_EVENT_TABLE(wxLogDialog, wxDialog)
-    EVT_BUTTON(wxID_CANCEL, wxLogDialog::OnOk)
+    EVT_BUTTON(wxID_OK, wxLogDialog::OnOk)
     EVT_BUTTON(wxID_MORE,   wxLogDialog::OnDetails)
 #if wxUSE_FILE
     EVT_BUTTON(wxID_SAVE,   wxLogDialog::OnSave)
@@ -741,12 +741,7 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
     wxBoxSizer *sizerButtons = new wxBoxSizer(wxVERTICAL);
     wxBoxSizer *sizerAll = new wxBoxSizer(wxHORIZONTAL);
 
-    // this "Ok" button has wxID_CANCEL id - not very logical, but this allows
-    // to close the log dialog with <Esc> which wouldn't work otherwise (as it
-    // translates into click on cancel button)
-
-    // FIXME: use stock button here!
-    wxButton *btnOk = new wxButton(this, wxID_CANCEL, _("OK"));
+    wxButton *btnOk = new wxButton(this, wxID_OK);
     sizerButtons->Add(btnOk, 0, wxCENTRE | wxBOTTOM, MARGIN/2);
     m_btnDetails = new wxButton(this, wxID_MORE, ms_details + EXPAND_SUFFIX);
     sizerButtons->Add(m_btnDetails, 0, wxCENTRE | wxTOP, MARGIN/2 - 1);
@@ -806,16 +801,6 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
 
     btnOk->SetFocus();
 
-    // this can't happen any more as we don't use this dialog in this case
-#if 0
-    if ( count == 1 )
-    {
-        // no details... it's easier to disable a button than to change the
-        // dialog layout depending on whether we have details or not
-        m_btnDetails->Disable();
-    }
-#endif // 0
-
     Centre();
 }
 
index a3514774fd11c6bc127c94385bc1a03de3e85619..3c014cab9c6bc9d4c57513458d2f5099bdae434c 100644 (file)
@@ -211,6 +211,7 @@ wxString wxFileTipProvider::GetTip()
 
 BEGIN_EVENT_TABLE(wxTipDialog, wxDialog)
     EVT_BUTTON(wxID_NEXT_TIP, wxTipDialog::OnNextTip)
+    EVT_BUTTON(wxID_CLOSE, wxTipDialog::OnCancel)
 END_EVENT_TABLE()
 
 wxTipDialog::wxTipDialog(wxWindow *parent,
@@ -226,8 +227,7 @@ wxTipDialog::wxTipDialog(wxWindow *parent,
 
     // smart phones does not support or do not waste space for wxButtons
 #ifndef __SMARTPHONE__
-    // FIXME: use stock wxID_CLOSE button here!
-    wxButton *btnClose = new wxButton(this, wxID_CANCEL, _("Close"));
+    wxButton *btnClose = new wxButton(this, wxID_CLOSE);
 #endif
 
     m_checkbox = new wxCheckBox(this, wxID_ANY, _("&Show tips at startup"));
@@ -293,7 +293,7 @@ wxTipDialog::wxTipDialog(wxWindow *parent,
     // smart phones does not support or do not waste space for wxButtons
 #ifdef __SMARTPHONE__
     SetRightMenu(wxID_NEXT_TIP, _("Next"));
-    SetLeftMenu(wxID_CANCEL, _("Close"));
+    SetLeftMenu(wxID_CLOSE);
 #else
     bottom->Add( 10,10,1 );
     bottom->Add( btnNext, 0, wxCENTER | wxLEFT, wxLARGESMALL(10,0) );
index 7f4d51c3beda14c84c4940bc1016329fe95df428..8ef705abcef29c0a1149dbbc84856258d45c6b6d 100644 (file)
@@ -48,6 +48,8 @@
 
 #include "wx/msw/wince/resources.h"
 
+#include "wx/stockitem.h"
+
 wxTopLevelWindowMSW::ButtonMenu::ButtonMenu()
 {
     m_id = wxID_ANY;
@@ -81,7 +83,10 @@ void wxTopLevelWindowMSW::ButtonMenu::SetButton(int id, const wxString& label, w
 {
     m_assigned = true;
     m_id = id;
-    m_label = label;
+    if(label.empty() && wxIsStockID(id))
+        m_label = wxGetStockLabel(id);
+    else
+        m_label = label;
     m_menu = subMenu;
 }
 
index 21055bce766c8bcb0d7fabb2c5b27fc5e7af5aa8..1331e0e476ca2badf257fd3a8c1568e0c90285cd 100644 (file)
@@ -1256,7 +1256,7 @@ void wxWindowMSW::OnInternalIdle()
             // changed by the time the OnInternalIdle function is called, so 'state'
             // may be meaningless.
             int state = 0;
-                       if ( wxIsShiftDown() )
+            if ( wxIsShiftDown() )
                 state |= MK_SHIFT;
             if ( wxIsCtrlDown() )
                 state |= MK_CONTROL;
@@ -1876,8 +1876,21 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
                 case VK_ESCAPE:
                     {
 #if wxUSE_BUTTON
-                        wxButton *btn = wxDynamicCast(FindWindow(wxID_CANCEL),
-                                                      wxButton);
+                        wxButton *btn = wxDynamicCast(FindWindow(wxID_CANCEL),wxButton);
+
+                        // our own wxLogDialog should react to Esc
+                        // without Cancel button but this is a private class
+                        // so let's try recognize it by content
+    #if wxUSE_LOG_DIALOG
+                        if ( !btn &&
+                             wxDynamicCast(this,wxDialog) &&
+                             FindWindow(wxID_MORE) &&
+                             FindWindow(wxID_OK) &&
+                             !FindWindow(wxID_CANCEL) &&
+                             GetTitle().MakeLower().StartsWith(wxTheApp->GetAppName().c_str())
+                             )
+                            btn = wxDynamicCast(FindWindow(wxID_OK),wxButton);
+    #endif // wxUSE_LOG_DIALOG
                         if ( btn && btn->IsEnabled() )
                         {
                             // if we do have a cancel button, do press it
@@ -1918,7 +1931,7 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
                             bProcess = false;
                         }
                         // FIXME: this should be handled by
-                        //        wxNavigationKeyEvent handler and not here!!
+                        //        wxNavigationKeyEvent handler and not here!
                         else
                         {
 #if wxUSE_BUTTON
index 33edcfd45cd067b7ea6ac24cb7ae308dbecd3fa2..3e5201b5c4497b180cc3d7d4d250cc87db18fa58 100644 (file)
@@ -128,6 +128,7 @@ bool wxButton::Create(wxWindow *parent,
                       const wxValidator& validator,
                       const wxString& name)
 {
+    // remember about stock IDs
     return false;
 }