summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/input_window.h
blob: 879ac921e0f2e8ab9cf99c0573231ed13c61f7ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_VIEWS_INPUT_WINDOW_H__
#define CHROME_BROWSER_VIEWS_INPUT_WINDOW_H__

#include "chrome/views/dialog_delegate.h"

// InputWindowDelegate --------------------------------------------------------

class InputWindowDelegate : public views::DialogDelegate {
 public:
  // Returns the text displayed on the label preceding the text field.
  virtual std::wstring GetTextFieldLabel() = 0;

  // Returns the initial contents of the text field.
  virtual std::wstring GetTextFieldContents() {
    return std::wstring();
  }

  // Returns whether the text is valid. InputAccepted is only invoked if the
  // text is valid.
  virtual bool IsValid(const std::wstring& text) {
    return true;
  }

  // Invoked when the user presses the ok button and the text is fvalid.
  virtual void InputAccepted(const std::wstring& text) = 0;

  // Invoked when the user cancels the dialog.
  virtual void InputCanceled() {}
};


namespace views {
class Window;
};

views::Window* CreateInputWindow(HWND parent_hwnd,
                                 InputWindowDelegate* delegate);

#endif  // CHROME_BROWSER_VIEWS_INPUT_WINDOW_H__