| 1 |
/* AbiWord |
| 2 |
* Copyright (C) 2000 AbiSource, Inc. |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or |
| 5 |
* modify it under the terms of the GNU General Public License |
| 6 |
* as published by the Free Software Foundation; either version 2 |
| 7 |
* of the License, or (at your option) any later version. |
| 8 |
* |
| 9 |
* This program is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
* GNU General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU General Public License |
| 15 |
* along with this program; if not, write to the Free Software |
| 16 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 17 |
* 02110-1301 USA. |
| 18 |
*/ |
| 19 |
|
| 20 |
#include <windows.h> |
| 21 |
|
| 22 |
#include "ut_string.h" |
| 23 |
#include "ut_assert.h" |
| 24 |
#include "ut_debugmsg.h" |
| 25 |
|
| 26 |
#include "xap_App.h" |
| 27 |
#include "xap_Win32App.h" |
| 28 |
#include "xap_Win32FrameImpl.h" |
| 29 |
|
| 30 |
#include "xap_Strings.h" |
| 31 |
#include "xap_Dialog_Id.h" |
| 32 |
#include "xap_Dlg_Password.h" |
| 33 |
#include "xap_Win32Dlg_Password.h" |
| 34 |
|
| 35 |
#include "xap_Win32Resources.rc2" |
| 36 |
|
| 37 |
/*****************************************************************/ |
| 38 |
|
| 39 |
XAP_Dialog * XAP_Win32Dialog_Password::static_constructor(XAP_DialogFactory * pFactory, |
| 40 |
XAP_Dialog_Id id) |
| 41 |
{ |
| 42 |
XAP_Win32Dialog_Password * p = new XAP_Win32Dialog_Password(pFactory,id); |
| 43 |
return p; |
| 44 |
} |
| 45 |
|
| 46 |
XAP_Win32Dialog_Password::XAP_Win32Dialog_Password(XAP_DialogFactory * pDlgFactory, |
| 47 |
XAP_Dialog_Id id) |
| 48 |
: XAP_Dialog_Password(pDlgFactory,id) |
| 49 |
{ |
| 50 |
} |
| 51 |
|
| 52 |
XAP_Win32Dialog_Password::~XAP_Win32Dialog_Password(void) |
| 53 |
{ |
| 54 |
} |
| 55 |
|
| 56 |
void XAP_Win32Dialog_Password::runModal(XAP_Frame * pFrame) |
| 57 |
{ |
| 58 |
UT_ASSERT(pFrame); |
| 59 |
UT_ASSERT(m_id == XAP_DIALOG_ID_PASSWORD); |
| 60 |
|
| 61 |
setDialog(this); |
| 62 |
createModal(pFrame, MAKEINTRESOURCEW(XAP_RID_DIALOG_PASSWORD)); |
| 63 |
} |
| 64 |
|
| 65 |
#define _DSX(c,s) setDlgItemText(XAP_RID_DIALOG_##c,pSS->getValue(XAP_STRING_ID_##s)) |
| 66 |
|
| 67 |
BOOL XAP_Win32Dialog_Password::_onInitDialog(HWND /*hWnd*/, WPARAM /*wParam*/, LPARAM /*lParam*/) |
| 68 |
{ |
| 69 |
// localize dialog title |
| 70 |
localizeDialogTitle(XAP_STRING_ID_DLG_Password_Title); |
| 71 |
|
| 72 |
// localize controls |
| 73 |
localizeControlText(XAP_RID_DIALOG_PASSWORD_BTN_OK, XAP_STRING_ID_DLG_OK); |
| 74 |
localizeControlText(XAP_RID_DIALOG_PASSWORD_BTN_CANCEL, XAP_STRING_ID_DLG_Cancel); |
| 75 |
localizeControlText(XAP_RID_DIALOG_PASSWORD_LBL_PASSWORD, XAP_STRING_ID_DLG_Password_Password); |
| 76 |
|
| 77 |
return 1; |
| 78 |
} |
| 79 |
|
| 80 |
BOOL XAP_Win32Dialog_Password::_onCommand(HWND hWnd, WPARAM wParam, LPARAM /*lParam*/) |
| 81 |
{ |
| 82 |
WORD wId = LOWORD(wParam); |
| 83 |
|
| 84 |
switch (wId) |
| 85 |
{ |
| 86 |
case XAP_RID_DIALOG_PASSWORD_BTN_CANCEL: |
| 87 |
setAnswer( a_Cancel ); |
| 88 |
EndDialog(hWnd,0); |
| 89 |
return 1; |
| 90 |
|
| 91 |
case XAP_RID_DIALOG_PASSWORD_BTN_OK: |
| 92 |
{ |
| 93 |
char buf[1024]; |
| 94 |
getControlText(XAP_RID_DIALOG_PASSWORD_EBX_PASSWORD, buf, 1024); |
| 95 |
setPassword( buf ); |
| 96 |
} |
| 97 |
setAnswer( a_OK ); |
| 98 |
EndDialog(hWnd,0); |
| 99 |
return 1; |
| 100 |
|
| 101 |
default: // we did not handle this notification |
| 102 |
UT_DEBUGMSG(("WM_Command for id %ld\n",wId)); |
| 103 |
return 0; // return zero to let windows take care of it. |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
BOOL XAP_Win32Dialog_Password::_onDeltaPos(NM_UPDOWN * /*pnmud*/) |
| 108 |
{ |
| 109 |
return 1; |
| 110 |
} |