// Author: Markus Greither and Vadim Zeitlin
// Modified by:
// Created: 23/03/2001
-// RCS-ID:
+// RCS-ID: $Id$
// Copyright: (c) Markus Greither
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// headers
// ----------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "mswfdrepdlg.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if wxUSE_FINDREPLDLG
#ifndef WX_PRECOMP
+ #include "wx/msw/wrapcdlg.h"
#include "wx/intl.h"
#include "wx/log.h"
#endif
-#include "wx/msw/private.h"
-
-#if !defined(__WIN32__) || defined(__WXWINCE__)
- #include <commdlg.h>
-#endif
-
#include "wx/fdrepdlg.h"
// ----------------------------------------------------------------------------
// functions prototypes
// ----------------------------------------------------------------------------
-LRESULT APIENTRY wxFindReplaceWindowProc(HWND hwnd, WXUINT nMsg,
- WPARAM wParam, LPARAM lParam);
+LRESULT CALLBACK wxFindReplaceWindowProc(HWND hwnd, WXUINT nMsg,
+ WPARAM wParam, LPARAM lParam);
UINT_PTR CALLBACK wxFindReplaceDialogHookProc(HWND hwnd,
UINT uiMsg,
FINDREPLACE *GetPtrFindReplace() { return &m_findReplace; }
// set/query the "closed by user" flag
- void SetClosedByUser() { m_wasClosedByUser = TRUE; }
+ void SetClosedByUser() { m_wasClosedByUser = true; }
bool WasClosedByUser() const { return m_wasClosedByUser; }
private:
// the find replace data used by the dialog
FINDREPLACE m_findReplace;
- // TRUE if the user closed us, FALSE otherwise
+ // true if the user closed us, false otherwise
bool m_wasClosedByUser;
// registered Message for Dialog
m_hwndOwner = NULL;
m_oldParentWndProc = NULL;
- m_wasClosedByUser = FALSE;
+ m_wasClosedByUser = false;
wxZeroMemory(m_findReplace);
*ppStr = new wxChar[len];
wxStrcpy(*ppStr, str);
- *pLen = len;
+ *pLen = (WORD)len;
}
void wxFindReplaceDialogImpl::InitFindWhat(const wxString& str)
// check that we don't subclass the parent twice: this would be a bad idea
// as then we'd have infinite recursion in wxFindReplaceWindowProc
- if ( !wxCheckWindowWndProc((WXHWND)hwnd, (WXFARPROC)wxFindReplaceWindowProc) )
- {
- // set the new one and save the old as user data to allow access to it
- // from wxFindReplaceWindowProc
- m_oldParentWndProc = wxSetWindowProc(hwnd, wxFindReplaceWindowProc);
+ wxCHECK_RET( wxGetWindowProc(hwnd) != &wxFindReplaceWindowProc,
+ _T("can't have more than one find dialog currently") );
- wxSetWindowUserData(hwnd, (void *)m_oldParentWndProc);
- }
+ // set the new one and save the old as user data to allow access to it
+ // from wxFindReplaceWindowProc
+ m_oldParentWndProc = wxSetWindowProc(hwnd, wxFindReplaceWindowProc);
+
+ wxSetWindowUserData(hwnd, (void *)m_oldParentWndProc);
}
wxFindReplaceDialogImpl::~wxFindReplaceDialogImpl()
// Window Proc for handling RegisterWindowMessage(FINDMSGSTRING)
// ----------------------------------------------------------------------------
-LRESULT APIENTRY wxFindReplaceWindowProc(HWND hwnd, WXUINT nMsg,
+LRESULT CALLBACK wxFindReplaceWindowProc(HWND hwnd, WXUINT nMsg,
WPARAM wParam, LPARAM lParam)
{
#if wxUSE_UNICODE_MSLU
// of UNICOWS.DLL send the correct UNICODE item after button press
// and a bogus ANSI mode item right after this, so lets ignore
// the second bogus message
- if ( s_lastMsgFlags == pFR->Flags )
+ if ( wxUsingUnicowsDll() && s_lastMsgFlags == pFR->Flags )
{
s_lastMsgFlags = 0;
return 0;
// map flags from Windows
wxEventType evtType;
- bool replace = FALSE;
+ bool replace = false;
if ( pFR->Flags & FR_DIALOGTERM )
{
// we have to notify the dialog that it's being closed by user and
{
evtType = wxEVT_COMMAND_FIND_REPLACE;
- replace = TRUE;
+ replace = true;
}
else if ( pFR->Flags & FR_REPLACEALL )
{
evtType = wxEVT_COMMAND_FIND_REPLACE_ALL;
- replace = TRUE;
+ replace = true;
}
else
{
m_FindReplaceData = NULL;
// as we're created in the hidden state, bring the internal flag in sync
- m_isShown = FALSE;
+ m_isShown = false;
}
wxFindReplaceDialog::wxFindReplaceDialog(wxWindow *parent,
delete m_impl;
// prevent the base class dtor from trying to hide us!
- m_isShown = FALSE;
+ m_isShown = false;
// and from destroying our window [again]
m_hWnd = (WXHWND)NULL;
if ( !wxWindowBase::Show(show) )
{
// visibility status didn't change
- return FALSE;
+ return false;
}
// do we already have the dialog window?
// yes, just use it
(void)::ShowWindow(GetHwnd(), show ? SW_SHOW : SW_HIDE);
- return TRUE;
+ return true;
}
if ( !show )
{
// well, it doesn't exist which is as good as being hidden
- return TRUE;
+ return true;
}
- wxCHECK_MSG( m_FindReplaceData, FALSE, _T("call Create() first!") );
+ wxCHECK_MSG( m_FindReplaceData, false, _T("call Create() first!") );
wxASSERT_MSG( !m_impl, _T("why don't we have the window then?") );
delete m_impl;
m_impl = NULL;
- return FALSE;
+ return false;
}
// subclass parent window in order to get FINDMSGSTRING message
m_hWnd = (WXHWND)hwnd;
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
}
#endif // wxUSE_FINDREPLDLG
-