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