#include "wx/msw/private.h"
#include "wx/evtloop.h"
-#include "wx/ptr_scpd.h"
+#include "wx/scopedptr.h"
#if defined(__SMARTPHONE__) && defined(__WXWINCE__)
#include "wx/msw/wince/resources.h"
#if wxUSE_TOOLBAR && defined(__POCKETPC__)
m_dialogToolBar = NULL;
#endif
+#if wxUSE_DIALOG_SIZEGRIP
m_hGripper = 0;
+#endif // wxUSE_DIALOG_SIZEGRIP
}
bool wxDialog::Create(wxWindow *parent,
CreateToolBar();
#endif
+#if wxUSE_DIALOG_SIZEGRIP
if ( HasFlag(wxRESIZE_BORDER) )
{
CreateGripper();
Connect(wxEVT_CREATE,
wxWindowCreateEventHandler(wxDialog::OnWindowCreate));
}
+#endif // wxUSE_DIALOG_SIZEGRIP
return true;
}
wxDialog::~wxDialog()
{
- m_isBeingDeleted = true;
-
// this will also reenable all the other windows for a modal dialog
Show(false);
+#if wxUSE_DIALOG_SIZEGRIP
DestroyGripper();
+#endif // wxUSE_DIALOG_SIZEGRIP
}
// ----------------------------------------------------------------------------
// showing the dialogs
// ----------------------------------------------------------------------------
-wxWindow *wxDialog::FindSuitableParent() const
-{
- // first try to use the currently active window
- HWND hwndFg = ::GetForegroundWindow();
- wxWindow *parent = hwndFg ? wxFindWinFromHandle((WXHWND)hwndFg)
- : NULL;
- if ( !parent )
- {
- // next try the main app window
- parent = wxTheApp->GetTopWindow();
- }
-
- // finally, check if the parent we found is really suitable
- if ( !parent || parent == (wxWindow *)this || !parent->IsShown() )
- {
- // don't use this one
- parent = NULL;
- }
-
- return parent;
-}
-
bool wxDialog::Show(bool show)
{
if ( show == IsShown() )
// show dialog modally
int wxDialog::ShowModal()
{
- wxASSERT_MSG( !IsModal(), _T("ShowModal() can't be called twice") );
+ wxASSERT_MSG( !IsModal(), wxT("ShowModal() can't be called twice") );
Show();
void wxDialog::EndModal(int retCode)
{
- wxASSERT_MSG( IsModal(), _T("EndModal() called for non modal dialog") );
+ wxASSERT_MSG( IsModal(), wxT("EndModal() called for non modal dialog") );
SetReturnCode(retCode);
// wxDialog gripper handling
// ----------------------------------------------------------------------------
+#if wxUSE_DIALOG_SIZEGRIP
+
void wxDialog::SetWindowStyleFlag(long style)
{
wxDialogBase::SetWindowStyleFlag(style);
// have been called yet)
wxASSERT_MSG( !IsShown() ||
::GetWindow((HWND)m_hGripper, GW_HWNDNEXT) == 0,
- _T("Bug in wxWidgets: gripper should be at the bottom of Z-order") );
+ wxT("Bug in wxWidgets: gripper should be at the bottom of Z-order") );
::DestroyWindow((HWND) m_hGripper);
m_hGripper = 0;
}
void wxDialog::ShowGripper(bool show)
{
- wxASSERT_MSG( m_hGripper, _T("shouldn't be called if we have no gripper") );
+ wxASSERT_MSG( m_hGripper, wxT("shouldn't be called if we have no gripper") );
if ( show )
ResizeGripper();
void wxDialog::ResizeGripper()
{
- wxASSERT_MSG( m_hGripper, _T("shouldn't be called if we have no gripper") );
+ wxASSERT_MSG( m_hGripper, wxT("shouldn't be called if we have no gripper") );
HWND hwndGripper = (HWND)m_hGripper;
event.Skip();
}
+#endif // wxUSE_DIALOG_SIZEGRIP
+
// ----------------------------------------------------------------------------
// wxWin event handlers
// ----------------------------------------------------------------------------
break;
case WM_SIZE:
+#if wxUSE_DIALOG_SIZEGRIP
if ( m_hGripper )
{
switch ( wParam )
ShowGripper(true);
}
}
+#endif // wxUSE_DIALOG_SIZEGRIP
// the Windows dialogs unfortunately are not meant to be resizeable
// at all and their standard class doesn't include CS_[VH]REDRAW