]> git.saurik.com Git - wxWidgets.git/blame - src/generic/busyinfo.cpp
Applied patch [ 603104 ] wxX11 wxClientDC, wxPaintDC fix
[wxWidgets.git] / src / generic / busyinfo.cpp
CommitLineData
5526e819
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: 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/////////////////////////////////////////////////////////////////////////////
8
9#ifdef __GNUG__
d1af991f 10#pragma implementation "busyinfo.h"
5526e819
VS
11#endif
12
d1af991f 13#include "wx/wxprec.h"
5526e819
VS
14
15#ifdef __BORDLANDC__
16#pragma hdrstop
17#endif
18
d78b3d64
VS
19#if wxUSE_BUSYINFO
20
5526e819 21#include "wx/busyinfo.h"
d1af991f
RR
22#include "wx/stattext.h"
23#include "wx/panel.h"
24#include "wx/utils.h"
5526e819
VS
25
26
27wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message)
868741e9 28 : wxFrame(parent, -1, wxT("Busy"),
21977bac 29 wxDefaultPosition, wxDefaultSize,
868741e9
JS
30#if defined(__WXX11__)
31 wxTHICK_FRAME | wxFRAME_TOOL_WINDOW)
32#else
21977bac 33 wxSIMPLE_BORDER | wxFRAME_TOOL_WINDOW)
868741e9 34#endif
5526e819 35{
21977bac
VZ
36 wxPanel *panel = new wxPanel( this );
37 wxStaticText *text = new wxStaticText(panel, -1, message);
38
39 panel->SetCursor(*wxHOURGLASS_CURSOR);
40 text->SetCursor(*wxHOURGLASS_CURSOR);
41
42 // make the frame of at least the standard size (400*80) but big enough
43 // for the text we show
44 wxSize sizeText = text->GetBestSize();
94640e04
DW
45#ifdef __WXPM__
46 int nX = 0;
47 int nY = 0;
48 int nWidth = 0;
49 int nHeight = 0;
50 int nParentHeight = parent->GetClientSize().y;
51 int nParentWidth = parent->GetClientSize().x;
52 int nColor;
53
54 SetBackgroundColour("WHITE");
55 nColor = (LONG)GetBackgroundColour().GetPixel();
56
57 ::WinSetPresParam( GetHwnd()
58 ,PP_BACKGROUNDCOLOR
59 ,sizeof(LONG)
60 ,(PVOID)&nColor
61 );
62 panel->SetBackgroundColour("WHITE");
63 nColor = (LONG)panel->GetBackgroundColour().GetPixel();
64
65 ::WinSetPresParam( GetHwndOf(panel)
66 ,PP_BACKGROUNDCOLOR
67 ,sizeof(LONG)
68 ,(PVOID)&nColor
69 );
70 nWidth = wxMax(sizeText.x, 340) + 60;
71 nHeight = wxMax(sizeText.y, 40) + 40;
72 nX = (nParentWidth - nWidth) / 2;
73 nY = (nParentHeight / 2) - (nHeight / 2);
74 nY = nParentHeight - (nY + nHeight);
75 ::WinSetWindowPos( m_hFrame
76 ,HWND_TOP
77 ,nX
78 ,nY
79 ,nWidth
80 ,nHeight
81 ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE
82 );
83 text->SetBackgroundColour("WHITE");
84 nColor = (LONG)text->GetBackgroundColour().GetPixel();
85
86 ::WinSetPresParam( GetHwndOf(text)
87 ,PP_BACKGROUNDCOLOR
88 ,sizeof(LONG)
89 ,(PVOID)&nColor
90 );
91 text->Center(wxBOTH);
92#else
21977bac
VZ
93 SetClientSize(wxMax(sizeText.x, 340) + 60, wxMax(sizeText.y, 40) + 40);
94
95 // need to size the panel correctly first so that text->Centre() works
96 panel->SetSize(GetClientSize());
97
98 text->Centre(wxBOTH);
5526e819 99 Centre(wxBOTH);
94640e04 100#endif
5526e819
VS
101}
102
21977bac 103wxBusyInfo::wxBusyInfo(const wxString& message, wxWindow *parent)
5526e819 104{
21977bac 105 m_InfoFrame = new wxInfoFrame( parent, message);
d1af991f 106 m_InfoFrame->Show(TRUE);
5526e819 107 wxYield();
d1af991f 108 m_InfoFrame->Refresh();
5526e819
VS
109 wxYield();
110}
111
5526e819
VS
112wxBusyInfo::~wxBusyInfo()
113{
d1af991f
RR
114 m_InfoFrame->Show(FALSE);
115 m_InfoFrame->Close();
5526e819
VS
116 wxYield();
117}
118
d78b3d64 119#endif
2996bcde
PA
120 // wxUSE_BUSYINFO
121