X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5526e819eca4465ed5520d49bccfebc6a28045e0..8d38cdb778ed01de8a1e4ada81c6d92255885ffc:/src/generic/busyinfo.cpp diff --git a/src/generic/busyinfo.cpp b/src/generic/busyinfo.cpp index c443c1daa3..884318fbe7 100644 --- a/src/generic/busyinfo.cpp +++ b/src/generic/busyinfo.cpp @@ -7,63 +7,66 @@ ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ -#pragma implementation +#pragma implementation "busyinfo.h" #endif -#include +#include "wx/wxprec.h" #ifdef __BORDLANDC__ #pragma hdrstop #endif -#ifndef WXPRECOMP -#include -#endif +#if wxUSE_BUSYINFO #include "wx/busyinfo.h" - - - +#include "wx/stattext.h" +#include "wx/panel.h" +#include "wx/utils.h" wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message) - : wxFrame(parent, -1, "", wxPoint(0, 0), wxSize(400, 80), wxTHICK_FRAME | wxSIMPLE_BORDER | wxFRAME_TOOL_WINDOW) + : wxFrame(parent, -1, wxT("Busy"), + wxDefaultPosition, wxDefaultSize, +#if defined(__WXX11__) + wxTHICK_FRAME | wxFRAME_TOOL_WINDOW) +#else + wxSIMPLE_BORDER | wxFRAME_TOOL_WINDOW) +#endif { - wxPanel *p = new wxPanel(this); - wxStaticText *s = new wxStaticText(p, -1, message, wxPoint(20, 20), wxSize(360, 40), wxALIGN_CENTER); - Centre(wxBOTH); - p -> SetCursor(*wxHOURGLASS_CURSOR); - s -> SetCursor(*wxHOURGLASS_CURSOR); -} + wxPanel *panel = new wxPanel( this ); + wxStaticText *text = new wxStaticText(panel, -1, message); + panel->SetCursor(*wxHOURGLASS_CURSOR); + text->SetCursor(*wxHOURGLASS_CURSOR); + // make the frame of at least the standard size (400*80) but big enough + // for the text we show + wxSize sizeText = text->GetBestSize(); + SetClientSize(wxMax(sizeText.x, 340) + 60, wxMax(sizeText.y, 40) + 40); + // need to size the panel correctly first so that text->Centre() works + panel->SetSize(GetClientSize()); -wxBusyInfo::wxBusyInfo(const wxString& message) : wxObject() + text->Centre(wxBOTH); + Centre(wxBOTH); +} + +wxBusyInfo::wxBusyInfo(const wxString& message, wxWindow *parent) { - m_InfoFrame = new wxInfoFrame(NULL, message); - m_InfoFrame -> Show(TRUE); + m_InfoFrame = new wxInfoFrame( parent, message); + m_InfoFrame->Show(TRUE); wxYield(); - m_InfoFrame -> Refresh(); + m_InfoFrame->Refresh(); wxYield(); } - - wxBusyInfo::~wxBusyInfo() { - m_InfoFrame -> Show(FALSE); - m_InfoFrame -> Close(); + m_InfoFrame->Show(FALSE); + m_InfoFrame->Close(); wxYield(); } - - - - - - - - - +#endif + // wxUSE_BUSYINFO