diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-27 19:47:23 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-27 19:47:23 +0000 |
commit | ba96e33fd8a5b9610de51f6d3e15e6c469674dc2 (patch) | |
tree | da17919af6b99801762e4d7618e92e53dc13a9f3 | |
parent | 44c1d4872df77d6ac3bd064a7634078c443a332f (diff) | |
download | chromium_src-ba96e33fd8a5b9610de51f6d3e15e6c469674dc2.zip chromium_src-ba96e33fd8a5b9610de51f6d3e15e6c469674dc2.tar.gz chromium_src-ba96e33fd8a5b9610de51f6d3e15e6c469674dc2.tar.bz2 |
Move text_field.cc and rename the class to Textfield in preparation for porting.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/115825
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17014 0039d316-1c4b-4281-b951-d872f2087c98
45 files changed, 341 insertions, 342 deletions
diff --git a/chrome/browser/debugger/debugger_view.cc b/chrome/browser/debugger/debugger_view.cc index 81ce36e..8775aa5 100644 --- a/chrome/browser/debugger/debugger_view.cc +++ b/chrome/browser/debugger/debugger_view.cc @@ -25,7 +25,6 @@ #include "views/grid_layout.h" #include "views/controls/scrollbar/native_scroll_bar.h" #include "views/controls/scroll_view.h" -#include "views/controls/text_field.h" #include "views/standard_layout.h" #include "views/view.h" diff --git a/chrome/browser/debugger/debugger_view.h b/chrome/browser/debugger/debugger_view.h index a83ce58..6790497 100644 --- a/chrome/browser/debugger/debugger_view.h +++ b/chrome/browser/debugger/debugger_view.h @@ -10,10 +10,10 @@ #ifndef CHROME_BROWSER_DEBUGGER_DEBUGGER_VIEW_H__ #define CHROME_BROWSER_DEBUGGER_DEBUGGER_VIEW_H__ +#include "app/gfx/font.h" #include "base/gfx/size.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" #include "views/view.h" -#include "views/controls/text_field.h" class DebuggerView; class DebuggerWindow; diff --git a/chrome/browser/input_window_dialog_win.cc b/chrome/browser/input_window_dialog_win.cc index 3f7b641..1f942c0 100644 --- a/chrome/browser/input_window_dialog_win.cc +++ b/chrome/browser/input_window_dialog_win.cc @@ -10,14 +10,14 @@ #include "base/task.h" #include "views/grid_layout.h" #include "views/controls/label.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/standard_layout.h" #include "views/window/dialog_delegate.h" #include "views/window/window.h" #include "grit/generated_resources.h" // Width to make the text field, in pixels. -static const int kTextFieldWidth = 200; +static const int kTextfieldWidth = 200; class ContentView; @@ -57,7 +57,7 @@ class WinInputWindowDialog : public InputWindowDialog { // It registers accelerators that accept/cancel the input. class ContentView : public views::View, public views::DialogDelegate, - public views::TextField::Controller { + public views::Textfield::Controller { public: explicit ContentView(WinInputWindowDialog* delegate) : delegate_(delegate), @@ -75,11 +75,11 @@ class ContentView : public views::View, virtual bool IsModal() const { return true; } virtual views::View* GetContentsView(); - // views::TextField::Controller overrides: - virtual void ContentsChanged(views::TextField* sender, + // views::Textfield::Controller overrides: + virtual void ContentsChanged(views::Textfield* sender, const std::wstring& new_contents); - virtual bool HandleKeystroke(views::TextField*, - const views::TextField::Keystroke&) { + virtual bool HandleKeystroke(views::Textfield*, + const views::Textfield::Keystroke&) { return false; } @@ -95,14 +95,14 @@ class ContentView : public views::View, // Sets focus to the first focusable element within the dialog. void FocusFirstFocusableControl(); - // The TextField that the user can type into. - views::TextField* text_field_; + // The Textfield that the user can type into. + views::Textfield* text_field_; // The delegate that the ContentView uses to communicate changes to the // caller. WinInputWindowDialog* delegate_; - // Helps us set focus to the first TextField in the window. + // Helps us set focus to the first Textfield in the window. ScopedRunnableMethodFactory<ContentView> focus_grabber_factory_; DISALLOW_COPY_AND_ASSIGN(ContentView); @@ -143,9 +143,9 @@ views::View* ContentView::GetContentsView() { } /////////////////////////////////////////////////////////////////////////////// -// ContentView, views::TextField::Controller implementation: +// ContentView, views::Textfield::Controller implementation: -void ContentView::ContentsChanged(views::TextField* sender, +void ContentView::ContentsChanged(views::Textfield* sender, const std::wstring& new_contents) { GetDialogClientView()->UpdateDialogButtons(); } @@ -164,7 +164,7 @@ void ContentView::ViewHierarchyChanged(bool is_add, // ContentView, private: void ContentView::InitControlLayout() { - text_field_ = new views::TextField; + text_field_ = new views::Textfield; text_field_->SetText(delegate_->contents()); text_field_->SetController(this); @@ -180,7 +180,7 @@ void ContentView::InitControlLayout() { GridLayout::USE_PREF, 0, 0); c1->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); c1->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, - GridLayout::USE_PREF, kTextFieldWidth, kTextFieldWidth); + GridLayout::USE_PREF, kTextfieldWidth, kTextfieldWidth); layout->StartRow(0, 0); views::Label* label = new views::Label(delegate_->label()); diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc index a9cca4f..923e9bb 100644 --- a/chrome/browser/views/about_chrome_view.cc +++ b/chrome/browser/views/about_chrome_view.cc @@ -23,7 +23,7 @@ #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "grit/theme_resources.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/controls/throbber.h" #include "views/standard_layout.h" #include "views/widget/widget.h" @@ -172,7 +172,7 @@ void AboutChromeView::Init() { AddChildView(about_title_label_); // This is a text field so people can copy the version number from the dialog. - version_label_ = new views::TextField(); + version_label_ = new views::Textfield(); version_label_->SetText(current_version_); version_label_->SetReadOnly(true); version_label_->RemoveBorder(); diff --git a/chrome/browser/views/about_chrome_view.h b/chrome/browser/views/about_chrome_view.h index 64438bb..8935cf9 100644 --- a/chrome/browser/views/about_chrome_view.h +++ b/chrome/browser/views/about_chrome_view.h @@ -13,7 +13,7 @@ #include "views/window/dialog_delegate.h" namespace views { -class TextField; +class Textfield; class Throbber; class Window; } @@ -126,7 +126,7 @@ class AboutChromeView : public views::View, // UI elements on the dialog. views::ImageView* about_dlg_background_logo_; views::Label* about_title_label_; - views::TextField* version_label_; + views::Textfield* version_label_; views::Label* copyright_label_; views::Label* main_text_label_; int main_text_label_height_; diff --git a/chrome/browser/views/about_network_dialog.cc b/chrome/browser/views/about_network_dialog.cc index 74235ba..51e5670 100644 --- a/chrome/browser/views/about_network_dialog.cc +++ b/chrome/browser/views/about_network_dialog.cc @@ -12,7 +12,7 @@ #include "net/url_request/url_request_job_tracker.h" #include "views/grid_layout.h" #include "views/controls/button/text_button.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/standard_layout.h" #include "views/window/window.h" @@ -300,8 +300,8 @@ void AboutNetworkDialog::SetupControls() { show_button_ = new views::TextButton(this, kShowCurrentLabel); clear_button_ = new views::TextButton(this, kClearLabel); - text_field_ = new views::TextField(static_cast<views::TextField::StyleFlags>( - views::TextField::STYLE_MULTILINE)); + text_field_ = new views::Textfield(static_cast<views::Textfield::StyleFlags>( + views::Textfield::STYLE_MULTILINE)); text_field_->SetReadOnly(true); // TODO(brettw): We may want to add this in the future. It can't be called diff --git a/chrome/browser/views/about_network_dialog.h b/chrome/browser/views/about_network_dialog.h index d49da4e..54dd254 100644 --- a/chrome/browser/views/about_network_dialog.h +++ b/chrome/browser/views/about_network_dialog.h @@ -11,7 +11,7 @@ namespace views { class TextButton; -class TextField; +class Textfield; } // namespace views class AboutNetworkDialog : public views::DialogDelegate, @@ -53,7 +53,7 @@ class AboutNetworkDialog : public views::DialogDelegate, views::TextButton* track_toggle_; views::TextButton* show_button_; views::TextButton* clear_button_; - views::TextField* text_field_; + views::Textfield* text_field_; // Set to true when we're tracking network status. bool tracking_; diff --git a/chrome/browser/views/bookmark_bubble_view.cc b/chrome/browser/views/bookmark_bubble_view.cc index d6f0a99..e1e75ac 100644 --- a/chrome/browser/views/bookmark_bubble_view.cc +++ b/chrome/browser/views/bookmark_bubble_view.cc @@ -19,7 +19,7 @@ #include "grit/theme_resources.h" #include "views/standard_layout.h" #include "views/controls/button/native_button.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" using views::ComboBox; using views::ColumnSet; @@ -285,7 +285,7 @@ void BookmarkBubbleView::Init() { layout->StartRow(0, 2); layout->AddView( new Label(l10n_util::GetString(IDS_BOOMARK_BUBBLE_TITLE_TEXT))); - title_tf_ = new views::TextField(); + title_tf_ = new views::Textfield(); title_tf_->SetText(GetTitle()); layout->AddView(title_tf_); diff --git a/chrome/browser/views/bookmark_bubble_view.h b/chrome/browser/views/bookmark_bubble_view.h index a6e032a2..187a193e 100644 --- a/chrome/browser/views/bookmark_bubble_view.h +++ b/chrome/browser/views/bookmark_bubble_view.h @@ -20,7 +20,7 @@ class BookmarkNode; namespace views { class NativeButton; -class TextField; +class Textfield; } // BookmarkBubbleView is a view intended to be used as the content of an @@ -155,8 +155,8 @@ class BookmarkBubbleView : public views::View, // Button to close the window. views::NativeButton* close_button_; - // TextField showing the title of the bookmark. - views::TextField* title_tf_; + // Textfield showing the title of the bookmark. + views::Textfield* title_tf_; // ComboBox showing a handful of folders the user can choose from, including // the current parent. diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/views/bookmark_editor_view.cc index b79ef28..f479997 100644 --- a/chrome/browser/views/bookmark_editor_view.cc +++ b/chrome/browser/views/bookmark_editor_view.cc @@ -33,7 +33,7 @@ using views::ColumnSet; using views::GridLayout; using views::Label; using views::NativeButton; -using views::TextField; +using views::Textfield; // Background color of text field when URL is invalid. static const SkColor kErrorColor = SkColorSetRGB(0xFF, 0xBC, 0xBC); @@ -170,7 +170,7 @@ bool BookmarkEditorView::CanEdit(views::TreeView* tree_view, return (bb_node->GetParent() && bb_node->GetParent()->GetParent()); } -void BookmarkEditorView::ContentsChanged(TextField* sender, +void BookmarkEditorView::ContentsChanged(Textfield* sender, const std::wstring& new_contents) { UserInputChanged(); } @@ -207,9 +207,9 @@ void BookmarkEditorView::Show(HWND parent_hwnd) { if (show_tree_ && bb_model_->IsLoaded()) ExpandAndSelect(); window()->Show(); - // Select all the text in the name textfield. + // Select all the text in the name Textfield. title_tf_.SelectAll(); - // Give focus to the name textfield. + // Give focus to the name Textfield. title_tf_.RequestFocus(); } diff --git a/chrome/browser/views/bookmark_editor_view.h b/chrome/browser/views/bookmark_editor_view.h index 055b1a8..1758325 100644 --- a/chrome/browser/views/bookmark_editor_view.h +++ b/chrome/browser/views/bookmark_editor_view.h @@ -12,7 +12,7 @@ #include "chrome/browser/bookmarks/bookmark_model.h" #include "views/controls/button/button.h" #include "views/controls/menu/menu.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/controls/tree/tree_view.h" #include "views/window/dialog_delegate.h" @@ -38,7 +38,7 @@ class BookmarkEditorView : public BookmarkEditor, public views::ButtonListener, public views::TreeViewController, public views::DialogDelegate, - public views::TextField::Controller, + public views::Textfield::Controller, public views::ContextMenuController, public views::Menu::Delegate, public BookmarkModelObserver { @@ -80,11 +80,11 @@ class BookmarkEditorView : public BookmarkEditor, virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view); virtual bool CanEdit(views::TreeView* tree_view, TreeModelNode* node); - // TextField::Controller methods. - virtual void ContentsChanged(views::TextField* sender, + // Textfield::Controller methods. + virtual void ContentsChanged(views::Textfield* sender, const std::wstring& new_contents); - virtual bool HandleKeystroke(views::TextField* sender, - const views::TextField::Keystroke&) { + virtual bool HandleKeystroke(views::Textfield* sender, + const views::Textfield::Keystroke&) { return false; } @@ -206,7 +206,7 @@ class BookmarkEditorView : public BookmarkEditor, std::wstring GetInputTitle() const; // Invoked when the url or title has possibly changed. Updates the background - // of textfields and ok button appropriately. + // of Textfields and ok button appropriately. void UserInputChanged(); // Creates a new group as a child of the selected node. If no node is @@ -232,10 +232,10 @@ class BookmarkEditorView : public BookmarkEditor, scoped_ptr<views::NativeButton> new_group_button_; // Used for editing the URL. - views::TextField url_tf_; + views::Textfield url_tf_; // Used for editing the title. - views::TextField title_tf_; + views::Textfield title_tf_; // Initial parent to select. Is only used if node_ is NULL. BookmarkNode* parent_; diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc index 761f34c..e772c5a 100644 --- a/chrome/browser/views/bookmark_manager_view.cc +++ b/chrome/browser/views/bookmark_manager_view.cc @@ -147,7 +147,7 @@ BookmarkManagerView::BookmarkManagerView(Profile* profile) table_view_(NULL), tree_view_(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(search_factory_(this)) { - search_tf_ = new views::TextField(); + search_tf_ = new views::Textfield(); search_tf_->set_default_width_in_chars(30); table_view_ = new BookmarkTableView(profile_, NULL); @@ -480,7 +480,7 @@ void BookmarkManagerView::Loaded(BookmarkModel* model) { LoadedImpl(); } -void BookmarkManagerView::ContentsChanged(views::TextField* sender, +void BookmarkManagerView::ContentsChanged(views::Textfield* sender, const std::wstring& new_contents) { search_factory_.RevokeAll(); MessageLoop::current()->PostDelayedTask(FROM_HERE, @@ -489,9 +489,9 @@ void BookmarkManagerView::ContentsChanged(views::TextField* sender, } bool BookmarkManagerView::HandleKeystroke( - views::TextField* sender, - const views::TextField::Keystroke& key) { - if (views::TextField::IsKeystrokeEnter(key)) { + views::Textfield* sender, + const views::Textfield::Keystroke& key) { + if (views::Textfield::IsKeystrokeEnter(key)) { PerformSearch(); search_tf_->SelectAll(); } diff --git a/chrome/browser/views/bookmark_manager_view.h b/chrome/browser/views/bookmark_manager_view.h index 814f3a6..a6ee77c96 100644 --- a/chrome/browser/views/bookmark_manager_view.h +++ b/chrome/browser/views/bookmark_manager_view.h @@ -12,7 +12,7 @@ #include "chrome/browser/shell_dialogs.h" #include "views/controls/menu/view_menu_delegate.h" #include "views/controls/table/table_view.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/controls/tree/tree_view.h" #include "views/view.h" #include "views/window/window_delegate.h" @@ -38,7 +38,7 @@ class BookmarkManagerView : public views::View, public views::WindowDelegate, public views::TreeViewController, public views::TableViewObserver, - public views::TextField::Controller, + public views::Textfield::Controller, public BookmarkModelObserver, public views::ContextMenuController, public views::ViewMenuDelegate, @@ -136,13 +136,13 @@ class BookmarkManagerView : public views::View, virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, BookmarkNode* node) {} - // TextField::Controller methods. + // Textfield::Controller methods. // Starts a timer to search for the search text. - virtual void ContentsChanged(views::TextField* sender, + virtual void ContentsChanged(views::Textfield* sender, const std::wstring& new_contents); // If return has been pressed this performs an immediate search. - virtual bool HandleKeystroke(views::TextField* sender, - const views::TextField::Keystroke& key); + virtual bool HandleKeystroke(views::Textfield* sender, + const views::Textfield::Keystroke& key); // ContextMenuController. virtual void ShowContextMenu(views::View* source, @@ -210,7 +210,7 @@ class BookmarkManagerView : public views::View, BookmarkFolderTreeView* tree_view_; scoped_ptr<BookmarkTableModel> table_model_; scoped_ptr<BookmarkFolderTreeModel> tree_model_; - views::TextField* search_tf_; + views::Textfield* search_tf_; views::SingleSplitView* split_view_; // Import/export file dialog. diff --git a/chrome/browser/views/bug_report_view.cc b/chrome/browser/views/bug_report_view.cc index a349b31..b6eb9d3 100644 --- a/chrome/browser/views/bug_report_view.cc +++ b/chrome/browser/views/bug_report_view.cc @@ -200,13 +200,13 @@ void BugReportView::SetupControl() { page_url_label_ = new views::Label( l10n_util::GetString(IDS_BUGREPORT_REPORT_URL_LABEL)); // page_url_text_'s text (if any) is filled in after dialog creation - page_url_text_ = new views::TextField; + page_url_text_ = new views::Textfield; page_url_text_->SetController(this); description_label_ = new views::Label( l10n_util::GetString(IDS_BUGREPORT_DESCRIPTION_LABEL)); description_text_ = - new views::TextField(views::TextField::STYLE_MULTILINE); + new views::Textfield(views::Textfield::STYLE_MULTILINE); description_text_->SetHeightInLines(kDescriptionLines); include_page_source_checkbox_ = new views::Checkbox( @@ -298,12 +298,12 @@ void BugReportView::ItemChanged(views::ComboBox* combo_box, GetDialogClientView()->UpdateDialogButtons(); } -void BugReportView::ContentsChanged(views::TextField* sender, +void BugReportView::ContentsChanged(views::Textfield* sender, const std::wstring& new_contents) { } -bool BugReportView::HandleKeystroke(views::TextField* sender, - const views::TextField::Keystroke& key) { +bool BugReportView::HandleKeystroke(views::Textfield* sender, + const views::Textfield::Keystroke& key) { return false; } diff --git a/chrome/browser/views/bug_report_view.h b/chrome/browser/views/bug_report_view.h index 9fec67f..59df265 100644 --- a/chrome/browser/views/bug_report_view.h +++ b/chrome/browser/views/bug_report_view.h @@ -8,7 +8,7 @@ #include "chrome/browser/net/url_fetcher.h" #include "googleurl/src/gurl.h" #include "views/controls/combo_box.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/view.h" #include "views/window/dialog_delegate.h" @@ -35,7 +35,7 @@ class BugReportComboBoxModel; class BugReportView : public views::View, public views::DialogDelegate, public views::ComboBox::Listener, - public views::TextField::Controller { + public views::Textfield::Controller { public: explicit BugReportView(Profile* profile, TabContents* tab); virtual ~BugReportView(); @@ -48,11 +48,11 @@ class BugReportView : public views::View, // Overridden from views::View: virtual gfx::Size GetPreferredSize(); - // views::TextField::Controller implementation: - virtual void ContentsChanged(views::TextField* sender, + // views::Textfield::Controller implementation: + virtual void ContentsChanged(views::Textfield* sender, const std::wstring& new_contents); - virtual bool HandleKeystroke(views::TextField* sender, - const views::TextField::Keystroke& key); + virtual bool HandleKeystroke(views::Textfield* sender, + const views::Textfield::Keystroke& key); // views::ComboBox::Listener implementation: virtual void ItemChanged(views::ComboBox* combo_box, int prev_index, @@ -92,9 +92,9 @@ class BugReportView : public views::View, views::Label* page_title_label_; views::Label* page_title_text_; views::Label* page_url_label_; - views::TextField* page_url_text_; + views::Textfield* page_url_text_; views::Label* description_label_; - views::TextField* description_text_; + views::Textfield* description_text_; views::Checkbox* include_page_source_checkbox_; views::Checkbox* include_page_image_checkbox_; diff --git a/chrome/browser/views/edit_keyword_controller.cc b/chrome/browser/views/edit_keyword_controller.cc index c2142c5..56ec93e 100644 --- a/chrome/browser/views/edit_keyword_controller.cc +++ b/chrome/browser/views/edit_keyword_controller.cc @@ -26,7 +26,7 @@ using views::GridLayout; using views::ImageView; -using views::TextField; +using views::Textfield; namespace { @@ -153,15 +153,15 @@ views::View* EditKeywordController::GetContentsView() { return view_; } -void EditKeywordController::ContentsChanged(TextField* sender, +void EditKeywordController::ContentsChanged(Textfield* sender, const std::wstring& new_contents) { GetDialogClientView()->UpdateDialogButtons(); UpdateImageViews(); } bool EditKeywordController::HandleKeystroke( - TextField* sender, - const views::TextField::Keystroke& key) { + Textfield* sender, + const views::Textfield::Keystroke& key) { return false; } @@ -169,16 +169,16 @@ void EditKeywordController::Init() { // Create the views we'll need. view_ = new views::View(); if (template_url_) { - title_tf_ = CreateTextField(template_url_->short_name(), false); - keyword_tf_ = CreateTextField(template_url_->keyword(), true); - url_tf_ = CreateTextField(GetDisplayURL(*template_url_), false); + title_tf_ = CreateTextfield(template_url_->short_name(), false); + keyword_tf_ = CreateTextfield(template_url_->keyword(), true); + url_tf_ = CreateTextfield(GetDisplayURL(*template_url_), false); // We don't allow users to edit prepopulate URLs. This is done as // occasionally we need to update the URL of prepopulated TemplateURLs. url_tf_->SetReadOnly(template_url_->prepopulate_id() != 0); } else { - title_tf_ = CreateTextField(std::wstring(), false); - keyword_tf_ = CreateTextField(std::wstring(), true); - url_tf_ = CreateTextField(std::wstring(), false); + title_tf_ = CreateTextfield(std::wstring(), false); + keyword_tf_ = CreateTextfield(std::wstring(), true); + url_tf_ = CreateTextfield(std::wstring(), false); } title_iv_ = new ImageView(); keyword_iv_ = new ImageView(); @@ -206,7 +206,7 @@ void EditKeywordController::Init() { GridLayout::USE_PREF, 0, 0); column_set->LinkColumnSizes(1, 3, -1); - // For the textfields. + // For the Textfields. column_set = layout->AddColumnSet(1); column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); @@ -273,10 +273,10 @@ views::Label* EditKeywordController::CreateLabel(int message_id) { return label; } -TextField* EditKeywordController::CreateTextField(const std::wstring& text, +Textfield* EditKeywordController::CreateTextfield(const std::wstring& text, bool lowercase) { - TextField* text_field = new TextField( - lowercase ? TextField::STYLE_LOWERCASE : TextField::STYLE_DEFAULT); + Textfield* text_field = new Textfield( + lowercase ? Textfield::STYLE_LOWERCASE : Textfield::STYLE_DEFAULT); text_field->SetText(text); text_field->SetController(this); return text_field; diff --git a/chrome/browser/views/edit_keyword_controller.h b/chrome/browser/views/edit_keyword_controller.h index baf7efd..432ed14 100644 --- a/chrome/browser/views/edit_keyword_controller.h +++ b/chrome/browser/views/edit_keyword_controller.h @@ -12,7 +12,7 @@ #include <windows.h> -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/window/dialog_delegate.h" namespace views { @@ -26,7 +26,7 @@ class Profile; class TemplateURL; class TemplateURLModel; -class EditKeywordController : public views::TextField::Controller, +class EditKeywordController : public views::Textfield::Controller, public views::DialogDelegate { public: // The template_url and/or keyword_editor_view may be NULL. @@ -51,13 +51,13 @@ class EditKeywordController : public views::TextField::Controller, virtual bool Accept(); virtual views::View* GetContentsView(); - // views::TextField::Controller overrides. Updates whether the user can + // views::Textfield::Controller overrides. Updates whether the user can // accept the dialog as well as updating image views showing whether value is // valid. - virtual void ContentsChanged(views::TextField* sender, + virtual void ContentsChanged(views::Textfield* sender, const std::wstring& new_contents); - virtual bool HandleKeystroke(views::TextField* sender, - const views::TextField::Keystroke& key); + virtual bool HandleKeystroke(views::Textfield* sender, + const views::Textfield::Keystroke& key); private: void Init(); @@ -66,8 +66,8 @@ class EditKeywordController : public views::TextField::Controller, views::Label* CreateLabel(int message_id); // Creates a text field with the specified text. If |lowercase| is true, the - // textfield is configured to map all input to lower case. - views::TextField* CreateTextField(const std::wstring& text, bool lowercase); + // Textfield is configured to map all input to lower case. + views::Textfield* CreateTextfield(const std::wstring& text, bool lowercase); // Returns true if the currently input URL is valid. The URL is valid if it // contains no search terms and is a valid url, or if it contains a search @@ -117,9 +117,9 @@ class EditKeywordController : public views::TextField::Controller, Profile* profile_; // Text fields. - views::TextField* title_tf_; - views::TextField* keyword_tf_; - views::TextField* url_tf_; + views::Textfield* title_tf_; + views::Textfield* keyword_tf_; + views::Textfield* url_tf_; // Shows error images. views::ImageView* title_iv_; diff --git a/chrome/browser/views/find_bar_view.cc b/chrome/browser/views/find_bar_view.cc index 8685246..42e0531 100644 --- a/chrome/browser/views/find_bar_view.cc +++ b/chrome/browser/views/find_bar_view.cc @@ -28,7 +28,7 @@ static const int kWhiteSpaceAfterMatchCountLabel = 3; // The margins around the search field and the close button. static const int kMarginLeftOfCloseButton = 3; static const int kMarginRightOfCloseButton = 7; -static const int kMarginLeftOfFindTextField = 12; +static const int kMarginLeftOfFindTextfield = 12; // The margins around the match count label (We add extra space so that the // background highlight extends beyond just the text). @@ -87,7 +87,7 @@ FindBarView::FindBarView(FindBarWin* container) animation_offset_(0) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - find_text_ = new views::TextField(); + find_text_ = new views::Textfield(); find_text_->SetID(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); find_text_->SetFont(rb.GetFont(ResourceBundle::BaseFont)); find_text_->set_default_width_in_chars(kDefaultCharWidth); @@ -256,7 +256,7 @@ void FindBarView::Paint(gfx::Canvas* canvas) { canvas->DrawBitmapInt(*kDialog_right, lb.right() - kDialog_right->width(), 0); - // Then we draw the background image for the Find TextField. We start by + // Then we draw the background image for the Find Textfield. We start by // calculating the position of background images for the Find text box. gfx::Rect find_text_rect; gfx::Rect back_button_rect; @@ -352,7 +352,7 @@ void FindBarView::Layout() { // And whatever space is left in between, gets filled up by the find edit box. sz = find_text_->GetPreferredSize(); - sz.set_width(match_count_text_->x() - kMarginLeftOfFindTextField); + sz.set_width(match_count_text_->x() - kMarginLeftOfFindTextfield); find_text_->SetBounds(match_count_text_->x() - sz.width(), (height() - sz.height()) / 2 + 1, sz.width(), @@ -383,7 +383,7 @@ gfx::Size FindBarView::GetPreferredSize() { // Add up all the preferred sizes and margins of the rest of the controls. prefsize.Enlarge(kMarginLeftOfCloseButton + kMarginRightOfCloseButton + - kMarginLeftOfFindTextField, + kMarginLeftOfFindTextfield, 0); prefsize.Enlarge(find_previous_button_->GetPreferredSize().width(), 0); prefsize.Enlarge(find_next_button_->GetPreferredSize().width(), 0); @@ -420,9 +420,9 @@ void FindBarView::ButtonPressed(views::Button* sender) { } //////////////////////////////////////////////////////////////////////////////// -// FindBarView, views::TextField::Controller implementation: +// FindBarView, views::Textfield::Controller implementation: -void FindBarView::ContentsChanged(views::TextField* sender, +void FindBarView::ContentsChanged(views::Textfield* sender, const std::wstring& new_contents) { FindBarController* controller = container_->GetFindBarController(); DCHECK(controller); @@ -445,8 +445,8 @@ void FindBarView::ContentsChanged(views::TextField* sender, } } -bool FindBarView::HandleKeystroke(views::TextField* sender, - const views::TextField::Keystroke& key) { +bool FindBarView::HandleKeystroke(views::Textfield* sender, + const views::Textfield::Keystroke& key) { // If the dialog is not visible, there is no reason to process keyboard input. if (!container_->IsVisible()) return false; @@ -457,7 +457,7 @@ bool FindBarView::HandleKeystroke(views::TextField* sender, key.flags)) return true; // Handled, we are done! - if (views::TextField::IsKeystrokeEnter(key)) { + if (views::Textfield::IsKeystrokeEnter(key)) { // Pressing Return/Enter starts the search (unless text box is empty). std::wstring find_string = find_text_->GetText(); if (!find_string.empty()) { diff --git a/chrome/browser/views/find_bar_view.h b/chrome/browser/views/find_bar_view.h index a769887..f83b175 100644 --- a/chrome/browser/views/find_bar_view.h +++ b/chrome/browser/views/find_bar_view.h @@ -9,7 +9,7 @@ #include "base/string16.h" #include "chrome/browser/find_notification_details.h" #include "views/controls/button/button.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" class FindBarWin; @@ -29,7 +29,7 @@ class View; //////////////////////////////////////////////////////////////////////////////// class FindBarView : public views::View, public views::ButtonListener, - public views::TextField::Controller { + public views::Textfield::Controller { public: // A tag denoting which button the user pressed. enum ButtonTag { @@ -65,11 +65,11 @@ class FindBarView : public views::View, // Overridden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender); - // Overridden from views::TextField::Controller: - virtual void ContentsChanged(views::TextField* sender, + // Overridden from views::Textfield::Controller: + virtual void ContentsChanged(views::Textfield* sender, const std::wstring& new_contents); - virtual bool HandleKeystroke(views::TextField* sender, - const views::TextField::Keystroke& key); + virtual bool HandleKeystroke(views::Textfield* sender, + const views::Textfield::Keystroke& key); private: // Resets the background for the match count label. @@ -84,13 +84,13 @@ class FindBarView : public views::View, class FocusForwarderView : public views::View { public: explicit FocusForwarderView( - views::TextField* view_to_focus_on_mousedown) + views::Textfield* view_to_focus_on_mousedown) : view_to_focus_on_mousedown_(view_to_focus_on_mousedown) {} private: virtual bool OnMousePressed(const views::MouseEvent& event); - views::TextField* view_to_focus_on_mousedown_; + views::Textfield* view_to_focus_on_mousedown_; DISALLOW_COPY_AND_ASSIGN(FocusForwarderView); }; @@ -100,7 +100,7 @@ class FindBarView : public views::View, FindBarWin* container_; // The controls in the window. - views::TextField* find_text_; + views::Textfield* find_text_; views::Label* match_count_text_; FocusForwarderView* focus_forwarder_view_; views::ImageButton* find_previous_button_; diff --git a/chrome/browser/views/keyword_editor_view.cc b/chrome/browser/views/keyword_editor_view.cc index d84afa0..d17056d 100644 --- a/chrome/browser/views/keyword_editor_view.cc +++ b/chrome/browser/views/keyword_editor_view.cc @@ -28,7 +28,7 @@ #include "views/background.h" #include "views/grid_layout.h" #include "views/controls/button/native_button.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/standard_layout.h" #include "views/widget/widget.h" #include "views/window/dialog_delegate.h" diff --git a/chrome/browser/views/login_view.cc b/chrome/browser/views/login_view.cc index df7f1b4..d4e40f8 100644 --- a/chrome/browser/views/login_view.cc +++ b/chrome/browser/views/login_view.cc @@ -12,21 +12,21 @@ #include "grit/generated_resources.h" #include "views/grid_layout.h" #include "views/controls/label.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/standard_layout.h" #include "views/widget/root_view.h" namespace views { static const int kMessageWidth = 320; -static const int kTextFieldStackHorizontalSpacing = 30; +static const int kTextfieldStackHorizontalSpacing = 30; /////////////////////////////////////////////////////////////////////////////// // LoginView, public: LoginView::LoginView(const std::wstring& explanation) - : username_field_(new TextField), - password_field_(new TextField(TextField::STYLE_PASSWORD)), + : username_field_(new Textfield), + password_field_(new Textfield(Textfield::STYLE_PASSWORD)), username_label_(new Label( l10n_util::GetString(IDS_LOGIN_DIALOG_USERNAME_FIELD))), password_label_(new Label( @@ -51,13 +51,13 @@ LoginView::LoginView(const std::wstring& explanation) // Add the column set for the user name and password fields and labels. const int labels_column_set_id = 1; column_set = layout->AddColumnSet(labels_column_set_id); - column_set->AddPaddingColumn(0, kTextFieldStackHorizontalSpacing); + column_set->AddPaddingColumn(0, kTextfieldStackHorizontalSpacing); column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, GridLayout::USE_PREF, 0, 0); - column_set->AddPaddingColumn(0, kTextFieldStackHorizontalSpacing); + column_set->AddPaddingColumn(0, kTextfieldStackHorizontalSpacing); layout->StartRow(0, single_column_view_set_id); layout->AddView(message_label_); diff --git a/chrome/browser/views/login_view.h b/chrome/browser/views/login_view.h index fa0a837..b5868b1 100644 --- a/chrome/browser/views/login_view.h +++ b/chrome/browser/views/login_view.h @@ -10,7 +10,7 @@ namespace views { class Label; -class TextField; +class Textfield; class LoginModel; // Simple Model & Observer interfaces for a LoginView to facilitate exchanging @@ -60,8 +60,8 @@ class LoginView : public View, public LoginModelObserver { void FocusFirstField(); // Non-owning refs to the input text fields. - TextField* username_field_; - TextField* password_field_; + Textfield* username_field_; + Textfield* password_field_; // Button labels Label* username_label_; diff --git a/chrome/browser/views/new_profile_dialog.cc b/chrome/browser/views/new_profile_dialog.cc index 8b851f4..c3b12bb 100644 --- a/chrome/browser/views/new_profile_dialog.cc +++ b/chrome/browser/views/new_profile_dialog.cc @@ -15,7 +15,7 @@ #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "views/controls/message_box_view.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/view.h" #include "views/window/window.h" @@ -56,7 +56,7 @@ NewProfileDialog::~NewProfileDialog() { } views::View* NewProfileDialog::GetInitiallyFocusedView() { - views::TextField* text_box = message_box_view_->text_box(); + views::Textfield* text_box = message_box_view_->text_box(); DCHECK(text_box); return text_box; } @@ -85,7 +85,7 @@ void NewProfileDialog::DeleteDelegate() { delete this; } -void NewProfileDialog::ContentsChanged(views::TextField* sender, +void NewProfileDialog::ContentsChanged(views::Textfield* sender, const std::wstring& new_contents) { GetDialogClientView()->UpdateDialogButtons(); } diff --git a/chrome/browser/views/new_profile_dialog.h b/chrome/browser/views/new_profile_dialog.h index a06729d..2ce169e 100644 --- a/chrome/browser/views/new_profile_dialog.h +++ b/chrome/browser/views/new_profile_dialog.h @@ -11,7 +11,7 @@ #include "base/basictypes.h" #include "base/message_loop.h" #include "chrome/browser/shell_dialogs.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/window/dialog_delegate.h" class MessageBoxView; @@ -22,7 +22,7 @@ class Window; // Dialog that prompts the user to create a new profile. class NewProfileDialog : public views::DialogDelegate, - public views::TextField::Controller { + public views::Textfield::Controller { public: // Creates and runs the dialog. static void RunDialog(); @@ -36,11 +36,11 @@ class NewProfileDialog : public views::DialogDelegate, virtual std::wstring GetWindowTitle() const; virtual void DeleteDelegate(); - // views::TextField::Controller methods. - virtual void ContentsChanged(views::TextField* sender, + // views::Textfield::Controller methods. + virtual void ContentsChanged(views::Textfield* sender, const std::wstring& new_contents); - virtual bool HandleKeystroke(views::TextField* sender, - const views::TextField::Keystroke& key) { + virtual bool HandleKeystroke(views::Textfield* sender, + const views::Textfield::Keystroke& key) { return false; } diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index e5667f2..639e0e7 100644 --- a/chrome/browser/views/options/content_page_view.cc +++ b/chrome/browser/views/options/content_page_view.cc @@ -28,7 +28,7 @@ #include "skia/ext/skia_utils_win.h" #include "third_party/skia/include/core/SkBitmap.h" #include "views/controls/button/radio_button.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/grid_layout.h" #include "views/standard_layout.h" #include "views/widget/widget.h" @@ -40,7 +40,7 @@ static const int kPasswordSavingRadioGroup = 2; static const int kFileIconSize = 16; static const int kFileIconVerticalSpacing = 3; static const int kFileIconHorizontalSpacing = 3; -static const int kFileIconTextFieldSpacing = 3; +static const int kFileIconTextfieldSpacing = 3; } // namespace //////////////////////////////////////////////////////////////////////////////// @@ -67,7 +67,7 @@ class FileDisplayArea : public views::View { private: void Init(); - views::TextField* text_field_; + views::Textfield* text_field_; SkColor text_field_background_color_; gfx::Rect icon_bounds_; @@ -84,7 +84,7 @@ class FileDisplayArea : public views::View { SkBitmap FileDisplayArea::default_folder_icon_; FileDisplayArea::FileDisplayArea() - : text_field_(new views::TextField), + : text_field_(new views::Textfield), text_field_background_color_(0), initialized_(false) { InitClass(); @@ -121,11 +121,11 @@ void FileDisplayArea::Layout() { icon_bounds_.SetRect(kFileIconHorizontalSpacing, kFileIconVerticalSpacing, kFileIconSize, kFileIconSize); gfx::Size ps = text_field_->GetPreferredSize(); - text_field_->SetBounds(icon_bounds_.right() + kFileIconTextFieldSpacing, + text_field_->SetBounds(icon_bounds_.right() + kFileIconTextfieldSpacing, (height() - ps.height()) / 2, width() - icon_bounds_.right() - kFileIconHorizontalSpacing - - kFileIconTextFieldSpacing, ps.height()); + kFileIconTextfieldSpacing, ps.height()); } gfx::Size FileDisplayArea::GetPreferredSize() { diff --git a/chrome/browser/views/options/cookies_view.cc b/chrome/browser/views/options/cookies_view.cc index ac5e495..24dcaae 100644 --- a/chrome/browser/views/options/cookies_view.cc +++ b/chrome/browser/views/options/cookies_view.cc @@ -23,8 +23,8 @@ #include "views/grid_layout.h" #include "views/controls/label.h" #include "views/controls/button/native_button.h" -#include "views/controls/text_field.h" #include "views/controls/table/table_view.h" +#include "views/controls/textfield/textfield.h" #include "views/standard_layout.h" // static @@ -339,19 +339,19 @@ class CookieInfoView : public views::View { // Individual property labels views::Label* name_label_; - views::TextField* name_value_field_; + views::Textfield* name_value_field_; views::Label* content_label_; - views::TextField* content_value_field_; + views::Textfield* content_value_field_; views::Label* domain_label_; - views::TextField* domain_value_field_; + views::Textfield* domain_value_field_; views::Label* path_label_; - views::TextField* path_value_field_; + views::Textfield* path_value_field_; views::Label* send_for_label_; - views::TextField* send_for_value_field_; + views::Textfield* send_for_value_field_; views::Label* created_label_; - views::TextField* created_value_field_; + views::Textfield* created_value_field_; views::Label* expires_label_; - views::TextField* expires_value_field_; + views::Textfield* expires_value_field_; DISALLOW_COPY_AND_ASSIGN(CookieInfoView); }; @@ -453,25 +453,25 @@ void CookieInfoView::Init() { name_label_ = new views::Label( l10n_util::GetString(IDS_COOKIES_COOKIE_NAME_LABEL)); - name_value_field_ = new views::TextField; + name_value_field_ = new views::Textfield; content_label_ = new views::Label( l10n_util::GetString(IDS_COOKIES_COOKIE_CONTENT_LABEL)); - content_value_field_ = new views::TextField; + content_value_field_ = new views::Textfield; domain_label_ = new views::Label( l10n_util::GetString(IDS_COOKIES_COOKIE_DOMAIN_LABEL)); - domain_value_field_ = new views::TextField; + domain_value_field_ = new views::Textfield; path_label_ = new views::Label( l10n_util::GetString(IDS_COOKIES_COOKIE_PATH_LABEL)); - path_value_field_ = new views::TextField; + path_value_field_ = new views::Textfield; send_for_label_ = new views::Label( l10n_util::GetString(IDS_COOKIES_COOKIE_SENDFOR_LABEL)); - send_for_value_field_ = new views::TextField; + send_for_value_field_ = new views::Textfield; created_label_ = new views::Label( l10n_util::GetString(IDS_COOKIES_COOKIE_CREATED_LABEL)); - created_value_field_ = new views::TextField; + created_value_field_ = new views::Textfield; expires_label_ = new views::Label( l10n_util::GetString(IDS_COOKIES_COOKIE_EXPIRES_LABEL)); - expires_value_field_ = new views::TextField; + expires_value_field_ = new views::Textfield; using views::GridLayout; using views::ColumnSet; @@ -521,7 +521,7 @@ void CookieInfoView::Init() { // Color these borderless text areas the same as the containing dialog. SkColor text_area_background = color_utils::GetSysSkColor(COLOR_3DFACE); - // Now that the TextFields are in the view hierarchy, we can initialize them. + // Now that the Textfields are in the view hierarchy, we can initialize them. name_value_field_->SetReadOnly(true); name_value_field_->RemoveBorder(); name_value_field_->SetBackgroundColor(text_area_background); @@ -610,9 +610,9 @@ void CookiesView::OnTableViewDelete(views::TableView* table_view) { } /////////////////////////////////////////////////////////////////////////////// -// CookiesView, views::TextField::Controller implementation: +// CookiesView, views::Textfield::Controller implementation: -void CookiesView::ContentsChanged(views::TextField* sender, +void CookiesView::ContentsChanged(views::Textfield* sender, const std::wstring& new_contents) { search_update_factory_.RevokeAll(); MessageLoop::current()->PostDelayedTask(FROM_HERE, @@ -620,11 +620,11 @@ void CookiesView::ContentsChanged(views::TextField* sender, &CookiesView::UpdateSearchResults), kSearchFilterDelayMs); } -bool CookiesView::HandleKeystroke(views::TextField* sender, - const views::TextField::Keystroke& key) { - if (views::TextField::IsKeystrokeEscape(key)) { +bool CookiesView::HandleKeystroke(views::Textfield* sender, + const views::Textfield::Keystroke& key) { + if (views::Textfield::IsKeystrokeEscape(key)) { ResetSearchQuery(); - } else if (views::TextField::IsKeystrokeEnter(key)) { + } else if (views::Textfield::IsKeystrokeEnter(key)) { search_update_factory_.RevokeAll(); UpdateSearchResults(); } @@ -700,7 +700,7 @@ CookiesView::CookiesView(Profile* profile) void CookiesView::Init() { search_label_ = new views::Label( l10n_util::GetString(IDS_COOKIES_SEARCH_LABEL)); - search_field_ = new views::TextField; + search_field_ = new views::Textfield; search_field_->SetController(this); clear_search_button_ = new views::NativeButton( this, l10n_util::GetString(IDS_COOKIES_CLEAR_SEARCH_LABEL)); diff --git a/chrome/browser/views/options/cookies_view.h b/chrome/browser/views/options/cookies_view.h index 7de565d..521dc7f 100644 --- a/chrome/browser/views/options/cookies_view.h +++ b/chrome/browser/views/options/cookies_view.h @@ -8,7 +8,7 @@ #include "base/task.h" #include "views/controls/button/button.h" #include "views/controls/table/table_view.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/view.h" #include "views/window/dialog_delegate.h" #include "views/window/window.h" @@ -27,7 +27,7 @@ class CookiesView : public views::View, public views::DialogDelegate, public views::ButtonListener, public views::TableViewObserver, - public views::TextField::Controller { + public views::Textfield::Controller { public: // Show the Cookies Window, creating one if necessary. static void ShowCookiesWindow(Profile* profile); @@ -47,11 +47,11 @@ class CookiesView : public views::View, // cookies. virtual void OnTableViewDelete(views::TableView* table_view); - // views::TextField::Controller implementation: - virtual void ContentsChanged(views::TextField* sender, + // views::Textfield::Controller implementation: + virtual void ContentsChanged(views::Textfield* sender, const std::wstring& new_contents); - virtual bool HandleKeystroke(views::TextField* sender, - const views::TextField::Keystroke& key); + virtual bool HandleKeystroke(views::Textfield* sender, + const views::Textfield::Keystroke& key); // views::WindowDelegate implementation: virtual int GetDialogButtons() const { @@ -90,7 +90,7 @@ class CookiesView : public views::View, // Assorted dialog controls views::Label* search_label_; - views::TextField* search_field_; + views::Textfield* search_field_; views::NativeButton* clear_search_button_; views::Label* description_label_; CookiesTableView* cookies_table_; diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc index 73159b1..a8a115b 100644 --- a/chrome/browser/views/options/fonts_page_view.cc +++ b/chrome/browser/views/options/fonts_page_view.cc @@ -28,7 +28,6 @@ #include "grit/locale_settings.h" #include "third_party/skia/include/core/SkBitmap.h" #include "views/controls/button/native_button.h" -#include "views/controls/text_field.h" #include "views/grid_layout.h" #include "views/standard_layout.h" #include "views/widget/widget.h" diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc index f315c27..a7b6806 100644 --- a/chrome/browser/views/options/general_page_view.cc +++ b/chrome/browser/views/options/general_page_view.cc @@ -36,7 +36,7 @@ #include "views/controls/button/radio_button.h" #include "views/controls/label.h" #include "views/controls/table/table_view.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/grid_layout.h" #include "views/standard_layout.h" @@ -606,9 +606,9 @@ void GeneralPageView::ItemChanged(views::ComboBox* combo_box, } /////////////////////////////////////////////////////////////////////////////// -// GeneralPageView, views::TextField::Controller implementation: +// GeneralPageView, views::Textfield::Controller implementation: -void GeneralPageView::ContentsChanged(views::TextField* sender, +void GeneralPageView::ContentsChanged(views::Textfield* sender, const std::wstring& new_contents) { if (sender == homepage_use_url_textfield_) { // If the text field contains a valid URL, sync it to prefs. We run it @@ -621,8 +621,8 @@ void GeneralPageView::ContentsChanged(views::TextField* sender, } } -bool GeneralPageView::HandleKeystroke(views::TextField* sender, - const views::TextField::Keystroke&) { +bool GeneralPageView::HandleKeystroke(views::Textfield* sender, + const views::Textfield::Keystroke&) { return false; } @@ -874,7 +874,7 @@ void GeneralPageView::InitHomepageGroup() { l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_USE_URL), kHomePageRadioGroup); homepage_use_url_radio_->set_listener(this); - homepage_use_url_textfield_ = new views::TextField; + homepage_use_url_textfield_ = new views::Textfield; homepage_use_url_textfield_->SetController(this); homepage_show_home_button_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_SHOW_BUTTON)); diff --git a/chrome/browser/views/options/general_page_view.h b/chrome/browser/views/options/general_page_view.h index 1e2d72f..077c2f3 100644 --- a/chrome/browser/views/options/general_page_view.h +++ b/chrome/browser/views/options/general_page_view.h @@ -20,7 +20,7 @@ class NativeButton; class RadioButton; class TableModel; class TableView; -class TextField; +class Textfield; } class CustomHomePagesTableModel; class OptionsGroupView; @@ -32,7 +32,7 @@ class SearchEngineListModel; class GeneralPageView : public OptionsPageView, public views::ComboBox::Listener, public views::ButtonListener, - public views::TextField::Controller, + public views::Textfield::Controller, public ShelfItemDialogDelegate, public views::TableViewObserver { public: @@ -48,11 +48,11 @@ class GeneralPageView : public OptionsPageView, int prev_index, int new_index); - // views::TextField::Controller implementation: - virtual void ContentsChanged(views::TextField* sender, + // views::Textfield::Controller implementation: + virtual void ContentsChanged(views::Textfield* sender, const std::wstring& new_contents); - virtual bool HandleKeystroke(views::TextField* sender, - const views::TextField::Keystroke& key); + virtual bool HandleKeystroke(views::Textfield* sender, + const views::Textfield::Keystroke& key); // OptionsPageView implementation: virtual void InitControlLayout(); @@ -132,7 +132,7 @@ class GeneralPageView : public OptionsPageView, OptionsGroupView* homepage_group_; views::RadioButton* homepage_use_newtab_radio_; views::RadioButton* homepage_use_url_radio_; - views::TextField* homepage_use_url_textfield_; + views::Textfield* homepage_use_url_textfield_; views::Checkbox* homepage_show_home_button_checkbox_; BooleanPrefMember new_tab_page_is_home_page_; StringPrefMember homepage_; diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc index 2dc80db..817bdac 100644 --- a/chrome/browser/views/options/languages_page_view.cc +++ b/chrome/browser/views/options/languages_page_view.cc @@ -31,7 +31,6 @@ #include "views/controls/button/radio_button.h" #include "views/controls/combo_box.h" #include "views/controls/tabbed_pane.h" -#include "views/controls/text_field.h" #include "views/grid_layout.h" #include "views/standard_layout.h" #include "views/widget/widget.h" diff --git a/chrome/browser/views/shelf_item_dialog.cc b/chrome/browser/views/shelf_item_dialog.cc index ebe7fd9..84d9193 100644 --- a/chrome/browser/views/shelf_item_dialog.cc +++ b/chrome/browser/views/shelf_item_dialog.cc @@ -21,7 +21,7 @@ #include "net/base/net_util.h" #include "views/background.h" #include "views/controls/label.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/focus/focus_manager.h" #include "views/grid_layout.h" #include "views/standard_layout.h" @@ -304,7 +304,7 @@ ShelfItemDialog::ShelfItemDialog(ShelfItemDialogDelegate* delegate, title_label->SetText(l10n_util::GetString(IDS_ASI_TITLE_LABEL)); layout->AddView(title_label); - title_field_ = new views::TextField(); + title_field_ = new views::Textfield(); title_field_->SetController(this); layout->AddView(title_field_); @@ -319,7 +319,7 @@ ShelfItemDialog::ShelfItemDialog(ShelfItemDialogDelegate* delegate, url_label->SetText(l10n_util::GetString(IDS_ASI_URL)); layout->AddView(url_label); - url_field_ = new views::TextField(); + url_field_ = new views::Textfield(); url_field_->SetController(this); layout->AddView(url_field_); @@ -397,7 +397,7 @@ void ShelfItemDialog::OnURLInfoAvailable( s = l10n_util::GetString(IDS_ASI_DEFAULT_TITLE); if (title_field_) { - // expected_title_handle_ is reset if the title textfield is edited so we + // expected_title_handle_ is reset if the title Textfield is edited so we // can safely set the value. title_field_->SetText(s); title_field_->SelectAll(); @@ -417,7 +417,7 @@ void ShelfItemDialog::InitiateTitleAutoFill(const GURL& url) { NewCallback(this, &ShelfItemDialog::OnURLInfoAvailable)); } -void ShelfItemDialog::ContentsChanged(views::TextField* sender, +void ShelfItemDialog::ContentsChanged(views::Textfield* sender, const std::wstring& new_contents) { // If the user has edited the title field we no longer want to autofill it // so we reset the expected handle to an impossible value. diff --git a/chrome/browser/views/shelf_item_dialog.h b/chrome/browser/views/shelf_item_dialog.h index 9ac740d..78088fe6 100644 --- a/chrome/browser/views/shelf_item_dialog.h +++ b/chrome/browser/views/shelf_item_dialog.h @@ -9,7 +9,7 @@ #include "chrome/browser/history/history.h" #include "views/controls/button/native_button.h" #include "views/controls/table/table_view.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/view.h" #include "views/window/dialog_delegate.h" #include "views/window/window.h" @@ -42,7 +42,7 @@ class ShelfItemDialogDelegate { //////////////////////////////////////////////////////////////////////////////// class ShelfItemDialog : public views::View, public views::DialogDelegate, - public views::TextField::Controller, + public views::Textfield::Controller, public views::TableViewObserver { public: ShelfItemDialog(ShelfItemDialogDelegate* delegate, @@ -66,10 +66,10 @@ class ShelfItemDialog : public views::View, virtual views::View* GetContentsView(); // TextField::Controller. - virtual void ContentsChanged(views::TextField* sender, + virtual void ContentsChanged(views::Textfield* sender, const std::wstring& new_contents); - virtual bool HandleKeystroke(views::TextField* sender, - const views::TextField::Keystroke& key) { + virtual bool HandleKeystroke(views::Textfield* sender, + const views::Textfield::Keystroke& key) { return false; } @@ -102,10 +102,10 @@ class ShelfItemDialog : public views::View, Profile* profile_; // URL Field. - views::TextField* url_field_; + views::Textfield* url_field_; // Title field. This is NULL if we're not showing the title. - views::TextField* title_field_; + views::Textfield* title_field_; // The table model. scoped_ptr<PossibleURLModel> url_table_model_; diff --git a/views/controls/message_box_view.cc b/views/controls/message_box_view.cc index 785ea42..064f644 100644 --- a/views/controls/message_box_view.cc +++ b/views/controls/message_box_view.cc @@ -137,7 +137,7 @@ void MessageBoxView::Init(int dialog_flags, } if (dialog_flags & MessageBoxFlags::kFlagHasPromptField) { - prompt_field_ = new views::TextField; + prompt_field_ = new views::Textfield; prompt_field_->SetText(default_prompt); } @@ -169,7 +169,7 @@ void MessageBoxView::ResetLayoutManager() { column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, GridLayout::FIXED, message_width_, 0); - // Column set for prompt textfield, if one has been set. + // Column set for prompt Textfield, if one has been set. const int textfield_column_view_set_id = 1; if (prompt_field_) { column_set = layout->AddColumnSet(textfield_column_view_set_id); diff --git a/views/controls/message_box_view.h b/views/controls/message_box_view.h index 6356d84..c34e904 100644 --- a/views/controls/message_box_view.h +++ b/views/controls/message_box_view.h @@ -10,7 +10,7 @@ #include "base/task.h" #include "views/controls/image_view.h" #include "views/controls/label.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/view.h" namespace views { @@ -32,7 +32,7 @@ class MessageBoxView : public views::View { const std::wstring& default_prompt); // Returns the text box. - views::TextField* text_box() { return prompt_field_; } + views::Textfield* text_box() { return prompt_field_; } // Returns user entered data in the prompt field. std::wstring GetInputText(); @@ -75,7 +75,7 @@ class MessageBoxView : public views::View { views::Label* message_label_; // Input text field for the message box. - views::TextField* prompt_field_; + views::Textfield* prompt_field_; // Icon displayed in the upper left corner of the message box. views::ImageView* icon_; diff --git a/views/controls/textfield/native_textfield_gtk.cc b/views/controls/textfield/native_textfield_gtk.cc new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/views/controls/textfield/native_textfield_gtk.cc diff --git a/views/controls/textfield/native_textfield_gtk.h b/views/controls/textfield/native_textfield_gtk.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/views/controls/textfield/native_textfield_gtk.h diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/views/controls/textfield/native_textfield_win.cc diff --git a/views/controls/textfield/native_textfield_win.h b/views/controls/textfield/native_textfield_win.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/views/controls/textfield/native_textfield_win.h diff --git a/views/controls/textfield/native_textfield_wrapper.h b/views/controls/textfield/native_textfield_wrapper.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/views/controls/textfield/native_textfield_wrapper.h diff --git a/views/controls/text_field.cc b/views/controls/textfield/textfield.cc index 1d00321..6675ce9 100644 --- a/views/controls/text_field.cc +++ b/views/controls/textfield/textfield.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include <atlbase.h> #include <atlapp.h> @@ -35,15 +35,15 @@ namespace views { static const int kDefaultEditStyle = WS_CHILD | WS_VISIBLE; -class TextField::Edit - : public CWindowImpl<TextField::Edit, CRichEditCtrl, +class Textfield::Edit + : public CWindowImpl<Textfield::Edit, CRichEditCtrl, CWinTraits<kDefaultEditStyle> >, - public CRichEditCommands<TextField::Edit>, + public CRichEditCommands<Textfield::Edit>, public Menu::Delegate { public: - DECLARE_WND_CLASS(L"ChromeViewsTextFieldEdit"); + DECLARE_WND_CLASS(L"ChromeViewsTextfieldEdit"); - Edit(TextField* parent, bool draw_border); + Edit(Textfield* parent, bool draw_border); ~Edit(); std::wstring GetText() const; @@ -186,7 +186,7 @@ class TextField::Edit static bool did_load_library_; - TextField* parent_; + Textfield* parent_; // The context menu for the edit. scoped_ptr<Menu> context_menu_; @@ -215,7 +215,7 @@ class TextField::Edit /////////////////////////////////////////////////////////////////////////////// // Helper classes -TextField::Edit::ScopedFreeze::ScopedFreeze(TextField::Edit* edit, +Textfield::Edit::ScopedFreeze::ScopedFreeze(Textfield::Edit* edit, ITextDocument* text_object_model) : edit_(edit), text_object_model_(text_object_model) { @@ -226,7 +226,7 @@ TextField::Edit::ScopedFreeze::ScopedFreeze(TextField::Edit* edit, } } -TextField::Edit::ScopedFreeze::~ScopedFreeze() { +Textfield::Edit::ScopedFreeze::~ScopedFreeze() { // Unfreeze the screen. if (text_object_model_) { long count; @@ -242,11 +242,11 @@ TextField::Edit::ScopedFreeze::~ScopedFreeze() { } /////////////////////////////////////////////////////////////////////////////// -// TextField::Edit +// Textfield::Edit -bool TextField::Edit::did_load_library_ = false; +bool Textfield::Edit::did_load_library_ = false; -TextField::Edit::Edit(TextField* parent, bool draw_border) +Textfield::Edit::Edit(Textfield* parent, bool draw_border) : parent_(parent), tracking_double_click_(false), double_click_time_(0), @@ -261,13 +261,13 @@ TextField::Edit::Edit(TextField* parent, bool draw_border) did_load_library_ = !!LoadLibrary(L"riched20.dll"); DWORD style = kDefaultEditStyle; - if (parent->GetStyle() & TextField::STYLE_PASSWORD) + if (parent->GetStyle() & Textfield::STYLE_PASSWORD) style |= ES_PASSWORD; if (parent->read_only_) style |= ES_READONLY; - if (parent->GetStyle() & TextField::STYLE_MULTILINE) + if (parent->GetStyle() & Textfield::STYLE_MULTILINE) style |= ES_MULTILINE | ES_WANTRETURN | ES_AUTOVSCROLL; else style |= ES_AUTOHSCROLL; @@ -277,8 +277,8 @@ TextField::Edit::Edit(TextField* parent, bool draw_border) RECT r = {0, 0, parent_->width(), parent_->height()}; Create(parent_->GetWidget()->GetNativeView(), r, NULL, style, ex_style); - if (parent->GetStyle() & TextField::STYLE_LOWERCASE) { - DCHECK((parent->GetStyle() & TextField::STYLE_PASSWORD) == 0); + if (parent->GetStyle() & Textfield::STYLE_LOWERCASE) { + DCHECK((parent->GetStyle() & Textfield::STYLE_PASSWORD) == 0); SetEditStyle(SES_LOWERCASE, SES_LOWERCASE); } @@ -302,17 +302,17 @@ TextField::Edit::Edit(TextField* parent, bool draw_border) l10n_util::GetString(IDS_APP_SELECT_ALL)); } -TextField::Edit::~Edit() { +Textfield::Edit::~Edit() { } -std::wstring TextField::Edit::GetText() const { +std::wstring Textfield::Edit::GetText() const { int len = GetTextLength() + 1; std::wstring str; GetWindowText(WriteInto(&str, len), len); return str; } -void TextField::Edit::SetText(const std::wstring& text) { +void Textfield::Edit::SetText(const std::wstring& text) { // Adjusting the string direction before setting the text in order to make // sure both RTL and LTR strings are displayed properly. std::wstring text_to_set; @@ -323,14 +323,14 @@ void TextField::Edit::SetText(const std::wstring& text) { SetWindowText(text_to_set.c_str()); } -void TextField::Edit::AppendText(const std::wstring& text) { +void Textfield::Edit::AppendText(const std::wstring& text) { int text_length = GetWindowTextLength(); ::SendMessage(m_hWnd, TBM_SETSEL, true, MAKELPARAM(text_length, text_length)); ::SendMessage(m_hWnd, EM_REPLACESEL, false, reinterpret_cast<LPARAM>(text.c_str())); } -std::wstring TextField::Edit::GetSelectedText() const { +std::wstring Textfield::Edit::GetSelectedText() const { // Figure out the length of the selection. long start; long end; @@ -343,17 +343,17 @@ std::wstring TextField::Edit::GetSelectedText() const { return str; } -void TextField::Edit::SelectAll() { +void Textfield::Edit::SelectAll() { // Select from the end to the front so that the first part of the text is // always visible. SetSel(GetTextLength(), 0); } -void TextField::Edit::ClearSelection() { +void Textfield::Edit::ClearSelection() { SetSel(GetTextLength(), GetTextLength()); } -void TextField::Edit::RemoveBorder() { +void Textfield::Edit::RemoveBorder() { if (!draw_border_) return; @@ -363,27 +363,27 @@ void TextField::Edit::RemoveBorder() { SWP_NOOWNERZORDER | SWP_NOSIZE); } -void TextField::Edit::SetEnabled(bool enabled) { +void Textfield::Edit::SetEnabled(bool enabled) { SendMessage(parent_->GetNativeComponent(), WM_ENABLE, static_cast<WPARAM>(enabled), 0); } // static -bool TextField::IsKeystrokeEnter(const Keystroke& key) { +bool Textfield::IsKeystrokeEnter(const Keystroke& key) { return key.key == VK_RETURN; } // static -bool TextField::IsKeystrokeEscape(const Keystroke& key) { +bool Textfield::IsKeystrokeEscape(const Keystroke& key) { return key.key == VK_ESCAPE; } -void TextField::Edit::SetBackgroundColor(COLORREF bg_color) { +void Textfield::Edit::SetBackgroundColor(COLORREF bg_color) { CRichEditCtrl::SetBackgroundColor(bg_color); bg_color_ = bg_color; } -bool TextField::Edit::IsCommandEnabled(int id) const { +bool Textfield::Edit::IsCommandEnabled(int id) const { switch (id) { case IDS_APP_UNDO: return !parent_->IsReadOnly() && !!CanUndo(); case IDS_APP_CUT: return !parent_->IsReadOnly() && @@ -396,7 +396,7 @@ bool TextField::Edit::IsCommandEnabled(int id) const { } } -void TextField::Edit::ExecuteCommand(int id) { +void Textfield::Edit::ExecuteCommand(int id) { ScopedFreeze freeze(this, GetTextObjectModel()); OnBeforePossibleChange(); switch (id) { @@ -410,11 +410,11 @@ void TextField::Edit::ExecuteCommand(int id) { OnAfterPossibleChange(); } -void TextField::Edit::OnChar(TCHAR ch, UINT repeat_count, UINT flags) { +void Textfield::Edit::OnChar(TCHAR ch, UINT repeat_count, UINT flags) { HandleKeystroke(GetCurrentMessage()->message, ch, repeat_count, flags); } -void TextField::Edit::OnContextMenu(HWND window, const CPoint& point) { +void Textfield::Edit::OnContextMenu(HWND window, const CPoint& point) { CPoint p(point); if (point.x == -1 || point.y == -1) { GetCaretPos(&p); @@ -423,7 +423,7 @@ void TextField::Edit::OnContextMenu(HWND window, const CPoint& point) { context_menu_->RunMenuAt(p.x, p.y); } -void TextField::Edit::OnCopy() { +void Textfield::Edit::OnCopy() { if (parent_->IsPassword()) return; @@ -435,7 +435,7 @@ void TextField::Edit::OnCopy() { } } -void TextField::Edit::OnCut() { +void Textfield::Edit::OnCut() { if (parent_->IsReadOnly() || parent_->IsPassword()) return; @@ -446,7 +446,7 @@ void TextField::Edit::OnCut() { ReplaceSel(L"", true); } -LRESULT TextField::Edit::OnImeChar(UINT message, WPARAM wparam, LPARAM lparam) { +LRESULT Textfield::Edit::OnImeChar(UINT message, WPARAM wparam, LPARAM lparam) { // http://crbug.com/7707: a rich-edit control may crash when it receives a // WM_IME_CHAR message while it is processing a WM_IME_COMPOSITION message. // Since view controls don't need WM_IME_CHAR messages, we prevent WM_IME_CHAR @@ -455,7 +455,7 @@ LRESULT TextField::Edit::OnImeChar(UINT message, WPARAM wparam, LPARAM lparam) { return 0; } -LRESULT TextField::Edit::OnImeStartComposition(UINT message, +LRESULT Textfield::Edit::OnImeStartComposition(UINT message, WPARAM wparam, LPARAM lparam) { // Users may press alt+shift or control+shift keys to change their keyboard @@ -470,7 +470,7 @@ LRESULT TextField::Edit::OnImeStartComposition(UINT message, return DefWindowProc(message, wparam, lparam); } -LRESULT TextField::Edit::OnImeComposition(UINT message, +LRESULT Textfield::Edit::OnImeComposition(UINT message, WPARAM wparam, LPARAM lparam) { text_before_change_.clear(); @@ -506,7 +506,7 @@ LRESULT TextField::Edit::OnImeComposition(UINT message, return result; } -LRESULT TextField::Edit::OnImeEndComposition(UINT message, +LRESULT Textfield::Edit::OnImeEndComposition(UINT message, WPARAM wparam, LPARAM lparam) { // Bug 11863: Korean IMEs send a WM_IME_ENDCOMPOSITION message without @@ -520,7 +520,7 @@ LRESULT TextField::Edit::OnImeEndComposition(UINT message, return DefWindowProc(message, wparam, lparam); } -void TextField::Edit::OnKeyDown(TCHAR key, UINT repeat_count, UINT flags) { +void Textfield::Edit::OnKeyDown(TCHAR key, UINT repeat_count, UINT flags) { // NOTE: Annoyingly, ctrl-alt-<key> generates WM_KEYDOWN rather than // WM_SYSKEYDOWN, so we need to check (flags & KF_ALTDOWN) in various places // in this function even with a WM_SYSKEYDOWN handler. @@ -599,7 +599,7 @@ void TextField::Edit::OnKeyDown(TCHAR key, UINT repeat_count, UINT flags) { HandleKeystroke(GetCurrentMessage()->message, key, repeat_count, flags); } -void TextField::Edit::OnLButtonDblClk(UINT keys, const CPoint& point) { +void Textfield::Edit::OnLButtonDblClk(UINT keys, const CPoint& point) { // Save the double click info for later triple-click detection. tracking_double_click_ = true; double_click_point_ = point; @@ -612,7 +612,7 @@ void TextField::Edit::OnLButtonDblClk(UINT keys, const CPoint& point) { OnAfterPossibleChange(); } -void TextField::Edit::OnLButtonDown(UINT keys, const CPoint& point) { +void Textfield::Edit::OnLButtonDown(UINT keys, const CPoint& point) { // Check for triple click, then reset tracker. Should be safe to subtract // double_click_time_ from the current message's time even if the timer has // wrapped in between. @@ -629,7 +629,7 @@ void TextField::Edit::OnLButtonDown(UINT keys, const CPoint& point) { OnAfterPossibleChange(); } -void TextField::Edit::OnLButtonUp(UINT keys, const CPoint& point) { +void Textfield::Edit::OnLButtonUp(UINT keys, const CPoint& point) { ScopedFreeze freeze(this, GetTextObjectModel()); OnBeforePossibleChange(); DefWindowProc(WM_LBUTTONUP, keys, @@ -637,11 +637,11 @@ void TextField::Edit::OnLButtonUp(UINT keys, const CPoint& point) { OnAfterPossibleChange(); } -void TextField::Edit::OnMouseLeave() { +void Textfield::Edit::OnMouseLeave() { SetContainsMouse(false); } -LRESULT TextField::Edit::OnMouseWheel(UINT message, +LRESULT Textfield::Edit::OnMouseWheel(UINT message, WPARAM w_param, LPARAM l_param) { // Reroute the mouse-wheel to the window under the mouse pointer if // applicable. @@ -650,7 +650,7 @@ LRESULT TextField::Edit::OnMouseWheel(UINT message, return DefWindowProc(message, w_param, l_param);; } -void TextField::Edit::OnMouseMove(UINT keys, const CPoint& point) { +void Textfield::Edit::OnMouseMove(UINT keys, const CPoint& point) { SetContainsMouse(true); // Clamp the selection to the visible text so the user can't drag to select // the "phantom newline". In theory we could achieve this by clipping the X @@ -704,7 +704,7 @@ void TextField::Edit::OnMouseMove(UINT keys, const CPoint& point) { } } -int TextField::Edit::OnNCCalcSize(BOOL w_param, LPARAM l_param) { +int Textfield::Edit::OnNCCalcSize(BOOL w_param, LPARAM l_param) { content_insets_.Set(0, 0, 0, 0); parent_->CalculateInsets(&content_insets_); if (w_param) { @@ -724,7 +724,7 @@ int TextField::Edit::OnNCCalcSize(BOOL w_param, LPARAM l_param) { return 0; } -void TextField::Edit::OnNCPaint(HRGN region) { +void Textfield::Edit::OnNCPaint(HRGN region) { if (!draw_border_) return; @@ -786,7 +786,7 @@ void TextField::Edit::OnNCPaint(HRGN region) { ReleaseDC(hdc); } -void TextField::Edit::OnNonLButtonDown(UINT keys, const CPoint& point) { +void Textfield::Edit::OnNonLButtonDown(UINT keys, const CPoint& point) { // Interestingly, the edit doesn't seem to cancel triple clicking when the // x-buttons (which usually means "thumb buttons") are pressed, so we only // call this for M and R down. @@ -794,7 +794,7 @@ void TextField::Edit::OnNonLButtonDown(UINT keys, const CPoint& point) { SetMsgHandled(false); } -void TextField::Edit::OnPaste() { +void Textfield::Edit::OnPaste() { if (parent_->IsReadOnly() || !ViewsDelegate::views_delegate) return; @@ -816,7 +816,7 @@ void TextField::Edit::OnPaste() { } } -void TextField::Edit::OnSysChar(TCHAR ch, UINT repeat_count, UINT flags) { +void Textfield::Edit::OnSysChar(TCHAR ch, UINT repeat_count, UINT flags) { // Nearly all alt-<xxx> combos result in beeping rather than doing something // useful, so we discard most. Exceptions: // * ctrl-alt-<xxx>, which is sometimes important, generates WM_CHAR instead @@ -828,17 +828,17 @@ void TextField::Edit::OnSysChar(TCHAR ch, UINT repeat_count, UINT flags) { SetMsgHandled(false); } -void TextField::Edit::HandleKeystroke(UINT message, +void Textfield::Edit::HandleKeystroke(UINT message, TCHAR key, UINT repeat_count, UINT flags) { ScopedFreeze freeze(this, GetTextObjectModel()); - TextField::Controller* controller = parent_->GetController(); + Textfield::Controller* controller = parent_->GetController(); bool handled = false; if (controller) { handled = controller->HandleKeystroke(parent_, - TextField::Keystroke(message, key, repeat_count, flags)); + Textfield::Keystroke(message, key, repeat_count, flags)); } if (!handled) { @@ -848,12 +848,12 @@ void TextField::Edit::HandleKeystroke(UINT message, } } -void TextField::Edit::OnBeforePossibleChange() { +void Textfield::Edit::OnBeforePossibleChange() { // Record our state. text_before_change_ = GetText(); } -void TextField::Edit::OnAfterPossibleChange() { +void Textfield::Edit::OnAfterPossibleChange() { // Prevent the user from selecting the "phantom newline" at the end of the // edit. If they try, we just silently move the end of the selection back to // the end of the real text. @@ -886,7 +886,7 @@ void TextField::Edit::OnAfterPossibleChange() { } } -LONG TextField::Edit::ClipXCoordToVisibleText(LONG x, +LONG Textfield::Edit::ClipXCoordToVisibleText(LONG x, bool is_triple_click) const { // Clip the X coordinate to the left edge of the text. Careful: // PosFromChar(0) may return a negative X coordinate if the beginning of the @@ -942,7 +942,7 @@ LONG TextField::Edit::ClipXCoordToVisibleText(LONG x, return is_triple_click ? (right_bound - 1) : right_bound; } -void TextField::Edit::SetContainsMouse(bool contains_mouse) { +void Textfield::Edit::SetContainsMouse(bool contains_mouse) { if (contains_mouse == contains_mouse_) return; @@ -964,7 +964,7 @@ void TextField::Edit::SetContainsMouse(bool contains_mouse) { RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_FRAME); } -ITextDocument* TextField::Edit::GetTextObjectModel() const { +ITextDocument* Textfield::Edit::GetTextObjectModel() const { if (!text_object_model_) { CComPtr<IRichEditOle> ole_interface; ole_interface.Attach(GetOleInterface()); @@ -974,9 +974,9 @@ ITextDocument* TextField::Edit::GetTextObjectModel() const { } ///////////////////////////////////////////////////////////////////////////// -// TextField +// Textfield -TextField::~TextField() { +Textfield::~Textfield() { if (edit_) { // If the edit hwnd still exists, we need to destroy it explicitly. if (*edit_) @@ -985,7 +985,7 @@ TextField::~TextField() { } } -void TextField::ViewHierarchyChanged(bool is_add, View* parent, View* child) { +void Textfield::ViewHierarchyChanged(bool is_add, View* parent, View* child) { Widget* widget; if (is_add && (widget = GetWidget())) { @@ -1022,14 +1022,14 @@ void TextField::ViewHierarchyChanged(bool is_add, View* parent, View* child) { } } -void TextField::Layout() { +void Textfield::Layout() { if (native_view_) { native_view_->SetBounds(GetLocalBounds(true)); native_view_->Layout(); } } -gfx::Size TextField::GetPreferredSize() { +gfx::Size Textfield::GetPreferredSize() { gfx::Insets insets; CalculateInsets(&insets); return gfx::Size(font_.GetExpectedTextWidth(default_width_in_chars_) + @@ -1037,23 +1037,23 @@ gfx::Size TextField::GetPreferredSize() { num_lines_ * font_.height() + insets.height()); } -std::wstring TextField::GetText() const { +std::wstring Textfield::GetText() const { return text_; } -void TextField::SetText(const std::wstring& text) { +void Textfield::SetText(const std::wstring& text) { text_ = text; if (edit_) edit_->SetText(text); } -void TextField::AppendText(const std::wstring& text) { +void Textfield::AppendText(const std::wstring& text) { text_ += text; if (edit_) edit_->AppendText(text); } -void TextField::CalculateInsets(gfx::Insets* insets) { +void Textfield::CalculateInsets(gfx::Insets* insets) { DCHECK(insets); if (!draw_border_) @@ -1067,32 +1067,32 @@ void TextField::CalculateInsets(gfx::Insets* insets) { insets->Set(3, 3, 3, 3); } -void TextField::SyncText() { +void Textfield::SyncText() { if (edit_) text_ = edit_->GetText(); } -void TextField::SetController(Controller* controller) { +void Textfield::SetController(Controller* controller) { controller_ = controller; } -TextField::Controller* TextField::GetController() const { +Textfield::Controller* Textfield::GetController() const { return controller_; } -bool TextField::IsReadOnly() const { +bool Textfield::IsReadOnly() const { return edit_ ? ((edit_->GetStyle() & ES_READONLY) != 0) : read_only_; } -bool TextField::IsPassword() const { - return GetStyle() & TextField::STYLE_PASSWORD; +bool Textfield::IsPassword() const { + return GetStyle() & Textfield::STYLE_PASSWORD; } -bool TextField::IsMultiLine() const { +bool Textfield::IsMultiLine() const { return (style_ & STYLE_MULTILINE) != 0; } -void TextField::SetReadOnly(bool read_only) { +void Textfield::SetReadOnly(bool read_only) { read_only_ = read_only; if (edit_) { edit_->SetReadOnly(read_only); @@ -1100,46 +1100,46 @@ void TextField::SetReadOnly(bool read_only) { } } -void TextField::Focus() { +void Textfield::Focus() { ::SetFocus(native_view_->GetHWND()); } -void TextField::SelectAll() { +void Textfield::SelectAll() { if (edit_) edit_->SelectAll(); } -void TextField::ClearSelection() const { +void Textfield::ClearSelection() const { if (edit_) edit_->ClearSelection(); } -HWND TextField::GetNativeComponent() { +HWND Textfield::GetNativeComponent() { return native_view_->GetHWND(); } -void TextField::SetBackgroundColor(SkColor color) { +void Textfield::SetBackgroundColor(SkColor color) { background_color_ = color; use_default_background_color_ = false; UpdateEditBackgroundColor(); } -void TextField::SetDefaultBackgroundColor() { +void Textfield::SetDefaultBackgroundColor() { use_default_background_color_ = true; UpdateEditBackgroundColor(); } -void TextField::SetFont(const gfx::Font& font) { +void Textfield::SetFont(const gfx::Font& font) { font_ = font; if (edit_) edit_->SetFont(font.hfont()); } -gfx::Font TextField::GetFont() const { +gfx::Font Textfield::GetFont() const { return font_; } -bool TextField::SetHorizontalMargins(int left, int right) { +bool Textfield::SetHorizontalMargins(int left, int right) { // SendMessage expects the two values to be packed into one using MAKELONG // so we truncate to 16 bits if necessary. return ERROR_SUCCESS == SendMessage(GetNativeComponent(), @@ -1149,12 +1149,12 @@ bool TextField::SetHorizontalMargins(int left, int right) { right & 0xFFFF)); } -void TextField::SetHeightInLines(int num_lines) { +void Textfield::SetHeightInLines(int num_lines) { DCHECK(IsMultiLine()); num_lines_ = num_lines; } -void TextField::RemoveBorder() { +void Textfield::RemoveBorder() { if (!draw_border_) return; @@ -1163,20 +1163,20 @@ void TextField::RemoveBorder() { edit_->RemoveBorder(); } -void TextField::SetEnabled(bool enabled) { +void Textfield::SetEnabled(bool enabled) { View::SetEnabled(enabled); edit_->SetEnabled(enabled); } -bool TextField::IsFocusable() const { +bool Textfield::IsFocusable() const { return IsEnabled() && !IsReadOnly(); } -void TextField::AboutToRequestFocusFromTabTraversal(bool reverse) { +void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) { SelectAll(); } -bool TextField::SkipDefaultKeyEventProcessing(const KeyEvent& e) { +bool Textfield::SkipDefaultKeyEventProcessing(const KeyEvent& e) { // TODO(hamaji): Figure out which keyboard combinations we need to add here, // similar to LocationBarView::SkipDefaultKeyEventProcessing. if (e.GetCharacter() == VK_BACK) @@ -1191,7 +1191,7 @@ bool TextField::SkipDefaultKeyEventProcessing(const KeyEvent& e) { return false; } -void TextField::UpdateEditBackgroundColor() { +void Textfield::UpdateEditBackgroundColor() { if (!edit_) return; diff --git a/views/controls/text_field.h b/views/controls/textfield/textfield.h index 3c4571a..114dbbf 100644 --- a/views/controls/text_field.h +++ b/views/controls/textfield/textfield.h @@ -2,11 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// These classes define a text field widget that can be used in the views UI -// toolkit. - -#ifndef VIEWS_CONTROLS_TEXT_FIELD_H_ -#define VIEWS_CONTROLS_TEXT_FIELD_H_ +#ifndef VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ +#define VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ #include <string> @@ -20,7 +17,7 @@ namespace views { class HWNDView; // This class implements a ChromeView that wraps a native text (edit) field. -class TextField : public View { +class Textfield : public View { public: // Keystroke provides a platform-dependent way to send keystroke events. // Cross-platform code can use IsKeystrokeEnter/Escape to check for these @@ -54,14 +51,14 @@ class TextField : public View { class Controller { public: // This method is called whenever the text in the field changes. - virtual void ContentsChanged(TextField* sender, + virtual void ContentsChanged(Textfield* sender, const std::wstring& new_contents) = 0; // This method is called to get notified about keystrokes in the edit. // This method returns true if the message was handled and should not be // processed further. If it returns false the processing continues. - virtual bool HandleKeystroke(TextField* sender, - const TextField::Keystroke& keystroke) = 0; + virtual bool HandleKeystroke(Textfield* sender, + const Textfield::Keystroke& keystroke) = 0; }; enum StyleFlags { @@ -71,7 +68,7 @@ class TextField : public View { STYLE_LOWERCASE = 1<<2 }; - TextField() + Textfield() : #if defined(OS_WIN) native_view_(NULL), @@ -86,7 +83,7 @@ class TextField : public View { num_lines_(1) { SetFocusable(true); } - explicit TextField(StyleFlags style) + explicit Textfield(StyleFlags style) : #if defined(OS_WIN) native_view_(NULL), @@ -101,7 +98,7 @@ class TextField : public View { num_lines_(1) { SetFocusable(true); } - virtual ~TextField(); + virtual ~Textfield(); void ViewHierarchyChanged(bool is_add, View* parent, View* child); @@ -157,7 +154,7 @@ class TextField : public View { // Set the font. void SetFont(const gfx::Font& font); - // Return the font used by this TextField. + // Return the font used by this Textfield. gfx::Font GetFont() const; // Sets the left and right margin (in pixels) within the text box. On Windows @@ -220,7 +217,7 @@ class TextField : public View { gfx::Font font_; - // NOTE: this is temporary until we rewrite TextField to always work whether + // NOTE: this is temporary until we rewrite Textfield to always work whether // there is an HWND or not. // Used if the HWND hasn't been created yet. std::wstring text_; @@ -238,16 +235,16 @@ class TextField : public View { bool use_default_background_color_; - // The number of lines of text this textfield displays at once. + // The number of lines of text this Textfield displays at once. int num_lines_; protected: // Calculates the insets for the text field. void CalculateInsets(gfx::Insets* insets); - DISALLOW_COPY_AND_ASSIGN(TextField); + DISALLOW_COPY_AND_ASSIGN(Textfield); }; } // namespace views -#endif // VIEWS_CONTROLS_TEXT_FIELD_H_ +#endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ diff --git a/views/focus/focus_manager_unittest.cc b/views/focus/focus_manager_unittest.cc index 7176a0d..64d34c2 100644 --- a/views/focus/focus_manager_unittest.cc +++ b/views/focus/focus_manager_unittest.cc @@ -20,7 +20,7 @@ #include "views/controls/link.h" #include "views/controls/scroll_view.h" #include "views/controls/tabbed_pane.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/widget/accelerator_handler.h" #include "views/widget/root_view.h" #include "views/widget/widget_win.h" @@ -39,13 +39,13 @@ static int count = 1; static const int kTopCheckBoxID = count++; // 1 static const int kLeftContainerID = count++; static const int kAppleLabelID = count++; -static const int kAppleTextFieldID = count++; +static const int kAppleTextfieldID = count++; static const int kOrangeLabelID = count++; // 5 -static const int kOrangeTextFieldID = count++; +static const int kOrangeTextfieldID = count++; static const int kBananaLabelID = count++; -static const int kBananaTextFieldID = count++; +static const int kBananaTextfieldID = count++; static const int kKiwiLabelID = count++; -static const int kKiwiTextFieldID = count++; // 10 +static const int kKiwiTextfieldID = count++; // 10 static const int kFruitButtonID = count++; static const int kFruitCheckBoxID = count++; @@ -80,7 +80,7 @@ static const int kItalicCheckBoxID = count++; static const int kUnderlinedCheckBoxID = count++; static const int kSearchContainerID = count++; -static const int kSearchTextFieldID = count++; // 40 +static const int kSearchTextfieldID = count++; // 40 static const int kSearchButtonID = count++; static const int kHelpLinkID = count++; @@ -271,8 +271,8 @@ void TestViewWindow::Init() { left_container->AddChildView(label); label->SetBounds(label_x, y, label_width, label_height); - views::TextField* text_field = new views::TextField(); - text_field->SetID(kAppleTextFieldID); + views::Textfield* text_field = new views::Textfield(); + text_field->SetID(kAppleTextfieldID); left_container->AddChildView(text_field); text_field->SetBounds(label_x + label_width + 5, y, text_field_width, label_height); @@ -284,8 +284,8 @@ void TestViewWindow::Init() { left_container->AddChildView(label); label->SetBounds(label_x, y, label_width, label_height); - text_field = new views::TextField(); - text_field->SetID(kOrangeTextFieldID); + text_field = new views::Textfield(); + text_field->SetID(kOrangeTextfieldID); left_container->AddChildView(text_field); text_field->SetBounds(label_x + label_width + 5, y, text_field_width, label_height); @@ -297,8 +297,8 @@ void TestViewWindow::Init() { left_container->AddChildView(label); label->SetBounds(label_x, y, label_width, label_height); - text_field = new views::TextField(); - text_field->SetID(kBananaTextFieldID); + text_field = new views::Textfield(); + text_field->SetID(kBananaTextfieldID); left_container->AddChildView(text_field); text_field->SetBounds(label_x + label_width + 5, y, text_field_width, label_height); @@ -310,8 +310,8 @@ void TestViewWindow::Init() { left_container->AddChildView(label); label->SetBounds(label_x, y, label_width, label_height); - text_field = new views::TextField(); - text_field->SetID(kKiwiTextFieldID); + text_field = new views::Textfield(); + text_field->SetID(kKiwiTextfieldID); left_container->AddChildView(text_field); text_field->SetBounds(label_x + label_width + 5, y, text_field_width, label_height); @@ -457,10 +457,10 @@ void TestViewWindow::Init() { contents = new views::View(); contents->set_background( views::Background::CreateSolidBackground(SK_ColorWHITE)); - text_field = new views::TextField(); + text_field = new views::Textfield(); contents->AddChildView(text_field); text_field->SetBounds(10, 10, 100, 20); - text_field->SetID(kSearchTextFieldID); + text_field->SetID(kSearchTextfieldID); button = new views::NativeButton(NULL, L"Search"); contents->AddChildView(button); @@ -534,15 +534,15 @@ void FocusManagerTest::TearDown() { TEST_F(FocusManagerTest, NormalTraversal) { - const int kTraversalIDs[] = { kTopCheckBoxID, kAppleTextFieldID, - kOrangeTextFieldID, kBananaTextFieldID, kKiwiTextFieldID, + const int kTraversalIDs[] = { kTopCheckBoxID, kAppleTextfieldID, + kOrangeTextfieldID, kBananaTextfieldID, kKiwiTextfieldID, kFruitButtonID, kFruitCheckBoxID, kAsparagusButtonID, kRosettaLinkID, kStupeurEtTremblementLinkID, kDinerGameLinkID, kRidiculeLinkID, kClosetLinkID, kVisitingLinkID, kAmelieLinkID, kJoyeuxNoelLinkID, kCampingLinkID, kBriceDeNiceLinkID, kTaxiLinkID, kAsterixLinkID, kOKButtonID, kCancelButtonID, kHelpButtonID, kStyleContainerID, kBoldCheckBoxID, kItalicCheckBoxID, - kUnderlinedCheckBoxID, kSearchTextFieldID, kSearchButtonID, kHelpLinkID, + kUnderlinedCheckBoxID, kSearchTextfieldID, kSearchButtonID, kHelpLinkID, kThumbnailContainerID, kThumbnailStarID, kThumbnailSuperStarID }; // Uncomment the following line if you want to test manually the UI of this @@ -585,16 +585,16 @@ TEST_F(FocusManagerTest, NormalTraversal) { TEST_F(FocusManagerTest, TraversalWithNonEnabledViews) { const int kMainContentsDisabledIDs[] = { - kBananaTextFieldID, kFruitCheckBoxID, kAsparagusButtonID, + kBananaTextfieldID, kFruitCheckBoxID, kAsparagusButtonID, kCauliflowerButtonID, kClosetLinkID, kVisitingLinkID, kBriceDeNiceLinkID, kTaxiLinkID, kAsterixLinkID, kHelpButtonID }; const int kStyleContentsDisabledIDs[] = { kBoldCheckBoxID }; - const int kSearchContentsDisabledIDs[] = { kSearchTextFieldID, kHelpLinkID }; + const int kSearchContentsDisabledIDs[] = { kSearchTextfieldID, kHelpLinkID }; - const int kTraversalIDs[] = { kTopCheckBoxID, kAppleTextFieldID, - kOrangeTextFieldID, kKiwiTextFieldID, kFruitButtonID, kBroccoliButtonID, + const int kTraversalIDs[] = { kTopCheckBoxID, kAppleTextfieldID, + kOrangeTextfieldID, kKiwiTextfieldID, kFruitButtonID, kBroccoliButtonID, kRosettaLinkID, kStupeurEtTremblementLinkID, kDinerGameLinkID, kRidiculeLinkID, kAmelieLinkID, kJoyeuxNoelLinkID, kCampingLinkID, kOKButtonID, kCancelButtonID, kStyleContainerID, diff --git a/views/view_unittest.cc b/views/view_unittest.cc index b5377eb..3e6543d 100644 --- a/views/view_unittest.cc +++ b/views/view_unittest.cc @@ -13,7 +13,7 @@ #include "views/controls/button/native_button_win.h" #endif #include "views/controls/scroll_view.h" -#include "views/controls/text_field.h" +#include "views/controls/textfield/textfield.h" #include "views/event.h" #include "views/focus/view_storage.h" #include "views/view.h" @@ -593,8 +593,8 @@ TEST_F(ViewTest, HitTestMasks) { } #if defined(OS_WIN) -// Tests that the TextField view respond appropiately to cut/copy/paste. -TEST_F(ViewTest, TextFieldCutCopyPaste) { +// Tests that the Textfield view respond appropiately to cut/copy/paste. +TEST_F(ViewTest, TextfieldCutCopyPaste) { const std::wstring kNormalText = L"Normal"; const std::wstring kReadOnlyText = L"Read only"; const std::wstring kPasswordText = L"Password! ** Secret stuff **"; @@ -605,10 +605,10 @@ TEST_F(ViewTest, TextFieldCutCopyPaste) { window->Init(NULL, gfx::Rect(0, 0, 100, 100), true); RootView* root_view = window->GetRootView(); - TextField* normal = new TextField(); - TextField* read_only = new TextField(); + Textfield* normal = new Textfield(); + Textfield* read_only = new Textfield(); read_only->SetReadOnly(true); - TextField* password = new TextField(TextField::STYLE_PASSWORD); + Textfield* password = new Textfield(Textfield::STYLE_PASSWORD); root_view->AddChildView(normal); root_view->AddChildView(read_only); @@ -675,8 +675,8 @@ TEST_F(ViewTest, TextFieldCutCopyPaste) { // // Test Paste. // - // Note that we use GetWindowText instead of TextField::GetText below as the - // text in the TextField class is synced to the text of the HWND on + // Note that we use GetWindowText instead of Textfield::GetText below as the + // text in the Textfield class is synced to the text of the HWND on // WM_KEYDOWN messages that we are not simulating here. // Attempting to copy kNormalText in a read-only text-field should fail. @@ -745,7 +745,7 @@ class TestViewWithControls : public View { TestViewWithControls() { button_ = new ButtonTest(NULL, L"Button"); checkbox_ = new CheckboxTest(L"My checkbox"); - text_field_ = new TextField(); + text_field_ = new Textfield(); AddChildView(button_); AddChildView(checkbox_); AddChildView(text_field_); @@ -753,7 +753,7 @@ class TestViewWithControls : public View { ButtonTest* button_; CheckboxTest* checkbox_; - TextField* text_field_; + Textfield* text_field_; }; class SimpleWindowDelegate : public WindowDelegate { diff --git a/views/views.gyp b/views/views.gyp index f6b49ed..9c86b89 100644 --- a/views/views.gyp +++ b/views/views.gyp @@ -135,8 +135,13 @@ 'controls/table/group_table_view.h', 'controls/table/table_view.cc', 'controls/table/table_view.h', - 'controls/text_field.cc', - 'controls/text_field.h', + 'controls/textfield/textfield.cc', + 'controls/textfield/textfield.h', + 'controls/textfield/native_textfield_gtk.cc', + 'controls/textfield/native_textfield_gtk.h', + 'controls/textfield/native_textfield_win.cc', + 'controls/textfield/native_textfield_win.h', + 'controls/textfield/native_textfield_wrapper.h', 'controls/throbber.cc', 'controls/throbber.h', 'controls/tree/tree_view.cc', |