Patch level :10.0

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
aggiunti i tasti "si tutti" "no tutti"; in attesa del "forse tutti"


git-svn-id: svn://10.65.10.50/trunk@20337 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2010-04-15 08:27:21 +00:00
parent 44c062708a
commit 3a674681a7

View File

@ -67,7 +67,18 @@ void TMessageBox::OnTimeout(wxTimerEvent& WXUNUSED(evt))
void TMessageBox::AddButton(wxSizer* sz, wxWindowID id) void TMessageBox::AddButton(wxSizer* sz, wxWindowID id)
{ {
const wxSize szButt(64,-1); const wxSize szButt(64,-1);
sz->Add(new wxButton(this, id, wxEmptyString, wxDefaultPosition, szButt), 0, wxALL, 4); switch (id)
{
case 0x20:
sz->Add(new wxButton(this, id, "Si Tutti", wxDefaultPosition, szButt), 0, wxALL, 4);
break;
case 0x40:
sz->Add(new wxButton(this, id, "No Tutti", wxDefaultPosition, szButt), 0, wxALL, 4);
break;
default:
sz->Add(new wxButton(this, id, wxEmptyString, wxDefaultPosition, szButt), 0, wxALL, 4);
break;
}
} }
TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int nTimeout) TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int nTimeout)
@ -129,19 +140,41 @@ TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int
sizer->Add(sz2, 0, wxALIGN_CENTER); sizer->Add(sz2, 0, wxALIGN_CENTER);
if (nStyle & wxYES_NO) if (nStyle & wxYES_NO)
{ {
if (nStyle & wxNO_DEFAULT) if (nStyle & 0x60) // Yes,No,*All
{ {
SetAffirmativeId(wxID_NO); if (nStyle & 0x20) // No, Yes, Yes All
SetEscapeId(wxID_YES); {
AddButton(sz2, wxID_NO); SetAffirmativeId(wxID_YES);
AddButton(sz2, wxID_YES); SetEscapeId(wxID_NO);
AddButton(sz2, wxID_NO);
AddButton(sz2, wxID_YES);
AddButton(sz2, 0x20);
}
else // Yes, No, No All
{
SetAffirmativeId(wxID_NO);
SetEscapeId(wxID_YES);
AddButton(sz2, wxID_YES);
AddButton(sz2, wxID_NO);
AddButton(sz2, 0x40);
}
} }
else else
{ {
SetAffirmativeId(wxID_YES); if (nStyle & wxNO_DEFAULT)
SetEscapeId(wxID_NO); {
AddButton(sz2, wxID_YES); SetAffirmativeId(wxID_NO);
AddButton(sz2, wxID_NO); SetEscapeId(wxID_YES);
AddButton(sz2, wxID_NO);
AddButton(sz2, wxID_YES);
}
else
{
SetAffirmativeId(wxID_YES);
SetEscapeId(wxID_NO);
AddButton(sz2, wxID_YES);
AddButton(sz2, wxID_NO);
}
} }
} }
if (nStyle & wxOK) if (nStyle & wxOK)
@ -154,7 +187,6 @@ TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int
SetEscapeId(wxID_CANCEL); SetEscapeId(wxID_CANCEL);
AddButton(sz2, wxID_CANCEL); AddButton(sz2, wxID_CANCEL);
} }
SetSizerAndFit(sizer); SetSizerAndFit(sizer);
CentreOnParent(); CentreOnParent();
@ -523,13 +555,17 @@ BOOLEAN xvt_dm_post_speech(const char* text, int priority, BOOLEAN async)
ASK_RESPONSE xvt_dm_post_ask(const char* Btn1, const char* WXUNUSED(Btn2), const char* Btn3, const char* fmt) ASK_RESPONSE xvt_dm_post_ask(const char* Btn1, const char* WXUNUSED(Btn2), const char* Btn3, const char* fmt)
{ {
int nFlags = wxICON_QUESTION | wxYES_NO; int nFlags = wxICON_QUESTION | wxYES_NO;
if (Btn3 == NULL) if (wxStricmp(Btn1, "no") == 0)
nFlags |= wxNO_DEFAULT;
if (Btn3 != NULL) //il Btn3 è presente sulla maschera (es. noyesall_box, yesnocancel_box)
{ {
if (wxStricmp(Btn1, "no") == 0) if (wxStricmp(Btn3, "Si Tutti") == 0)
nFlags |= wxNO_DEFAULT; nFlags |= 0x20; else
if (wxStricmp(Btn3, "No Tutti") == 0)
nFlags |= 0x40;
else
nFlags |= wxCANCEL;
} }
else
nFlags |= wxCANCEL;
const int answer = _MessageBox(fmt, nFlags); const int answer = _MessageBox(fmt, nFlags);
return answer == wxYES ? RESP_DEFAULT : (answer == wxNO ? RESP_2 : RESP_3); return answer == wxYES ? RESP_DEFAULT : (answer == wxNO ? RESP_2 : RESP_3);