]>
git.saurik.com Git - wxWidgets.git/blob - src/generic/busyinfo.cpp
245741c191fc9e6e572eba3f0103933fa19496a2
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
21 #include "wx/stattext.h"
26 #include "wx/busyinfo.h"
27 #include "wx/generic/stattextg.h"
29 class WXDLLEXPORT wxInfoFrame
: public wxFrame
32 wxInfoFrame(wxWindow
*parent
, const wxString
& message
);
35 wxDECLARE_NO_COPY_CLASS(wxInfoFrame
);
39 wxInfoFrame::wxInfoFrame(wxWindow
*parent
, const wxString
& message
)
40 : wxFrame(parent
, wxID_ANY
, wxT("Busy"),
41 wxDefaultPosition
, wxDefaultSize
,
42 #if defined(__WXX11__)
47 | wxFRAME_TOOL_WINDOW
| wxSTAY_ON_TOP
)
49 wxPanel
*panel
= new wxPanel( this );
51 wxGenericStaticText
*text
= new wxGenericStaticText(panel
, wxID_ANY
, message
);
53 wxStaticText
*text
= new wxStaticText(panel
, wxID_ANY
, message
);
56 panel
->SetCursor(*wxHOURGLASS_CURSOR
);
57 text
->SetCursor(*wxHOURGLASS_CURSOR
);
59 // make the frame of at least the standard size (400*80) but big enough
60 // for the text we show
61 wxSize sizeText
= text
->GetBestSize();
67 int nParentHeight
= parent
->GetClientSize().y
;
68 int nParentWidth
= parent
->GetClientSize().x
;
71 SetBackgroundColour(wxT("WHITE"));
72 nColor
= (LONG
)GetBackgroundColour().GetPixel();
74 ::WinSetPresParam( GetHwnd()
79 panel
->SetBackgroundColour(wxT("WHITE"));
80 nColor
= (LONG
)panel
->GetBackgroundColour().GetPixel();
82 ::WinSetPresParam( GetHwndOf(panel
)
87 nWidth
= wxMax(sizeText
.x
, 340) + 60;
88 nHeight
= wxMax(sizeText
.y
, 40) + 40;
89 nX
= (nParentWidth
- nWidth
) / 2;
90 nY
= (nParentHeight
/ 2) - (nHeight
/ 2);
91 nY
= nParentHeight
- (nY
+ nHeight
);
92 ::WinSetWindowPos( m_hFrame
98 ,SWP_SIZE
| SWP_MOVE
| SWP_ACTIVATE
100 text
->SetBackgroundColour(wxT("WHITE"));
101 nColor
= (LONG
)text
->GetBackgroundColour().GetPixel();
103 ::WinSetPresParam( GetHwndOf(text
)
108 text
->Center(wxBOTH
);
110 SetClientSize(wxMax(sizeText
.x
, 340) + 60, wxMax(sizeText
.y
, 40) + 40);
112 // need to size the panel correctly first so that text->Centre() works
113 panel
->SetSize(GetClientSize());
115 text
->Centre(wxBOTH
);
120 wxBusyInfo::wxBusyInfo(const wxString
& message
, wxWindow
*parent
)
122 m_InfoFrame
= new wxInfoFrame(parent
, message
);
123 m_InfoFrame
->Show(true);
124 m_InfoFrame
->Refresh();
125 m_InfoFrame
->Update();
128 wxBusyInfo::~wxBusyInfo()
130 m_InfoFrame
->Show(false);
131 m_InfoFrame
->Close();
134 #endif // wxUSE_BUSYINFO