]>
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
21 #include "wx/stattext.h"
26 #include "wx/busyinfo.h"
28 class WXDLLEXPORT wxInfoFrame
: public wxFrame
31 wxInfoFrame(wxWindow
*parent
, const wxString
& message
);
34 DECLARE_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
)
48 wxPanel
*panel
= new wxPanel( this );
49 wxStaticText
*text
= new wxStaticText(panel
, wxID_ANY
, message
);
51 panel
->SetCursor(*wxHOURGLASS_CURSOR
);
52 text
->SetCursor(*wxHOURGLASS_CURSOR
);
54 // make the frame of at least the standard size (400*80) but big enough
55 // for the text we show
56 wxSize sizeText
= text
->GetBestSize();
62 int nParentHeight
= parent
->GetClientSize().y
;
63 int nParentWidth
= parent
->GetClientSize().x
;
66 SetBackgroundColour(wxT("WHITE"));
67 nColor
= (LONG
)GetBackgroundColour().GetPixel();
69 ::WinSetPresParam( GetHwnd()
74 panel
->SetBackgroundColour(wxT("WHITE"));
75 nColor
= (LONG
)panel
->GetBackgroundColour().GetPixel();
77 ::WinSetPresParam( GetHwndOf(panel
)
82 nWidth
= wxMax(sizeText
.x
, 340) + 60;
83 nHeight
= wxMax(sizeText
.y
, 40) + 40;
84 nX
= (nParentWidth
- nWidth
) / 2;
85 nY
= (nParentHeight
/ 2) - (nHeight
/ 2);
86 nY
= nParentHeight
- (nY
+ nHeight
);
87 ::WinSetWindowPos( m_hFrame
93 ,SWP_SIZE
| SWP_MOVE
| SWP_ACTIVATE
95 text
->SetBackgroundColour(wxT("WHITE"));
96 nColor
= (LONG
)text
->GetBackgroundColour().GetPixel();
98 ::WinSetPresParam( GetHwndOf(text
)
103 text
->Center(wxBOTH
);
105 SetClientSize(wxMax(sizeText
.x
, 340) + 60, wxMax(sizeText
.y
, 40) + 40);
107 // need to size the panel correctly first so that text->Centre() works
108 panel
->SetSize(GetClientSize());
110 text
->Centre(wxBOTH
);
115 wxBusyInfo::wxBusyInfo(const wxString
& message
, wxWindow
*parent
)
117 m_InfoFrame
= new wxInfoFrame( parent
, message
);
118 if ( parent
&& parent
->HasFlag(wxSTAY_ON_TOP
) )
120 // we must have this flag to be in front of our parent if it has it
121 m_InfoFrame
->SetWindowStyleFlag(wxSTAY_ON_TOP
);
124 m_InfoFrame
->Show(true);
125 m_InfoFrame
->Refresh();
126 m_InfoFrame
->Update();
129 wxBusyInfo::~wxBusyInfo()
131 m_InfoFrame
->Show(false);
132 m_InfoFrame
->Close();
135 #endif // wxUSE_BUSYINFO