1 /* -*- Mode: C; tab-width: 4 -*-
3 * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef __EXPLORER_BAR_WINDOW__
19 #define __EXPLORER_BAR_WINDOW__
28 //===========================================================================================================================
30 //===========================================================================================================================
32 // Forward Declarations
34 struct ServiceHandlerEntry
;
35 class ExplorerBarWindow
;
47 ServiceHandlerEntry
* handler
;
75 typedef CArray
< ServiceInfo
*, ServiceInfo
* > ServiceInfoArray
;
98 void GetData( void *outData
, uint16_t *outSize
)
102 *( (void **) outData
) = mData
;
110 OSStatus
SetData( const void *inData
, uint16_t inSize
)
115 newData
= (uint8_t *) malloc( inSize
);
116 require_action( newData
, exit
, err
= kNoMemoryErr
);
117 memcpy( newData
, inData
, inSize
);
140 ServiceHandlerEntry
* handler
;
143 // ServiceHandlerEntry
145 struct ServiceHandlerEntry
148 const char * urlScheme
;
150 ServiceInfoArray array
;
151 ExplorerBarWindow
* obj
;
154 ServiceHandlerEntry( void )
163 ~ServiceHandlerEntry( void )
168 n
= (int) array
.GetSize();
169 for( i
= 0; i
< n
; ++i
)
176 typedef CArray
< ServiceHandlerEntry
*, ServiceHandlerEntry
* > ServiceHandlerArray
;
178 //===========================================================================================================================
180 //===========================================================================================================================
182 class ExplorerBar
; // Forward Declaration
184 class ExplorerBarWindow
: public CWnd
188 ExplorerBar
* mOwner
;
191 ServiceHandlerArray mServiceHandlers
;
192 DNSServiceRef mResolveServiceRef
;
196 ExplorerBarWindow( void );
197 virtual ~ExplorerBarWindow( void );
203 afx_msg
int OnCreate( LPCREATESTRUCT inCreateStruct
);
204 afx_msg
void OnDestroy( void );
205 afx_msg
void OnSize( UINT inType
, int inX
, int inY
);
206 afx_msg
void OnDoubleClick( NMHDR
*inNMHDR
, LRESULT
*outResult
);
207 afx_msg LRESULT
OnServiceEvent( WPARAM inWParam
, LPARAM inLParam
);
211 static void DNSSD_API
214 DNSServiceFlags inFlags
,
215 uint32_t inInterfaceIndex
,
216 DNSServiceErrorType inErrorCode
,
219 const char * inDomain
,
221 LONG
OnServiceAdd( ServiceInfo
* service
);
222 LONG
OnServiceRemove( ServiceInfo
* service
);
226 OSStatus
StartResolve( ServiceInfo
*inService
);
227 void StopResolve( void );
230 void Stop( DNSServiceRef ref
);
233 static void DNSSD_API
236 DNSServiceFlags inFlags
,
237 uint32_t inInterfaceIndex
,
238 DNSServiceErrorType inErrorCode
,
239 const char * inFullName
,
240 const char * inHostName
,
245 LONG
OnResolve( ResolveInfo
* resolve
);
251 ExplorerBar
* GetOwner( void ) const { return( mOwner
); }
252 void SetOwner( ExplorerBar
*inOwner
) { mOwner
= inOwner
; }
254 DECLARE_MESSAGE_MAP()
257 typedef std::list
< DNSServiceRef
> ServiceRefList
;
260 ServiceRefList m_serviceRefs
;
261 CImageList m_imageList
;
264 #endif // __EXPLORER_BAR_WINDOW__