]>
git.saurik.com Git - wxWidgets.git/blob - src/generic/busyinfo.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/busyinfo.cpp
3 // Purpose: Information window when app is busy
4 // Author: Vaclav Slavik
5 // Copyright: (c) 1999 Vaclav Slavik
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #include "wx/wxprec.h"
18 // for all others, include the necessary headers
20 #include "wx/stattext.h"
25 #include "wx/busyinfo.h"
27 class WXDLLEXPORT wxInfoFrame
: public wxFrame
30 wxInfoFrame(wxWindow
*parent
, const wxString
& message
);
33 DECLARE_NO_COPY_CLASS(wxInfoFrame
)
37 wxInfoFrame::wxInfoFrame(wxWindow
*parent
, const wxString
& message
)
38 : wxFrame(parent
, wxID_ANY
, wxT("Busy"),
39 wxDefaultPosition
, wxDefaultSize
,
40 #if defined(__WXX11__)
45 | wxFRAME_TOOL_WINDOW
)
47 wxPanel
*panel
= new wxPanel( this );
48 wxStaticText
*text
= new wxStaticText(panel
, wxID_ANY
, message
);
50 panel
->SetCursor(*wxHOURGLASS_CURSOR
);
51 text
->SetCursor(*wxHOURGLASS_CURSOR
);
53 // make the frame of at least the standard size (400*80) but big enough
54 // for the text we show
55 wxSize sizeText
= text
->GetBestSize();
61 int nParentHeight
= parent
->GetClientSize().y
;
62 int nParentWidth
= parent
->GetClientSize().x
;
65 SetBackgroundColour(wxT("WHITE"));
66 nColor
= (LONG
)GetBackgroundColour().GetPixel();
68 ::WinSetPresParam( GetHwnd()
73 panel
->SetBackgroundColour(wxT("WHITE"));
74 nColor
= (LONG
)panel
->GetBackgroundColour().GetPixel();
76 ::WinSetPresParam( GetHwndOf(panel
)
81 nWidth
= wxMax(sizeText
.x
, 340) + 60;
82 nHeight
= wxMax(sizeText
.y
, 40) + 40;
83 nX
= (nParentWidth
- nWidth
) / 2;
84 nY
= (nParentHeight
/ 2) - (nHeight
/ 2);
85 nY
= nParentHeight
- (nY
+ nHeight
);
86 ::WinSetWindowPos( m_hFrame
92 ,SWP_SIZE
| SWP_MOVE
| SWP_ACTIVATE
94 text
->SetBackgroundColour(wxT("WHITE"));
95 nColor
= (LONG
)text
->GetBackgroundColour().GetPixel();
97 ::WinSetPresParam( GetHwndOf(text
)
102 text
->Center(wxBOTH
);
104 SetClientSize(wxMax(sizeText
.x
, 340) + 60, wxMax(sizeText
.y
, 40) + 40);
106 // need to size the panel correctly first so that text->Centre() works
107 panel
->SetSize(GetClientSize());
109 text
->Centre(wxBOTH
);
114 wxBusyInfo::wxBusyInfo(const wxString
& message
, wxWindow
*parent
)
116 m_InfoFrame
= new wxInfoFrame( parent
, message
);
117 m_InfoFrame
->Show(true);
118 m_InfoFrame
->Refresh();
119 m_InfoFrame
->Update();
122 wxBusyInfo::~wxBusyInfo()
124 m_InfoFrame
->Show(false);
125 m_InfoFrame
->Close();
128 #endif // wxUSE_BUSYINFO