SimpleWindow
载入中...
搜索中...
未找到
FolderDialog.h
1#pragma once
2
3#include "EnumBit.h"
4#include "IDialog.h"
5#include "Property.h"
6#include <shlobj.h>
7#include <string>
8#include <vector>
9
10namespace sw
11{
15 enum class FolderDialogFlags : UINT {
21 ReturnOnlyFileSystemDirs = 0x00000001,
22
24 DontGoBelowDomain = 0x00000002,
25
29 StatusText = 0x00000004,
30
34 ReturnFileSystemAncestors = 0x00000008,
35
38 EditBox = 0x00000010,
39
43 Validate = 0x00000020,
44
51 NewDialogStyle = 0x00000040,
52
59 BrowseIncludeUrls = 0x00000080,
60
65 UseNewUI = 0x00000010 | 0x00000040,
66
69 UsageHint = 0x00000100,
70
72 NoNewFolderButton = 0x00000200,
73
76 NoTranslateTargets = 0x00000400,
77
79 BrowseForComputer = 0x00001000,
80
85 BrowseForPrinter = 0x00002000,
86
88 BrowseIncludeFiles = 0x00004000,
89
93 Sharable = 0x00008000,
94
97 BrowseFileJunctions = 0x00010000,
98 };
99
103 _SW_ENUM_ENABLE_BIT_OPERATIONS(FolderDialogFlags);
104
109 {
110 private:
114 BROWSEINFOW _bi{};
115
119 std::vector<wchar_t> _buffer;
120
124 std::wstring _description;
125
126 public:
131
136
141
146
151
152 public:
157
161 virtual void Close() override;
162
166 virtual void Show() override;
167
172 virtual int ShowDialog(Window *owner = nullptr) override;
173
178 virtual int ShowDialog(Window &owner);
179
180 protected:
185
189 wchar_t *GetBuffer();
190
195 };
196}
选择文件夹对话框
Definition FolderDialog.h:109
virtual int ShowDialog(Window *owner=nullptr) override
显示对话框,并指定所有者窗口
const Property< bool > NewFolderButton
是否显示“新建文件夹”按钮
Definition FolderDialog.h:150
const ReadOnlyProperty< std::wstring > SelectedPath
选中文件夹的路径
Definition FolderDialog.h:145
virtual int ShowDialog(Window &owner)
显示对话框,并指定所有者窗口
const Property< FolderDialogFlags > Flags
对话框标志
Definition FolderDialog.h:135
const Property< std::wstring > Description
对话框上方显示的描述性文本
Definition FolderDialog.h:140
virtual void Close() override
FolderBrowserDialog默认不支持该函数,调用该函数不会执行任何操作
BROWSEINFOW * GetBI()
获取BROWSEINFOW指针
wchar_t * GetBuffer()
获取指向缓冲区的指针
virtual void Show() override
FolderBrowserDialog默认不支持该函数,调用该函数不会执行任何操作
void ClearBuffer()
清空缓冲区
FolderBrowserDialog()
初始化FolderBrowserDialog
const Property< int > BufferSize
储存文件名的缓冲区大小,值不能小于MAX_PATH
Definition FolderDialog.h:130
对话框接口
Definition IDialog.h:11
值转换器接口
Definition IValueConverter.h:14
窗口
Definition Window.h:32
SimpleWindow框架的顶级命名空间,所有公共类型、控件、枚举和工具函数均定义于此。
Definition Alignment.h:4
FolderDialogFlags
https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/ns-shlobj_core-browseinfoa
Definition FolderDialog.h:15
@ BrowseForComputer
Only return computers. If the user selects anything other than a computer, the OK button is grayed.
@ BrowseIncludeFiles
Version 4.71. The browse dialog box displays files as well as folders.
@ DontGoBelowDomain
Do not include network folders below the domain level in the dialog box's tree view control.
@ NoNewFolderButton
Version 6.0. Do not include the New Folder button in the browse dialog box.