]>
git.saurik.com Git - wxWidgets.git/blob - src/generic/busyinfo.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Information window when app is busy
4 // Author: Vaclav Slavik
5 // Copyright: (c) 1999 Vaclav Slavik
6 // Licence: wxWindows Licence
7 /////////////////////////////////////////////////////////////////////////////
10 #pragma implementation "busyinfo.h"
13 #include "wx/wxprec.h"
21 #include "wx/stattext.h"
24 #include "wx/busyinfo.h"
27 wxInfoFrame::wxInfoFrame(wxWindow
*parent
, const wxString
& message
)
28 : wxFrame(parent
, -1, wxT("Busy"),
29 wxDefaultPosition
, wxDefaultSize
,
30 #if defined(__WXX11__)
35 | wxFRAME_TOOL_WINDOW
)
37 wxPanel
*panel
= new wxPanel( this );
38 wxStaticText
*text
= new wxStaticText(panel
, -1, message
);
40 panel
->SetCursor(*wxHOURGLASS_CURSOR
);
41 text
->SetCursor(*wxHOURGLASS_CURSOR
);
43 // make the frame of at least the standard size (400*80) but big enough
44 // for the text we show
45 wxSize sizeText
= text
->GetBestSize();
51 int nParentHeight
= parent
->GetClientSize().y
;
52 int nParentWidth
= parent
->GetClientSize().x
;
55 SetBackgroundColour("WHITE");
56 nColor
= (LONG
)GetBackgroundColour().GetPixel();
58 ::WinSetPresParam( GetHwnd()
63 panel
->SetBackgroundColour("WHITE");
64 nColor
= (LONG
)panel
->GetBackgroundColour().GetPixel();
66 ::WinSetPresParam( GetHwndOf(panel
)
71 nWidth
= wxMax(sizeText
.x
, 340) + 60;
72 nHeight
= wxMax(sizeText
.y
, 40) + 40;
73 nX
= (nParentWidth
- nWidth
) / 2;
74 nY
= (nParentHeight
/ 2) - (nHeight
/ 2);
75 nY
= nParentHeight
- (nY
+ nHeight
);
76 ::WinSetWindowPos( m_hFrame
82 ,SWP_SIZE
| SWP_MOVE
| SWP_ACTIVATE
84 text
->SetBackgroundColour("WHITE");
85 nColor
= (LONG
)text
->GetBackgroundColour().GetPixel();
87 ::WinSetPresParam( GetHwndOf(text
)
94 SetClientSize(wxMax(sizeText
.x
, 340) + 60, wxMax(sizeText
.y
, 40) + 40);
96 // need to size the panel correctly first so that text->Centre() works
97 panel
->SetSize(GetClientSize());
104 wxBusyInfo::wxBusyInfo(const wxString
& message
, wxWindow
*parent
)
106 m_InfoFrame
= new wxInfoFrame( parent
, message
);
107 m_InfoFrame
->Show(TRUE
);
109 m_InfoFrame
->Update() ;
112 m_InfoFrame
->Refresh();
117 wxBusyInfo::~wxBusyInfo()
119 m_InfoFrame
->Show(FALSE
);
120 m_InfoFrame
->Close();