Fixes to FIXME about stock IDs usage.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31190 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba 2004-12-29 21:15:57 +00:00
parent 3feeb1e1e0
commit eb3e6de33b
5 changed files with 29 additions and 25 deletions

View File

@ -151,7 +151,7 @@ private:
}; };
BEGIN_EVENT_TABLE(wxLogDialog, wxDialog) BEGIN_EVENT_TABLE(wxLogDialog, wxDialog)
EVT_BUTTON(wxID_CANCEL, wxLogDialog::OnOk) EVT_BUTTON(wxID_OK, wxLogDialog::OnOk)
EVT_BUTTON(wxID_MORE, wxLogDialog::OnDetails) EVT_BUTTON(wxID_MORE, wxLogDialog::OnDetails)
#if wxUSE_FILE #if wxUSE_FILE
EVT_BUTTON(wxID_SAVE, wxLogDialog::OnSave) EVT_BUTTON(wxID_SAVE, wxLogDialog::OnSave)
@ -741,12 +741,7 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
wxBoxSizer *sizerButtons = new wxBoxSizer(wxVERTICAL); wxBoxSizer *sizerButtons = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *sizerAll = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *sizerAll = new wxBoxSizer(wxHORIZONTAL);
// this "Ok" button has wxID_CANCEL id - not very logical, but this allows wxButton *btnOk = new wxButton(this, wxID_OK);
// 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"));
sizerButtons->Add(btnOk, 0, wxCENTRE | wxBOTTOM, MARGIN/2); sizerButtons->Add(btnOk, 0, wxCENTRE | wxBOTTOM, MARGIN/2);
m_btnDetails = new wxButton(this, wxID_MORE, ms_details + EXPAND_SUFFIX); m_btnDetails = new wxButton(this, wxID_MORE, ms_details + EXPAND_SUFFIX);
sizerButtons->Add(m_btnDetails, 0, wxCENTRE | wxTOP, MARGIN/2 - 1); sizerButtons->Add(m_btnDetails, 0, wxCENTRE | wxTOP, MARGIN/2 - 1);
@ -806,16 +801,6 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
btnOk->SetFocus(); 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(); Centre();
} }

View File

@ -211,6 +211,7 @@ wxString wxFileTipProvider::GetTip()
BEGIN_EVENT_TABLE(wxTipDialog, wxDialog) BEGIN_EVENT_TABLE(wxTipDialog, wxDialog)
EVT_BUTTON(wxID_NEXT_TIP, wxTipDialog::OnNextTip) EVT_BUTTON(wxID_NEXT_TIP, wxTipDialog::OnNextTip)
EVT_BUTTON(wxID_CLOSE, wxTipDialog::OnCancel)
END_EVENT_TABLE() END_EVENT_TABLE()
wxTipDialog::wxTipDialog(wxWindow *parent, wxTipDialog::wxTipDialog(wxWindow *parent,
@ -226,8 +227,7 @@ wxTipDialog::wxTipDialog(wxWindow *parent,
// smart phones does not support or do not waste space for wxButtons // smart phones does not support or do not waste space for wxButtons
#ifndef __SMARTPHONE__ #ifndef __SMARTPHONE__
// FIXME: use stock wxID_CLOSE button here! wxButton *btnClose = new wxButton(this, wxID_CLOSE);
wxButton *btnClose = new wxButton(this, wxID_CANCEL, _("Close"));
#endif #endif
m_checkbox = new wxCheckBox(this, wxID_ANY, _("&Show tips at startup")); 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 // smart phones does not support or do not waste space for wxButtons
#ifdef __SMARTPHONE__ #ifdef __SMARTPHONE__
SetRightMenu(wxID_NEXT_TIP, _("Next")); SetRightMenu(wxID_NEXT_TIP, _("Next"));
SetLeftMenu(wxID_CANCEL, _("Close")); SetLeftMenu(wxID_CLOSE);
#else #else
bottom->Add( 10,10,1 ); bottom->Add( 10,10,1 );
bottom->Add( btnNext, 0, wxCENTER | wxLEFT, wxLARGESMALL(10,0) ); bottom->Add( btnNext, 0, wxCENTER | wxLEFT, wxLARGESMALL(10,0) );

View File

@ -48,6 +48,8 @@
#include "wx/msw/wince/resources.h" #include "wx/msw/wince/resources.h"
#include "wx/stockitem.h"
wxTopLevelWindowMSW::ButtonMenu::ButtonMenu() wxTopLevelWindowMSW::ButtonMenu::ButtonMenu()
{ {
m_id = wxID_ANY; m_id = wxID_ANY;
@ -81,7 +83,10 @@ void wxTopLevelWindowMSW::ButtonMenu::SetButton(int id, const wxString& label, w
{ {
m_assigned = true; m_assigned = true;
m_id = id; m_id = id;
m_label = label; if(label.empty() && wxIsStockID(id))
m_label = wxGetStockLabel(id);
else
m_label = label;
m_menu = subMenu; m_menu = subMenu;
} }

View File

@ -1256,7 +1256,7 @@ void wxWindowMSW::OnInternalIdle()
// changed by the time the OnInternalIdle function is called, so 'state' // changed by the time the OnInternalIdle function is called, so 'state'
// may be meaningless. // may be meaningless.
int state = 0; int state = 0;
if ( wxIsShiftDown() ) if ( wxIsShiftDown() )
state |= MK_SHIFT; state |= MK_SHIFT;
if ( wxIsCtrlDown() ) if ( wxIsCtrlDown() )
state |= MK_CONTROL; state |= MK_CONTROL;
@ -1876,8 +1876,21 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
case VK_ESCAPE: case VK_ESCAPE:
{ {
#if wxUSE_BUTTON #if wxUSE_BUTTON
wxButton *btn = wxDynamicCast(FindWindow(wxID_CANCEL), wxButton *btn = wxDynamicCast(FindWindow(wxID_CANCEL),wxButton);
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 ( btn && btn->IsEnabled() )
{ {
// if we do have a cancel button, do press it // if we do have a cancel button, do press it
@ -1918,7 +1931,7 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
bProcess = false; bProcess = false;
} }
// FIXME: this should be handled by // FIXME: this should be handled by
// wxNavigationKeyEvent handler and not here!! // wxNavigationKeyEvent handler and not here!
else else
{ {
#if wxUSE_BUTTON #if wxUSE_BUTTON

View File

@ -128,6 +128,7 @@ bool wxButton::Create(wxWindow *parent,
const wxValidator& validator, const wxValidator& validator,
const wxString& name) const wxString& name)
{ {
// remember about stock IDs
return false; return false;
} }