]>
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 /////////////////////////////////////////////////////////////////////////////
17 #include "wx/stattext.h"
20 #include "wx/busyinfo.h"
23 wxInfoFrame::wxInfoFrame(wxWindow
*parent
, const wxString
& message
)
24 : wxFrame(parent
, wxID_ANY
, wxT("Busy"),
25 wxDefaultPosition
, wxDefaultSize
,
26 #if defined(__WXX11__)
31 | wxFRAME_TOOL_WINDOW
)
33 wxPanel
*panel
= new wxPanel( this );
34 wxStaticText
*text
= new wxStaticText(panel
, wxID_ANY
, message
);
36 panel
->SetCursor(*wxHOURGLASS_CURSOR
);
37 text
->SetCursor(*wxHOURGLASS_CURSOR
);
39 // make the frame of at least the standard size (400*80) but big enough
40 // for the text we show
41 wxSize sizeText
= text
->GetBestSize();
47 int nParentHeight
= parent
->GetClientSize().y
;
48 int nParentWidth
= parent
->GetClientSize().x
;
51 SetBackgroundColour(wxT("WHITE"));
52 nColor
= (LONG
)GetBackgroundColour().GetPixel();
54 ::WinSetPresParam( GetHwnd()
59 panel
->SetBackgroundColour(wxT("WHITE"));
60 nColor
= (LONG
)panel
->GetBackgroundColour().GetPixel();
62 ::WinSetPresParam( GetHwndOf(panel
)
67 nWidth
= wxMax(sizeText
.x
, 340) + 60;
68 nHeight
= wxMax(sizeText
.y
, 40) + 40;
69 nX
= (nParentWidth
- nWidth
) / 2;
70 nY
= (nParentHeight
/ 2) - (nHeight
/ 2);
71 nY
= nParentHeight
- (nY
+ nHeight
);
72 ::WinSetWindowPos( m_hFrame
78 ,SWP_SIZE
| SWP_MOVE
| SWP_ACTIVATE
80 text
->SetBackgroundColour(wxT("WHITE"));
81 nColor
= (LONG
)text
->GetBackgroundColour().GetPixel();
83 ::WinSetPresParam( GetHwndOf(text
)
90 SetClientSize(wxMax(sizeText
.x
, 340) + 60, wxMax(sizeText
.y
, 40) + 40);
92 // need to size the panel correctly first so that text->Centre() works
93 panel
->SetSize(GetClientSize());
100 wxBusyInfo::wxBusyInfo(const wxString
& message
, wxWindow
*parent
)
102 m_InfoFrame
= new wxInfoFrame( parent
, message
);
103 m_InfoFrame
->Show(true);
104 m_InfoFrame
->Refresh();
105 m_InfoFrame
->Update();
108 wxBusyInfo::~wxBusyInfo()
110 m_InfoFrame
->Show(false);
111 m_InfoFrame
->Close();