]> git.saurik.com Git - wxWidgets.git/blame - src/generic/busyinfo.cpp
wxDC::SetFont can now handle invalid font and doesn't assert anymore (other ports...
[wxWidgets.git] / src / generic / busyinfo.cpp
CommitLineData
5526e819
VS
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__
d1af991f 10#pragma implementation "busyinfo.h"
5526e819
VS
11#endif
12
d1af991f 13#include "wx/wxprec.h"
5526e819
VS
14
15#ifdef __BORDLANDC__
16#pragma hdrstop
17#endif
18
d78b3d64
VS
19#if wxUSE_BUSYINFO
20
5526e819 21#include "wx/busyinfo.h"
d1af991f
RR
22#include "wx/stattext.h"
23#include "wx/panel.h"
24#include "wx/utils.h"
5526e819
VS
25
26
27wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message)
21977bac
VZ
28 : wxFrame(parent, -1, wxT(""),
29 wxDefaultPosition, wxDefaultSize,
30 wxSIMPLE_BORDER | wxFRAME_TOOL_WINDOW)
5526e819 31{
21977bac
VZ
32 wxPanel *panel = new wxPanel( this );
33 wxStaticText *text = new wxStaticText(panel, -1, message);
34
35 panel->SetCursor(*wxHOURGLASS_CURSOR);
36 text->SetCursor(*wxHOURGLASS_CURSOR);
37
38 // make the frame of at least the standard size (400*80) but big enough
39 // for the text we show
40 wxSize sizeText = text->GetBestSize();
41 SetClientSize(wxMax(sizeText.x, 340) + 60, wxMax(sizeText.y, 40) + 40);
42
43 // need to size the panel correctly first so that text->Centre() works
44 panel->SetSize(GetClientSize());
45
46 text->Centre(wxBOTH);
5526e819 47 Centre(wxBOTH);
5526e819
VS
48}
49
21977bac 50wxBusyInfo::wxBusyInfo(const wxString& message, wxWindow *parent)
5526e819 51{
21977bac 52 m_InfoFrame = new wxInfoFrame( parent, message);
d1af991f 53 m_InfoFrame->Show(TRUE);
5526e819 54 wxYield();
d1af991f 55 m_InfoFrame->Refresh();
5526e819
VS
56 wxYield();
57}
58
5526e819
VS
59wxBusyInfo::~wxBusyInfo()
60{
d1af991f
RR
61 m_InfoFrame->Show(FALSE);
62 m_InfoFrame->Close();
5526e819
VS
63 wxYield();
64}
65
d78b3d64 66#endif
2996bcde
PA
67 // wxUSE_BUSYINFO
68