• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* -*- Mode: C; tab-width: 4 -*-
2  *
3  * Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #if !defined(AFX_CHOOSERDIALOG_H__AC258704_B307_4901_9F98_A0AC022FD8AC__INCLUDED_)
19 #define AFX_CHOOSERDIALOG_H__AC258704_B307_4901_9F98_A0AC022FD8AC__INCLUDED_
20 
21 #if _MSC_VER > 1000
22 #pragma once
23 #endif // _MSC_VER > 1000
24 
25 #include	<string>
26 #include	<vector>
27 
28 #include	"afxcmn.h"
29 
30 #include	"Resource.h"
31 
32 #include	"DNSServices.h"
33 
34 //===========================================================================================================================
35 //	Structures
36 //===========================================================================================================================
37 
38 struct	ServiceInstanceInfo
39 {
40 	std::string		name;
41 	std::string		type;
42 	std::string		domain;
43 	std::string		ip;
44 	std::string		text;
45 	std::string		ifIP;
46 	std::string		hostName;
47 };
48 
49 struct	ServiceTypeInfo
50 {
51 	std::string		serviceType;
52 	std::string		description;
53 	std::string		urlScheme;
54 };
55 
56 //===========================================================================================================================
57 //	ChooserDialog
58 //===========================================================================================================================
59 
60 class	ChooserDialog : public CDialog
61 {
62 	public:
63 
64 		ChooserDialog(CWnd* pParent = NULL);
65 		virtual	~ChooserDialog( void );
66 
67 		//{{AFX_DATA(ChooserDialog)
68 		enum { IDD = IDD_CHOOSER_DIALOG };
69 		CListCtrl mServiceList;
70 		CListCtrl mDomainList;
71 		CListCtrl mChooserList;
72 		//}}AFX_DATA
73 
74 		// ClassWizard generated virtual function overrides
75 		//{{AFX_VIRTUAL(ChooserDialog)
76 		public:
77 		virtual BOOL PreTranslateMessage(MSG* pMsg);
78 		protected:
79 		virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
80 		virtual void PostNcDestroy();
81 		//}}AFX_VIRTUAL
82 
83 	protected:
84 
85 		typedef std::vector < ServiceInstanceInfo >		ServiceInstanceVector;
86 		typedef std::vector < ServiceTypeInfo >			ServiceTypeVector;
87 
88 		HACCEL						mMenuAcceleratorTable;
89 		DNSBrowserRef				mBrowser;
90 		BOOL						mIsServiceBrowsing;
91 		ServiceInstanceVector		mServiceInstances;
92 		ServiceTypeVector			mServiceTypes;
93 
94 	public:
95 
96 		void	PopulateServicesList( void );
97 		void	UpdateInfoDisplay( void );
98 
99 		void	StartBrowsing( const char *inType, const char *inDomain );
100 		void	StopBrowsing( void );
101 
102 	protected:
103 
104 		//{{AFX_MSG(ChooserDialog)
105 		virtual BOOL OnInitDialog();
106 		afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
107 		afx_msg void OnDomainListChanged(NMHDR* pNMHDR, LRESULT* pResult);
108 		afx_msg void OnServiceListChanged(NMHDR* pNMHDR, LRESULT* pResult);
109 		afx_msg void OnChooserListChanged(NMHDR* pNMHDR, LRESULT* pResult);
110 		afx_msg void OnChooserListDoubleClick(NMHDR* pNMHDR, LRESULT* pResult);
111 		afx_msg void OnAbout();
112 		afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
113 		afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
114 		afx_msg void OnFileClose();
115 		virtual void OnCancel();
116 		afx_msg void OnExit();
117 		afx_msg void OnClose();
118 		afx_msg void OnNcDestroy();
119 		//}}AFX_MSG
120 		afx_msg LONG OnDomainAdd( WPARAM inWParam, LPARAM inLParam );
121 		afx_msg LONG OnDomainRemove( WPARAM inWParam, LPARAM inLParam );
122 		afx_msg LONG OnServiceAdd( WPARAM inWParam, LPARAM inLParam );
123 		afx_msg LONG OnServiceRemove( WPARAM inWParam, LPARAM inLParam );
124 		afx_msg LONG OnResolve( WPARAM inWParam, LPARAM inLParam );
125 		DECLARE_MESSAGE_MAP()
126 };
127 
128 //{{AFX_INSERT_LOCATION}}
129 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
130 
131 #endif // !defined(AFX_CHOOSERDIALOG_H__AC258704_B307_4901_9F98_A0AC022FD8AC__INCLUDED_)
132