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)
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();
}

View 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) );

View 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;
}

View 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

View File

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