]>
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
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
17 // for all others, include the necessary headers
20 #include "wx/stattext.h"
25 #include "wx/busyinfo.h"
26 #include "wx/generic/stattextg.h"
28 class WXDLLEXPORT wxInfoFrame
: public wxFrame
31 wxInfoFrame(wxWindow
*parent
, const wxString
& message
);
34 wxDECLARE_NO_COPY_CLASS(wxInfoFrame
);
38 wxInfoFrame::wxInfoFrame(wxWindow
*parent
, const wxString
& message
)
39 : wxFrame(parent
, wxID_ANY
, wxT("Busy"),
40 wxDefaultPosition
, wxDefaultSize
,
41 #if defined(__WXX11__)
46 | wxFRAME_TOOL_WINDOW
| wxSTAY_ON_TOP
)
48 wxPanel
*panel
= new wxPanel( this );
50 wxGenericStaticText
*text
= new wxGenericStaticText(panel
, wxID_ANY
, message
);
52 wxStaticText
*text
= new wxStaticText(panel
, wxID_ANY
, message
);
55 panel
->SetCursor(*wxHOURGLASS_CURSOR
);
56 text
->SetCursor(*wxHOURGLASS_CURSOR
);
58 // make the frame of at least the standard size (400*80) but big enough
59 // for the text we show
60 wxSize sizeText
= text
->GetBestSize();
66 int nParentHeight
= parent
->GetClientSize().y
;
67 int nParentWidth
= parent
->GetClientSize().x
;
70 SetBackgroundColour(wxT("WHITE"));
71 nColor
= (LONG
)GetBackgroundColour().GetPixel();
73 ::WinSetPresParam( GetHwnd()
78 panel
->SetBackgroundColour(wxT("WHITE"));
79 nColor
= (LONG
)panel
->GetBackgroundColour().GetPixel();
81 ::WinSetPresParam( GetHwndOf(panel
)
86 nWidth
= wxMax(sizeText
.x
, 340) + 60;
87 nHeight
= wxMax(sizeText
.y
, 40) + 40;
88 nX
= (nParentWidth
- nWidth
) / 2;
89 nY
= (nParentHeight
/ 2) - (nHeight
/ 2);
90 nY
= nParentHeight
- (nY
+ nHeight
);
91 ::WinSetWindowPos( m_hFrame
97 ,SWP_SIZE
| SWP_MOVE
| SWP_ACTIVATE
99 text
->SetBackgroundColour(wxT("WHITE"));
100 nColor
= (LONG
)text
->GetBackgroundColour().GetPixel();
102 ::WinSetPresParam( GetHwndOf(text
)
107 text
->Center(wxBOTH
);
109 SetClientSize(wxMax(sizeText
.x
, 340) + 60, wxMax(sizeText
.y
, 40) + 40);
111 // need to size the panel correctly first so that text->Centre() works
112 panel
->SetSize(GetClientSize());
114 text
->Centre(wxBOTH
);
119 wxBusyInfo::wxBusyInfo(const wxString
& message
, wxWindow
*parent
)
121 m_InfoFrame
= new wxInfoFrame(parent
, message
);
122 m_InfoFrame
->Show(true);
123 m_InfoFrame
->Refresh();
124 m_InfoFrame
->Update();
127 wxBusyInfo::~wxBusyInfo()
129 m_InfoFrame
->Show(false);
130 m_InfoFrame
->Close();
133 #endif // wxUSE_BUSYINFO