From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/omBrowser/configIni.h | 106 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 Src/omBrowser/configIni.h (limited to 'Src/omBrowser/configIni.h') diff --git a/Src/omBrowser/configIni.h b/Src/omBrowser/configIni.h new file mode 100644 index 00000000..c1a23c6c --- /dev/null +++ b/Src/omBrowser/configIni.h @@ -0,0 +1,106 @@ +#ifndef NULLSOFT_WINAMP_OMCONFIG_INI_HEADER +#define NULLSOFT_WINAMP_OMCONFIG_INI_HEADER + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include "./ifc_omconfig.h" +#include "./ifc_ombrowserconfig.h" +#include "./ifc_omdebugconfig.h" +#include "./ifc_omtoolbarconfig.h" +#include "./ifc_omstatusbarconfig.h" +#include +#include + +class api_application; + +#define MPIID_OMCONFIG 10 +#define MPIID_OMBROWSERCONFIG 20 +#define MPIID_OMDEBUGCONFIG 30 +#define MPIID_OMTOOLBARCONFIG 40 +#define MPIID_OMSTATUSBARCONFIG 50 + +class OmConfigIni : public MultiPatch, + public MultiPatch, + public MultiPatch, + public MultiPatch, + public MultiPatch +{ +protected: + OmConfigIni(LPCWSTR pszPath); + ~OmConfigIni(); + +public: + static HRESULT CreateInstance(LPCWSTR pszName, OmConfigIni **instanceOut); + +public: + /* Dispatchable */ + size_t AddRef(); + size_t Release(); + int QueryInterface(GUID interface_guid, void **object); + + /* ifc_omconfig */ + HRESULT GetPath(LPWSTR pszBuffer, INT cchBufferMax); + DWORD ReadStr(LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize); + UINT ReadInt(LPCWSTR lpSectionName, LPCWSTR lpKeyName, INT nDefault); + BOOL ReadBool(LPCWSTR lpSectionName, LPCWSTR lpKeyName, BOOL bDefault); + HRESULT WriteStr(LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpString); + HRESULT WriteInt(LPCWSTR lpSectionName, LPCWSTR lpKeyName, INT nValue); + HRESULT WriteBool(LPCWSTR lpSectionName, LPCWSTR lpKeyName, BOOL bValue); + HRESULT RegisterCallback(ifc_omconfigcallback *callback, UINT *cookie); + HRESULT UnregisterCallback(UINT cookie); + + /* ifc_ombrowserconfig */ + HRESULT GetClientId(LPWSTR pszBuffer, INT cchBufferMax); + HRESULT SetClientId(LPWSTR pszClientId); + UINT GetX(void); + UINT GetY(void); + HRESULT SetX(UINT x); + HRESULT SetY(UINT y); + + /* ifc_omdebugconfig */ + HRESULT GetMenuFilterEnabled(void); + HRESULT GetScriptErrorEnabled(void); + HRESULT GetScriptDebuggerEnabled(void); + HRESULT GetBrowserPath(LPWSTR pszBuffer, INT cchBufferMax); + HRESULT EnableMenuFilter(BOOL fEnable); + HRESULT EnableScriptError(BOOL fEnable); + HRESULT EnableScriptDebugger(BOOL fEnable); + HRESULT SetBrowserPath(LPCWSTR pszPath); + + /* ifc_omtoolbarconfig */ + HRESULT Toolbar_GetBottomDockEnabled(void); + HRESULT Toolbar_GetAutoHideEnabled(void); + HRESULT Toolbar_GetTabStopEnabled(void); + HRESULT Toolbar_GetForceAddressbarEnabled(void); + HRESULT Toolbar_GetFancyAddressbarEnabled(void); + HRESULT Toolbar_EnableBottomDock(BOOL fEnable); + HRESULT Toolbar_EnableAutoHide(BOOL fEnable); + HRESULT Toolbar_EnableTabStop(BOOL fEnable); + HRESULT Toolbar_EnableForceAddressbar(BOOL fEnable); + HRESULT Toolbar_EnableFancyAddressbar(BOOL fEnable); + + /* ifc_omstatusbarconfig */ + HRESULT Statusbar_GetEnabled(void); + HRESULT Statusbar_EnableStatusbar(BOOL fEnable); + +public: + void NotifyChange(const GUID *configUid, UINT valueId, ULONG_PTR value); + +protected: + typedef std::map CallbackMap; + +protected: + RECVS_MULTIPATCH; + +protected: + ULONG ref; + LPWSTR configPath; + UINT lastCookie; + CallbackMap callbackMap; + CRITICAL_SECTION lock; + BOOL pathValidated; +}; + +#endif //NULLSOFT_WINAMP_OMCONFIG_INI_HEADER \ No newline at end of file -- cgit