Develop and Download Open Source Software

Browse CVS Repository

Contents of /tombo/Tombo/Src/NewFolderDialog.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Mon Sep 25 15:59:44 2006 UTC (17 years, 6 months ago) by hirami
Branch: MAIN
CVS Tags: Tombo_2_0b4, B231, HEAD
Changes since 1.2: +19 -2 lines
File MIME type: text/x-c++src
* FIX: One pane mode is not worked(#8954)
* FIX: Save new note failed when choosing virtual folder(#9013)
* FIX: Cut/Copy/Paste is not worked when choosing from menu(WM5)(#9008)
* FIX: Renaming is not worked on some WM5 devices(#9014)
* FIX: Password timeout is not occured when displaying crypted notes and focus is in treeview.(#9050)

1 #include <windows.h>
2 #include <tchar.h>
3 #include <commctrl.h>
4 #include "NewFolderDialog.h"
5 #include "resource.h"
6 #include "SipControl.h"
7 #include "Message.h"
8 #include "DialogTemplate.h"
9
10 NewFolderDialog::NewFolderDialog() :
11 hDialog(NULL), hInstance(NULL), pBaseText(NULL),
12 nTitleID(MSG_ID_DLG_NEWFOLDER_TITLE)
13 {
14 aFolder[0] = TEXT('\0');
15 }
16
17 //////////////////////////////////////////////////////////
18 // Dialog procedure
19 //////////////////////////////////////////////////////////
20
21 static BOOL APIENTRY DlgProc(HWND hDlg, UINT nMessage, WPARAM wParam, LPARAM lParam)
22 {
23 NewFolderDialog *pDlg;
24 if (nMessage == WM_INITDIALOG) {
25 SetWindowLong(hDlg, DWL_USER, lParam);
26 pDlg = (NewFolderDialog*)lParam;
27
28 pDlg->InitDialog(hDlg);
29 return TRUE;
30 }
31
32 pDlg = (NewFolderDialog*)GetWindowLong(hDlg, DWL_USER);
33 if (pDlg == NULL) return FALSE;
34
35 switch (nMessage) {
36 case WM_COMMAND:
37 switch (wParam) {
38 case IDOK:
39 if (pDlg->OnOK(hDlg)) {
40 EndDialog(hDlg, IDOK);
41 }
42 break;
43 case IDCANCEL:
44 EndDialog(hDlg, IDCANCEL);
45 break;
46 }
47 return TRUE;
48 }
49 return FALSE;
50 }
51
52 //////////////////////////////////////////////////////////
53 // popup dialog
54 //////////////////////////////////////////////////////////
55
56 DWORD NewFolderDialog::Popup(HINSTANCE hInst, HWND hParent)
57 {
58 hInstance = hInst;
59
60 SipControl sc;
61 BOOL bSipStat, bResult;
62
63 bResult = sc.Init() && sc.GetSipStat(&bSipStat);
64 if (bResult) sc.SetSipStat(TRUE);
65
66 DWORD result;
67 result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_NEWFOLDER),
68 hParent, (DLGPROC)DlgProc, (LONG)this);
69
70 if (bResult) sc.SetSipStat(bSipStat);
71
72 return result;
73 }
74
75 //////////////////////////////////////////////////////////
76 // Initialize
77 //////////////////////////////////////////////////////////
78
79 static DlgMsgRes aDlgRes[] = {
80 { IDOK, MSG_ID_DLG_CMN_OK },
81 { IDCANCEL, MSG_ID_DLG_CMN_CANCEL },
82 };
83
84 void NewFolderDialog::InitDialog(HWND hDlg)
85 {
86 OverrideDlgMsg(hDlg, nTitleID, aDlgRes, sizeof(aDlgRes)/sizeof(DlgMsgRes));
87
88 HWND hEdit = GetDlgItem(hDlg, IDC_NEWFOLDER_NAME);
89
90 if (pBaseText == NULL) {
91 pBaseText = TEXT("");
92 }
93 SetWindowText(hEdit, pBaseText);
94 }
95
96 //////////////////////////////////////////////////////////
97 // OK
98 //////////////////////////////////////////////////////////
99
100 BOOL NewFolderDialog::OnOK(HWND hDlg)
101 {
102 HWND hEdit = GetDlgItem(hDlg, IDC_NEWFOLDER_NAME);
103 DWORD n = GetWindowTextLength(hEdit);
104 if (n == 0) return FALSE;
105
106 GetWindowText(hEdit, aFolder, n + 1);
107 aFolder[n] = TEXT('\0');
108 return TRUE;
109 }
110
111 void NewFolderDialog::SetOption(DWORD nID, LPCTSTR pText)
112 {
113 nTitleID = nID;
114 pBaseText = pText;
115 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26