1 /*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 
17 #pragma once
18 #include "afxwin.h"
19 #include "JavaFinder.h"
20 
21 #include "resource.h"		// main symbols
22 
23 
24 // CFindJava2Dlg dialog
25 class CFindJava2Dlg : public CDialog {
26     // Construction
27 public:
28     CFindJava2Dlg(CWnd* pParent = NULL);	// standard constructor
29 
setJavaFinder(CJavaFinder * javaFinder)30     void setJavaFinder(CJavaFinder *javaFinder) { mJavaFinder = javaFinder;  }
31     const CJavaPath& getSelectedPath();
32 
33     // Dialog Data
34     enum { IDD = IDD_FINDJAVA2_DIALOG };
35 
36 protected:
37     virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
38 
39 
40     // Implementation
41 protected:
42     HICON m_hIcon;
43 
44     // Generated message map functions
45     virtual BOOL OnInitDialog();
46     afx_msg void OnPaint();
47     afx_msg HCURSOR OnQueryDragIcon();
48     DECLARE_MESSAGE_MAP()
49 
50     afx_msg void OnBnClickedButtonAdd();
51     afx_msg void OnNMClickPathList(NMHDR *pNMHDR, LRESULT *pResult);
52     afx_msg void OnLvnItemchangedPathList(NMHDR *pNMHDR, LRESULT *pResult);
53 
54 private:
55     std::set<CJavaPath> mPaths;
56     int mSelectedIndex;
57     CJavaFinder *mJavaFinder;
58     CListCtrl mPathsListCtrl;
59     CButton mOkButton;
60 
61     void fillPathsList();
62     void adjustButtons();
63     void selectPath(int index = -1, const CJavaPath *path = nullptr);
64 };
65