]> git.saurik.com Git - wxWidgets.git/blame - src/generic/busyinfo.cpp
minor cleanup
[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
65571936 6// Licence: wxWindows licence
5526e819
VS
7/////////////////////////////////////////////////////////////////////////////
8
d1af991f 9#include "wx/wxprec.h"
5526e819 10
2b5f62a0 11#ifdef __BORLANDC__
5526e819
VS
12#pragma hdrstop
13#endif
14
d78b3d64
VS
15#if wxUSE_BUSYINFO
16
d1af991f
RR
17#include "wx/stattext.h"
18#include "wx/panel.h"
19#include "wx/utils.h"
68b767bf 20#include "wx/busyinfo.h"
5526e819
VS
21
22
23wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message)
ca65c044 24 : wxFrame(parent, wxID_ANY, wxT("Busy"),
21977bac 25 wxDefaultPosition, wxDefaultSize,
868741e9 26#if defined(__WXX11__)
68b767bf 27 wxTHICK_FRAME
868741e9 28#else
68b767bf 29 wxSIMPLE_BORDER
868741e9 30#endif
68b767bf 31 | wxFRAME_TOOL_WINDOW)
5526e819 32{
21977bac 33 wxPanel *panel = new wxPanel( this );
ca65c044 34 wxStaticText *text = new wxStaticText(panel, wxID_ANY, message);
21977bac
VZ
35
36 panel->SetCursor(*wxHOURGLASS_CURSOR);
37 text->SetCursor(*wxHOURGLASS_CURSOR);
38
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();
94640e04
DW
42#ifdef __WXPM__
43 int nX = 0;
44 int nY = 0;
45 int nWidth = 0;
46 int nHeight = 0;
47 int nParentHeight = parent->GetClientSize().y;
48 int nParentWidth = parent->GetClientSize().x;
49 int nColor;
50
18ed8e00 51 SetBackgroundColour(wxT("WHITE"));
94640e04
DW
52 nColor = (LONG)GetBackgroundColour().GetPixel();
53
54 ::WinSetPresParam( GetHwnd()
55 ,PP_BACKGROUNDCOLOR
56 ,sizeof(LONG)
57 ,(PVOID)&nColor
58 );
18ed8e00 59 panel->SetBackgroundColour(wxT("WHITE"));
94640e04
DW
60 nColor = (LONG)panel->GetBackgroundColour().GetPixel();
61
62 ::WinSetPresParam( GetHwndOf(panel)
63 ,PP_BACKGROUNDCOLOR
64 ,sizeof(LONG)
65 ,(PVOID)&nColor
66 );
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
73 ,HWND_TOP
74 ,nX
75 ,nY
76 ,nWidth
77 ,nHeight
78 ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE
79 );
18ed8e00 80 text->SetBackgroundColour(wxT("WHITE"));
94640e04
DW
81 nColor = (LONG)text->GetBackgroundColour().GetPixel();
82
83 ::WinSetPresParam( GetHwndOf(text)
84 ,PP_BACKGROUNDCOLOR
85 ,sizeof(LONG)
86 ,(PVOID)&nColor
87 );
88 text->Center(wxBOTH);
89#else
21977bac
VZ
90 SetClientSize(wxMax(sizeText.x, 340) + 60, wxMax(sizeText.y, 40) + 40);
91
92 // need to size the panel correctly first so that text->Centre() works
93 panel->SetSize(GetClientSize());
94
95 text->Centre(wxBOTH);
5526e819 96 Centre(wxBOTH);
94640e04 97#endif
5526e819
VS
98}
99
21977bac 100wxBusyInfo::wxBusyInfo(const wxString& message, wxWindow *parent)
5526e819 101{
21977bac 102 m_InfoFrame = new wxInfoFrame( parent, message);
ca65c044 103 m_InfoFrame->Show(true);
d1af991f 104 m_InfoFrame->Refresh();
0b634ddd 105 m_InfoFrame->Update();
5526e819
VS
106}
107
5526e819
VS
108wxBusyInfo::~wxBusyInfo()
109{
ca65c044 110 m_InfoFrame->Show(false);
d1af991f 111 m_InfoFrame->Close();
5526e819
VS
112}
113
d78b3d64 114#endif
2996bcde
PA
115 // wxUSE_BUSYINFO
116