]> git.saurik.com Git - wxWidgets.git/blob - src/generic/busyinfo.cpp
Replaced internal calls to XToCol/YToRow added in 1.197 by internal macro
[wxWidgets.git] / src / generic / busyinfo.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: busyinfo.cpp
3 // Purpose: Information window when app is busy
4 // Author: Vaclav Slavik
5 // Copyright: (c) 1999 Vaclav Slavik
6 // Licence: wxWindows Licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 #ifdef __GNUG__
10 #pragma implementation "busyinfo.h"
11 #endif
12
13 #include "wx/wxprec.h"
14
15 #ifdef __BORDLANDC__
16 #pragma hdrstop
17 #endif
18
19 #if wxUSE_BUSYINFO
20
21 #include "wx/busyinfo.h"
22 #include "wx/stattext.h"
23 #include "wx/panel.h"
24 #include "wx/utils.h"
25
26
27 wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message)
28 : wxFrame(parent, -1, wxT("Busy"),
29 wxDefaultPosition, wxDefaultSize,
30 #if defined(__WXX11__)
31 wxTHICK_FRAME | wxFRAME_TOOL_WINDOW)
32 #else
33 wxSIMPLE_BORDER | wxFRAME_TOOL_WINDOW)
34 #endif
35 {
36 wxPanel *panel = new wxPanel( this );
37 wxStaticText *text = new wxStaticText(panel, -1, message);
38
39 panel->SetCursor(*wxHOURGLASS_CURSOR);
40 text->SetCursor(*wxHOURGLASS_CURSOR);
41
42 // make the frame of at least the standard size (400*80) but big enough
43 // for the text we show
44 wxSize sizeText = text->GetBestSize();
45 SetClientSize(wxMax(sizeText.x, 340) + 60, wxMax(sizeText.y, 40) + 40);
46
47 // need to size the panel correctly first so that text->Centre() works
48 panel->SetSize(GetClientSize());
49
50 text->Centre(wxBOTH);
51 Centre(wxBOTH);
52 }
53
54 wxBusyInfo::wxBusyInfo(const wxString& message, wxWindow *parent)
55 {
56 m_InfoFrame = new wxInfoFrame( parent, message);
57 m_InfoFrame->Show(TRUE);
58 wxYield();
59 m_InfoFrame->Refresh();
60 wxYield();
61 }
62
63 wxBusyInfo::~wxBusyInfo()
64 {
65 m_InfoFrame->Show(FALSE);
66 m_InfoFrame->Close();
67 wxYield();
68 }
69
70 #endif
71 // wxUSE_BUSYINFO
72