diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Library/ml_local/FolderBrowseEx.h | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Plugins/Library/ml_local/FolderBrowseEx.h')
-rw-r--r-- | Src/Plugins/Library/ml_local/FolderBrowseEx.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/Src/Plugins/Library/ml_local/FolderBrowseEx.h b/Src/Plugins/Library/ml_local/FolderBrowseEx.h new file mode 100644 index 00000000..746d186d --- /dev/null +++ b/Src/Plugins/Library/ml_local/FolderBrowseEx.h @@ -0,0 +1,97 @@ +#ifndef NULLSOFT_FOLDERBROWSE_EXTENDED_DIALOG_HEADER +#define NULLSOFT_FOLDERBROWSE_EXTENDED_DIALOG_HEADER + +#include <windows.h> +#include <shlobj.h> + +/// Standart controls +#define IDC_TV_FOLDERS 0x3741 +#define IDC_SB_GRIPPER 0x3747 +#define IDC_LBL_FOLDER 0x3748 +#define IDC_LBL_CAPTION 0x3742 +#define IDC_EDT_PATH 0x3744 + + +typedef struct _BFPATH +{ + int empty; + int type; + void *value; +}BFPATH; + +class FolderBrowseEx +{ +public: + FolderBrowseEx(LPCITEMIDLIST pidlRoot, UINT ulFlags, LPCWSTR lpszCaption, LPCWSTR lpszTitle); + FolderBrowseEx(UINT ulFlags, LPCWSTR lpszCaption, LPCWSTR lpszTitle); + FolderBrowseEx(UINT ulFlags, LPCWSTR lpszTitle); + FolderBrowseEx(void); + virtual ~FolderBrowseEx(void); + +public: + virtual LPITEMIDLIST Browse(HWND hwndOwner); + + LPITEMIDLIST GetPIDL(void) { return pidl; } + INT GetImage(void) { return image; } + LPCWSTR GetDislpayName(void) { return pszDisplayName; } + HRESULT ParseDisplayName(LPCWSTR lpszPath, IBindCtx *pbc, LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut); + HWND GetDlgItem(int nIDDlgItem) { return ::GetDlgItem(hwnd, nIDDlgItem); } + + void SetRoot(LPCITEMIDLIST pidlRoot) { this->pidlRoot = pidlRoot; } + void SetFlags(UINT ulFlags) { this->ulFlags = ulFlags; } + void SetSelection(LPCITEMIDLIST pidlSelect); + void SetSelection(LPCWSTR lpszSelect); + void SetExpanded(LPCITEMIDLIST pidlExpand); + void SetExpanded(LPCWSTR lpszExpand); + void SetCaption(LPCWSTR lpszCaption); + void SetTitle(LPCWSTR lpszTitle); + + +protected: + HWND GetHandle(void) { return hwnd; } + INT_PTR CallWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam); + void SetDialogResult(LRESULT result); + LRESULT SendMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { return ::SendMessageW(hwnd, uMsg, wParam, lParam); } + void SetWindowText(LPCWSTR lpText) { ::SetWindowTextW(hwnd, lpText); } + + void EnableOK(BOOL enable) { SendMessage(BFFM_ENABLEOK, 0, (LPARAM)enable); } + void SetOKText(LPCWSTR lpText) { SendMessage(BFFM_SETOKTEXT, 0, (LPARAM)lpText); } + void SetStatusText(LPCWSTR lpText) { SendMessage(BFFM_SETSTATUSTEXTW, 0, (LPARAM)lpText); } + + virtual void OnInitialized(void); + virtual void OnIUnknown(IUnknown *lpiu) {} + virtual void OnSelectionChanged(LPCITEMIDLIST pidl); + virtual BOOL OnValidateFailed(LPCWSTR lpName) { return FALSE; } + virtual void OnSelectionDone(LPCITEMIDLIST pidl) { } + + virtual INT BrowseCallback(UINT uMsg, LPARAM lParam); + virtual INT_PTR DialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam); + +protected: + LPCITEMIDLIST pidlRoot; + + BFPATH pathSelection; + BFPATH pathExpanded; + + LPWSTR lpszCaption; + LPWSTR lpszTitle; + UINT ulFlags; + INT image; + WCHAR pszDisplayName[MAX_PATH]; + BOOL expand; + LPITEMIDLIST pidl; + + +private: + HWND hwnd; + LONG_PTR oldProc; + + + + friend static int WINAPI BrowseCallback_Helper(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData); + friend static LRESULT WINAPI WindowProc_Helper(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + friend static void Initialize(FolderBrowseEx *lpfbx, LPCITEMIDLIST pidlRoot, UINT ulFlags, LPCWSTR lpszCaption, LPCWSTR lpszTitle); + +}; + +#endif //NULLSOFT_FOLDERBROWSE_EXTENDED_DIALOG_HEADER
\ No newline at end of file |