]> git.saurik.com Git - wxWidgets.git/blame - src/generic/busyinfo.cpp
Add test for absence of events from wxSpinCtrlDouble ctor.
[wxWidgets.git] / src / generic / busyinfo.cpp
CommitLineData
5526e819 1/////////////////////////////////////////////////////////////////////////////
b7ba00e7 2// Name: src/generic/busyinfo.cpp
5526e819
VS
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
b7ba00e7
WS
17// for all others, include the necessary headers
18#ifndef WX_PRECOMP
95d00805 19 #include "wx/frame.h"
b7ba00e7
WS
20 #include "wx/stattext.h"
21 #include "wx/panel.h"
22 #include "wx/utils.h"
23#endif
24
68b767bf 25#include "wx/busyinfo.h"
d0285203 26#include "wx/generic/stattextg.h"
5526e819 27
b7ba00e7
WS
28class WXDLLEXPORT wxInfoFrame : public wxFrame
29{
30public:
31 wxInfoFrame(wxWindow *parent, const wxString& message);
32
33private:
c0c133e1 34 wxDECLARE_NO_COPY_CLASS(wxInfoFrame);
b7ba00e7
WS
35};
36
5526e819
VS
37
38wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message)
ca65c044 39 : wxFrame(parent, wxID_ANY, wxT("Busy"),
21977bac 40 wxDefaultPosition, wxDefaultSize,
868741e9 41#if defined(__WXX11__)
1c067fe3 42 wxRESIZE_BORDER
868741e9 43#else
68b767bf 44 wxSIMPLE_BORDER
868741e9 45#endif
e1215210 46 | wxFRAME_TOOL_WINDOW | wxSTAY_ON_TOP)
5526e819 47{
21977bac 48 wxPanel *panel = new wxPanel( this );
f5d59096 49#ifdef __WXGTK__
d0285203
RR
50 wxGenericStaticText *text = new wxGenericStaticText(panel, wxID_ANY, message);
51#else
ca65c044 52 wxStaticText *text = new wxStaticText(panel, wxID_ANY, message);
d0285203 53#endif
21977bac
VZ
54
55 panel->SetCursor(*wxHOURGLASS_CURSOR);
56 text->SetCursor(*wxHOURGLASS_CURSOR);
57
58 // make the frame of at least the standard size (400*80) but big enough
59 // for the text we show
60 wxSize sizeText = text->GetBestSize();
94640e04
DW
61#ifdef __WXPM__
62 int nX = 0;
63 int nY = 0;
64 int nWidth = 0;
65 int nHeight = 0;
66 int nParentHeight = parent->GetClientSize().y;
67 int nParentWidth = parent->GetClientSize().x;
68 int nColor;
69
18ed8e00 70 SetBackgroundColour(wxT("WHITE"));
94640e04
DW
71 nColor = (LONG)GetBackgroundColour().GetPixel();
72
73 ::WinSetPresParam( GetHwnd()
74 ,PP_BACKGROUNDCOLOR
75 ,sizeof(LONG)
76 ,(PVOID)&nColor
77 );
18ed8e00 78 panel->SetBackgroundColour(wxT("WHITE"));
94640e04
DW
79 nColor = (LONG)panel->GetBackgroundColour().GetPixel();
80
81 ::WinSetPresParam( GetHwndOf(panel)
82 ,PP_BACKGROUNDCOLOR
83 ,sizeof(LONG)
84 ,(PVOID)&nColor
85 );
86 nWidth = wxMax(sizeText.x, 340) + 60;
87 nHeight = wxMax(sizeText.y, 40) + 40;
88 nX = (nParentWidth - nWidth) / 2;
89 nY = (nParentHeight / 2) - (nHeight / 2);
90 nY = nParentHeight - (nY + nHeight);
91 ::WinSetWindowPos( m_hFrame
92 ,HWND_TOP
93 ,nX
94 ,nY
95 ,nWidth
96 ,nHeight
97 ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE
98 );
18ed8e00 99 text->SetBackgroundColour(wxT("WHITE"));
94640e04
DW
100 nColor = (LONG)text->GetBackgroundColour().GetPixel();
101
102 ::WinSetPresParam( GetHwndOf(text)
103 ,PP_BACKGROUNDCOLOR
104 ,sizeof(LONG)
105 ,(PVOID)&nColor
106 );
107 text->Center(wxBOTH);
108#else
21977bac
VZ
109 SetClientSize(wxMax(sizeText.x, 340) + 60, wxMax(sizeText.y, 40) + 40);
110
111 // need to size the panel correctly first so that text->Centre() works
112 panel->SetSize(GetClientSize());
113
114 text->Centre(wxBOTH);
5526e819 115 Centre(wxBOTH);
94640e04 116#endif
5526e819
VS
117}
118
21977bac 119wxBusyInfo::wxBusyInfo(const wxString& message, wxWindow *parent)
5526e819 120{
e1215210 121 m_InfoFrame = new wxInfoFrame(parent, message);
ca65c044 122 m_InfoFrame->Show(true);
d1af991f 123 m_InfoFrame->Refresh();
0b634ddd 124 m_InfoFrame->Update();
5526e819
VS
125}
126
5526e819
VS
127wxBusyInfo::~wxBusyInfo()
128{
ca65c044 129 m_InfoFrame->Show(false);
d1af991f 130 m_InfoFrame->Close();
5526e819
VS
131}
132
b7ba00e7 133#endif // wxUSE_BUSYINFO