1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef INFOTIPS_HXX_INCLUDED 25 #define INFOTIPS_HXX_INCLUDED 26 27 #if defined _MSC_VER 28 #pragma warning(push, 1) 29 #pragma warning(disable:4917) 30 #endif 31 #include <objidl.h> 32 #include <shlobj.h> 33 #if defined _MSC_VER 34 #pragma warning(pop) 35 #endif 36 #include <string> 37 38 class CInfoTip : public IQueryInfo, public IPersistFile 39 { 40 public: 41 CInfoTip(long RefCnt = 1); 42 virtual ~CInfoTip(); 43 44 //----------------------------- 45 // IUnknown methods 46 //----------------------------- 47 48 virtual HRESULT STDMETHODCALLTYPE QueryInterface( 49 REFIID riid, 50 void __RPC_FAR *__RPC_FAR *ppvObject); 51 52 virtual ULONG STDMETHODCALLTYPE AddRef( void); 53 54 virtual ULONG STDMETHODCALLTYPE Release( void); 55 56 //---------------------------- 57 // IQueryInfo methods 58 //---------------------------- 59 60 virtual HRESULT STDMETHODCALLTYPE GetInfoTip(DWORD dwFlags, wchar_t** ppwszTip); 61 62 virtual HRESULT STDMETHODCALLTYPE GetInfoFlags(DWORD *pdwFlags); 63 64 //---------------------------- 65 // IPersist methods 66 //---------------------------- 67 68 virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID* pClassID); 69 70 //---------------------------- 71 // IPersistFile methods 72 //---------------------------- 73 74 virtual HRESULT STDMETHODCALLTYPE IsDirty(void); 75 76 virtual HRESULT STDMETHODCALLTYPE Load( 77 /* [in] */ LPCOLESTR pszFileName, 78 /* [in] */ DWORD dwMode); 79 80 virtual HRESULT STDMETHODCALLTYPE Save( 81 /* [unique][in] */ LPCOLESTR pszFileName, 82 /* [in] */ BOOL fRemember); 83 84 virtual HRESULT STDMETHODCALLTYPE SaveCompleted( 85 /* [unique][in] */ LPCOLESTR pszFileName); 86 87 virtual HRESULT STDMETHODCALLTYPE GetCurFile( 88 /* [out] */ LPOLESTR __RPC_FAR *ppszFileName); 89 90 private: 91 long m_RefCnt; 92 char m_szFileName[MAX_PATH]; 93 std::wstring m_FileNameOnly; 94 }; 95 96 #endif 97