diff options
author | saintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-20 15:38:02 +0000 |
---|---|---|
committer | saintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-20 15:38:02 +0000 |
commit | ab79692f684d05b53fa99d68f370e24c9aa5acf1 (patch) | |
tree | 23a17855994bb25b38129af3ffcabd4c937cdcf7 /views | |
parent | 1ca750f727a7e31f741e228a5533d08be32e835e (diff) | |
download | chromium_src-ab79692f684d05b53fa99d68f370e24c9aa5acf1.zip chromium_src-ab79692f684d05b53fa99d68f370e24c9aa5acf1.tar.gz chromium_src-ab79692f684d05b53fa99d68f370e24c9aa5acf1.tar.bz2 |
Removing unused class. Deprecated when we moved to web ui prefs
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6877065
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82293 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/listbox/listbox.cc | 58 | ||||
-rw-r--r-- | views/controls/listbox/listbox.h | 70 | ||||
-rw-r--r-- | views/controls/listbox/native_listbox_win.cc | 134 | ||||
-rw-r--r-- | views/controls/listbox/native_listbox_win.h | 58 | ||||
-rw-r--r-- | views/controls/listbox/native_listbox_wrapper.h | 43 | ||||
-rw-r--r-- | views/views.gyp | 8 |
6 files changed, 0 insertions, 371 deletions
diff --git a/views/controls/listbox/listbox.cc b/views/controls/listbox/listbox.cc deleted file mode 100644 index e34dd6c..0000000 --- a/views/controls/listbox/listbox.cc +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2011 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. - -#include "views/controls/listbox/listbox.h" - -#include "views/controls/listbox/native_listbox_wrapper.h" -#include "views/controls/native/native_view_host.h" -#include "views/layout/fill_layout.h" - -namespace views { - -// Listbox ------------------------------------------------------------------ - -Listbox::Listbox( - const std::vector<string16>& strings, Listbox::Listener* listener) - : strings_(strings), - listener_(listener), - native_wrapper_(NULL) { - SetLayoutManager(new FillLayout()); -} - -Listbox::~Listbox() { -} - -int Listbox::GetRowCount() const { - return static_cast<int>(strings_.size()); -} - -int Listbox::SelectedRow() const { - if (!native_wrapper_) - return -1; - return native_wrapper_->SelectedRow(); -} - -void Listbox::SelectRow(int model_row) { - if (!native_wrapper_) - return; - native_wrapper_->SelectRow(model_row); -} - -void Listbox::ViewHierarchyChanged(bool is_add, View* parent, View* child) { - if (is_add && !native_wrapper_ && GetWidget()) { - // The native wrapper's lifetime will be managed by the view hierarchy after - // we call AddChildView. - native_wrapper_ = CreateWrapper(); - AddChildView(native_wrapper_->GetView()); - } -} - -//////////////////////////////////////////////////////////////////////////////// -// Listbox, protected: - -NativeListboxWrapper* Listbox::CreateWrapper() { - return NativeListboxWrapper::CreateNativeWrapper(this, strings_, listener_); -} - -} // namespace views diff --git a/views/controls/listbox/listbox.h b/views/controls/listbox/listbox.h deleted file mode 100644 index b029bde..0000000 --- a/views/controls/listbox/listbox.h +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2010 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 VIEWS_CONTROLS_LISTBOX_LISTBOX_H_ -#define VIEWS_CONTROLS_LISTBOX_LISTBOX_H_ -#pragma once - -#include "build/build_config.h" - -#include <string> -#include <vector> - -#include "base/string16.h" -#include "views/view.h" - -namespace views { - -class NativeListboxWrapper; - -// A Listbox is a view that displays multiple rows of fixed strings. -// Exactly one of these strings is shown as selected at all times. -class Listbox : public View { - public: - // An interface implemented by an object to let it know that a listbox - // selection has changed. - class Listener { - public: - // This is called if the user changes the current selection of the - // listbox. - virtual void ListboxSelectionChanged(Listbox* sender) = 0; - }; - - // Creates a new listbox, given the list of strings. |listener| can be NULL. - // Listbox does not take ownership of |listener|. - Listbox(const std::vector<string16>& strings, Listbox::Listener* listener); - virtual ~Listbox(); - - // Returns the number of rows in the table. - int GetRowCount() const; - - // Returns the 0-based index of the currently selected row, or -1 if nothing - // is selected. Note that as soon as a row has been selected once, there will - // always be a selected row. - int SelectedRow() const; - - // Selects the specified row. Note that this does NOT call the listener's - // |ListboxSelectionChanged()| method. - void SelectRow(int row); - - protected: - virtual NativeListboxWrapper* CreateWrapper(); - virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); - - private: - // Data stored in the listbox. - std::vector<string16> strings_; - - // Listens to selection changes. - Listbox::Listener* listener_; - - // The object that actually implements the table. - NativeListboxWrapper* native_wrapper_; - - DISALLOW_COPY_AND_ASSIGN(Listbox); -}; - -} // namespace views - -#endif // VIEWS_CONTROLS_LISTBOX_LISTBOX_H_ diff --git a/views/controls/listbox/native_listbox_win.cc b/views/controls/listbox/native_listbox_win.cc deleted file mode 100644 index 762555b..0000000 --- a/views/controls/listbox/native_listbox_win.cc +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) 2011 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. - -#include "views/controls/listbox/native_listbox_win.h" - -#include <commctrl.h> -#include <windowsx.h> - -#include "base/utf_string_conversions.h" -#include "ui/base/l10n/l10n_util_win.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/base/win/hwnd_util.h" -#include "ui/gfx/font.h" -#include "views/controls/listbox/listbox.h" -#include "views/widget/widget.h" - -namespace views { - -//////////////////////////////////////////////////////////////////////////////// -// NativeListboxWin, public: - -NativeListboxWin::NativeListboxWin(Listbox* listbox, - const std::vector<string16>& strings, - Listbox::Listener* listener) - : listbox_(listbox), - strings_(strings), - listener_(listener) { - // Associates the actual HWND with the listbox so the listbox is the one - // considered as having the focus (not the wrapper) when the HWND is - // focused directly (with a click for example). - set_focus_view(listbox); -} - -NativeListboxWin::~NativeListboxWin() { -} - -//////////////////////////////////////////////////////////////////////////////// -// NativeListboxWin, NativeListboxWrapper implementation: - -int NativeListboxWin::GetRowCount() const { - if (!native_view()) - return 0; - return ListBox_GetCount(native_view()); -} - -int NativeListboxWin::SelectedRow() const { - if (!native_view()) - return -1; - return ListBox_GetCurSel(native_view()); -} - -void NativeListboxWin::SelectRow(int row) { - if (!native_view()) - return; - ListBox_SetCurSel(native_view(), row); -} - -View* NativeListboxWin::GetView() { - return this; -} - -//////////////////////////////////////////////////////////////////////////////// -// NativeListboxWin, View overrides: - -gfx::Size NativeListboxWin::GetPreferredSize() { - SIZE sz = {0}; - SendMessage(native_view(), BCM_GETIDEALSIZE, 0, - reinterpret_cast<LPARAM>(&sz)); - - return gfx::Size(sz.cx, sz.cy); -} - -//////////////////////////////////////////////////////////////////////////////// -// NativeListboxWin, NativeControlWin overrides: - -bool NativeListboxWin::ProcessMessage(UINT message, WPARAM w_param, - LPARAM l_param, LRESULT* result) { - if (message == WM_COMMAND) { - switch (HIWORD(w_param)) { - case LBN_SELCHANGE: - if (listener_) - listener_->ListboxSelectionChanged(listbox_); - return true; - default: - break; - } - } - - return NativeControlWin::ProcessMessage(message, w_param, l_param, result); -} - -//////////////////////////////////////////////////////////////////////////////// -// NativeListboxWin, protected: - -void NativeListboxWin::CreateNativeControl() { - int style = WS_CHILD | LBS_NOINTEGRALHEIGHT | LBS_NOTIFY; - // If there's only one column and the title string is empty, don't show a - // header. - HWND hwnd = ::CreateWindowEx(WS_EX_CLIENTEDGE | GetAdditionalRTLStyle(), - WC_LISTBOX, - L"", - style, - 0, 0, width(), height(), - listbox_->GetWidget()->GetNativeView(), - NULL, NULL, NULL); - ui::CheckWindowCreated(hwnd); - HFONT font = ResourceBundle::GetSharedInstance(). - GetFont(ResourceBundle::BaseFont).GetNativeFont(); - SendMessage(hwnd, WM_SETFONT, reinterpret_cast<WPARAM>(font), FALSE); - l10n_util::AdjustUIFontForWindow(hwnd); - - for (size_t i = 0; i < strings_.size(); ++i) - ListBox_AddString(hwnd, UTF16ToWide(strings_[i]).c_str()); - - NativeControlCreated(hwnd); - - // Bug 964884: detach the IME attached to this window. - // We should attach IMEs only when we need to input CJK strings. - ::ImmAssociateContextEx(hwnd, NULL, 0); -} - -//////////////////////////////////////////////////////////////////////////////// -// NativeListboxWrapper, public: - -// static -NativeListboxWrapper* NativeListboxWrapper::CreateNativeWrapper( - Listbox* listbox, - const std::vector<string16>& strings, - Listbox::Listener* listener) { - return new NativeListboxWin(listbox, strings, listener); -} - -} // namespace views diff --git a/views/controls/listbox/native_listbox_win.h b/views/controls/listbox/native_listbox_win.h deleted file mode 100644 index dbff71d..0000000 --- a/views/controls/listbox/native_listbox_win.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2010 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 VIEWS_CONTROLS_LISTBOX_NATIVE_LISTBOX_WIN_H_ -#define VIEWS_CONTROLS_LISTBOX_NATIVE_LISTBOX_WIN_H_ -#pragma once - -#include <windows.h> - -#include "base/string16.h" -#include "views/controls/listbox/native_listbox_wrapper.h" -#include "views/controls/native_control_win.h" - -namespace views { - -// A View that hosts a native Windows listbox. -class NativeListboxWin : public NativeControlWin, public NativeListboxWrapper { - public: - NativeListboxWin(Listbox* listbox, - const std::vector<string16>& strings, - Listbox::Listener* listener); - virtual ~NativeListboxWin(); - - // NativeListboxWrapper implementation: - virtual int GetRowCount() const; - virtual int SelectedRow() const; - virtual void SelectRow(int row); - virtual View* GetView(); - - // Overridden from View: - virtual gfx::Size GetPreferredSize(); - - // Overridden from NativeControlWin: - virtual bool ProcessMessage(UINT message, - WPARAM w_param, - LPARAM l_param, - LRESULT* result); - - protected: - virtual void CreateNativeControl(); - - private: - // The listbox we are bound to. - Listbox* listbox_; - - // The strings shown in the listbox. - std::vector<string16> strings_; - - // Listens to selection changes. - Listbox::Listener* listener_; - - DISALLOW_COPY_AND_ASSIGN(NativeListboxWin); -}; - -} // namespace views - -#endif // VIEWS_CONTROLS_LISTBOX_NATIVE_LISTBOX_WIN_H_ diff --git a/views/controls/listbox/native_listbox_wrapper.h b/views/controls/listbox/native_listbox_wrapper.h deleted file mode 100644 index 801bd6d..0000000 --- a/views/controls/listbox/native_listbox_wrapper.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2010 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 VIEWS_CONTROLS_LISTBOX_NATIVE_LISTBOX_WRAPPER_H_ -#define VIEWS_CONTROLS_LISTBOX_NATIVE_LISTBOX_WRAPPER_H_ -#pragma once - -#include "ui/gfx/native_widget_types.h" -#include "ui/gfx/rect.h" -#include "views/controls/listbox/listbox.h" - -namespace views { - -// An interface implemented by an object that provides a platform-native -// listbox. -class NativeListboxWrapper { - public: - // Returns the number of rows in the table. - virtual int GetRowCount() const = 0; - - // Returns the 0-based index of the currently selected row. - virtual int SelectedRow() const = 0; - - // Selects the specified row, making sure it's visible. - virtual void SelectRow(int row) = 0; - - // Retrieves the views::View that hosts the native control. - virtual View* GetView() = 0; - - // Creates an appropriate NativeListboxWrapper for the platform. - static NativeListboxWrapper* CreateNativeWrapper( - Listbox* listbox, - const std::vector<string16>& strings, - Listbox::Listener* listener); - - protected: - virtual ~NativeListboxWrapper() {} -}; - -} // namespace views - -#endif // VIEWS_CONTROLS_LISTBOX_NATIVE_LISTBOX_WRAPPER_H_ diff --git a/views/views.gyp b/views/views.gyp index deca1c4..253877b 100644 --- a/views/views.gyp +++ b/views/views.gyp @@ -119,11 +119,6 @@ 'controls/label.h', 'controls/link.cc', 'controls/link.h', - 'controls/listbox/native_listbox_wrapper.h', - 'controls/listbox/native_listbox_win.cc', - 'controls/listbox/native_listbox_win.h', - 'controls/listbox/listbox.cc', - 'controls/listbox/listbox.h', 'controls/menu/menu.cc', 'controls/menu/menu.h', 'controls/menu/menu_2.cc', @@ -410,9 +405,6 @@ 'controls/scrollbar/bitmap_scroll_bar.cc', 'controls/combo_box.cc', 'controls/hwnd_view.cc', - 'controls/listbox/native_listbox_wrapper.h', - 'controls/listbox/listbox.cc', - 'controls/listbox/listbox.h', 'controls/native_control.cc', 'controls/table/group_table_view.cc', 'controls/table/table_model.cc', |