[Gcblue-commits] gcb_wx/src/graphics tcEditBox.cpp,1.1,1.2 tcwindow.cpp,1.21,1.22
Status: Alpha
Brought to you by:
ddcforge
|
From: <ddc...@us...> - 2004-03-02 03:03:46
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13312/src/graphics Modified Files: tcEditBox.cpp tcwindow.cpp Log Message: Index: tcEditBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcEditBox.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcEditBox.cpp 27 Feb 2004 00:07:59 -0000 1.1 --- tcEditBox.cpp 2 Mar 2004 02:52:14 -0000 1.2 *************** *** 53,65 **** if (!mbActive) {return;} ! if (IsBackgroundLoaded()) ! { ! DrawBackground(graphics); ! } ! else { ! // erase ! brush->SetColor(Color(255,0,15,50)); ! graphics->FillRectangle(brush,0,0,mnWidth,mnHeight); } --- 53,68 ---- if (!mbActive) {return;} ! if (drawBackground) { ! if (IsBackgroundLoaded()) ! { ! DrawBackground(graphics); ! } ! else ! { ! // erase ! brush->SetColor(Color(255,0,15,50)); ! graphics->FillRectangle(brush,0,0,mnWidth,mnHeight); ! } } *************** *** 157,161 **** ! void tcEditBox::OnKeyDown(wxKeyEvent& event) { --- 160,167 ---- ! /** ! * If clearOnReturn is true, a text updated event will be posted ! * and the text will be cleared when the return key is pressed. ! */ void tcEditBox::OnKeyDown(wxKeyEvent& event) { *************** *** 165,169 **** if (keycode == WXK_RETURN) { ! if (textChanged) { wxCommandEvent command(wxEVT_COMMAND_TEXT_UPDATED, command) ; --- 171,175 ---- if (keycode == WXK_RETURN) { ! if ((textChanged)&&(clearOnReturn)) { wxCommandEvent command(wxEVT_COMMAND_TEXT_UPDATED, command) ; *************** *** 171,174 **** --- 177,181 ---- command.SetString(mzBuffer); AddPendingEvent(command); // TODO add handler added in tcGame for this event + strcpy(mzBuffer,""); textChanged = false; } *************** *** 180,183 **** --- 187,195 ---- textChanged = true; } + else if (keycode == WXK_ESCAPE) + { + wxASSERT(GetParent()); + GetParent()->SetFocus(); + } else { *************** *** 221,227 **** } void tcEditBox::OnKillFocus(wxFocusEvent& event) { ! if (textChanged) { wxCommandEvent command(wxEVT_COMMAND_TEXT_UPDATED, command) ; --- 233,243 ---- } + /** + * If clearOnReturn is false, a text updated event will be posted + * when the focus is lost. + */ void tcEditBox::OnKillFocus(wxFocusEvent& event) { ! if ((textChanged)&&(!clearOnReturn)) { wxCommandEvent command(wxEVT_COMMAND_TEXT_UPDATED, command) ; *************** *** 251,255 **** isMouseOver(false), isFocused(false), ! textChanged(false), command(0) { --- 267,273 ---- isMouseOver(false), isFocused(false), ! textChanged(true), ! drawBackground(true), ! clearOnReturn(false), command(0) { *************** *** 288,291 **** --- 306,311 ---- mrectTextCaption = mrectTextBar; mrectTextCaption.Offset(-2,-mrectTextBar.Height-2); + + drawBackground = (mrectTextBar.Width < (float)width); } Index: tcwindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcwindow.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcwindow.cpp 29 Feb 2004 22:51:36 -0000 1.21 --- tcwindow.cpp 2 Mar 2004 02:52:14 -0000 1.22 *************** *** 594,598 **** mpBrushDefault->SetColor(startcolor); } ! else { apGraphics->DrawImage(mpiBackground,0,0); } --- 594,599 ---- mpBrushDefault->SetColor(startcolor); } ! else ! { apGraphics->DrawImage(mpiBackground,0,0); } |