OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SHELL_DIALOGS_H_ | 5 #ifndef CHROME_BROWSER_SHELL_DIALOGS_H_ |
6 #define CHROME_BROWSER_SHELL_DIALOGS_H_ | 6 #define CHROME_BROWSER_SHELL_DIALOGS_H_ |
7 | 7 |
8 // TODO(maruel): Remove once HWND is typedef. | 8 // TODO(maruel): Remove once HWND is typedef. |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // |title| is the title to be displayed in the dialog. If this string is | 70 // |title| is the title to be displayed in the dialog. If this string is |
71 // empty, the default title is used. | 71 // empty, the default title is used. |
72 // |default_path| is the default path and suggested file name to be shown in | 72 // |default_path| is the default path and suggested file name to be shown in |
73 // the dialog. This only works for SELECT_SAVEAS_FILE and SELECT_OPEN_FILE. | 73 // the dialog. This only works for SELECT_SAVEAS_FILE and SELECT_OPEN_FILE. |
74 // Can be an empty string to indicate Windows should choose the default to | 74 // Can be an empty string to indicate Windows should choose the default to |
75 // show. | 75 // show. |
76 // |filter| is a null (\0) separated list of alternating filter description | 76 // |filter| is a null (\0) separated list of alternating filter description |
77 // and filters and terminated with two nulls. | 77 // and filters and terminated with two nulls. |
78 // |owning_hwnd| is the window the dialog is modal to, or NULL for a modeless | 78 // |owning_hwnd| is the window the dialog is modal to, or NULL for a modeless |
79 // dialog. | 79 // dialog. |
| 80 // |default_extension| is the default extension to add to the file if the |
| 81 // user doesn't type one. This should NOT include the '.'. If you specify |
| 82 // this you must also specify a filter. |
80 // |params| is data from the calling context which will be passed through to | 83 // |params| is data from the calling context which will be passed through to |
81 // the listener. Can be NULL. | 84 // the listener. Can be NULL. |
82 // NOTE: only one instance of any shell dialog can be shown per owning_hwnd | 85 // NOTE: only one instance of any shell dialog can be shown per owning_hwnd |
83 // at a time (for obvious reasons). | 86 // at a time (for obvious reasons). |
84 // TODO: convert all callers to this and rip out the old. | |
85 virtual void SelectFile(Type type, | 87 virtual void SelectFile(Type type, |
86 const std::wstring& title, | 88 const std::wstring& title, |
87 const std::wstring& default_path, | 89 const std::wstring& default_path, |
88 const std::wstring& filter, | 90 const std::wstring& filter, |
| 91 const std::wstring& default_extension, |
89 HWND owning_hwnd, | 92 HWND owning_hwnd, |
90 void* params) = 0; | 93 void* params) = 0; |
91 | |
92 void SelectFile(Type type, | |
93 const std::wstring& title, | |
94 const std::wstring& default_path, | |
95 HWND owning_hwnd, | |
96 void* params) { | |
97 SelectFile(type, title, default_path, std::wstring(), | |
98 owning_hwnd, params); | |
99 } | |
100 }; | 94 }; |
101 | 95 |
102 // Shows a dialog box for selecting a font. | 96 // Shows a dialog box for selecting a font. |
103 class SelectFontDialog | 97 class SelectFontDialog |
104 : public base::RefCountedThreadSafe<SelectFileDialog>, | 98 : public base::RefCountedThreadSafe<SelectFileDialog>, |
105 public BaseShellDialog { | 99 public BaseShellDialog { |
106 public: | 100 public: |
107 virtual ~SelectFontDialog() {} | 101 virtual ~SelectFontDialog() {} |
108 | 102 |
109 // An interface implemented by a Listener object wishing to know about the | 103 // An interface implemented by a Listener object wishing to know about the |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 137 |
144 // Same as above - also support specifying the default font selected in the | 138 // Same as above - also support specifying the default font selected in the |
145 // list when the dialog appears. | 139 // list when the dialog appears. |
146 virtual void SelectFont(HWND owning_hwnd, | 140 virtual void SelectFont(HWND owning_hwnd, |
147 void* params, | 141 void* params, |
148 const std::wstring& font_name, | 142 const std::wstring& font_name, |
149 int font_size) = 0; | 143 int font_size) = 0; |
150 }; | 144 }; |
151 | 145 |
152 #endif // #ifndef CHROME_BROWSER_SHELL_DIALOGS_H_ | 146 #endif // #ifndef CHROME_BROWSER_SHELL_DIALOGS_H_ |
OLD | NEW |