diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-29 06:02:19 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-29 06:02:19 +0000 |
commit | 17dee5e7005a82e08d11be50d56477939124a6b7 (patch) | |
tree | 7133a5d7a086ce238057cb82e0e81d332dafba8f /views/controls/button | |
parent | bf0136d62bfe02f57821ce026c04b6e8204eb482 (diff) | |
download | chromium_src-17dee5e7005a82e08d11be50d56477939124a6b7.zip chromium_src-17dee5e7005a82e08d11be50d56477939124a6b7.tar.gz chromium_src-17dee5e7005a82e08d11be50d56477939124a6b7.tar.bz2 |
Refactors HWNDView, NativeViewHostGtk and NativeViewHost so that they match the NativeControl pattern established for NativeButtons. NativeViewHost is a platform-neutral class that clients instantiate. Behind the scenes the platform instantiates the appropriate NativeViewHostWrapper implementation, either NativeViewHostGtk (as before) or NativeViewHostWin (replaces HWNDView).
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/114059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17169 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/button')
-rw-r--r-- | views/controls/button/native_button_gtk.cc | 5 | ||||
-rw-r--r-- | views/controls/button/native_button_win.cc | 14 |
2 files changed, 10 insertions, 9 deletions
diff --git a/views/controls/button/native_button_gtk.cc b/views/controls/button/native_button_gtk.cc index 3f10897..63da111 100644 --- a/views/controls/button/native_button_gtk.cc +++ b/views/controls/button/native_button_gtk.cc @@ -11,6 +11,7 @@ #include "views/controls/button/checkbox.h" #include "views/controls/button/native_button.h" #include "views/controls/button/radio_button.h" +#include "views/controls/native/native_view_host_gtk.h" #include "views/widget/widget.h" namespace views { @@ -21,7 +22,7 @@ NativeButtonGtk::NativeButtonGtk(NativeButton* native_button) // Associates the actual GtkWidget with the native_button so the native_button // is the one considered as having the focus (not the wrapper) when the // GtkWidget is focused directly (with a click for example). - SetAssociatedFocusView(native_button); + set_focus_view(native_button); } NativeButtonGtk::~NativeButtonGtk() { @@ -90,7 +91,7 @@ void NativeButtonGtk::NativeControlCreated(GtkWidget* widget) { // static void NativeButtonGtk::CallClicked(GtkButton* widget) { - View* view = GetViewForNative(GTK_WIDGET(widget)); + View* view = NativeViewHostGtk::GetViewForNative(GTK_WIDGET(widget)); if (view) static_cast<NativeButtonGtk*>(view)->OnClicked(); } diff --git a/views/controls/button/native_button_win.cc b/views/controls/button/native_button_win.cc index 5dd70d3..8d51907 100644 --- a/views/controls/button/native_button_win.cc +++ b/views/controls/button/native_button_win.cc @@ -23,7 +23,7 @@ NativeButtonWin::NativeButtonWin(NativeButton* native_button) // Associates the actual HWND with the native_button so the native_button is // the one considered as having the focus (not the wrapper) when the HWND is // focused directly (with a click for example). - SetAssociatedFocusView(native_button); + set_focus_view(native_button); } NativeButtonWin::~NativeButtonWin() { @@ -33,11 +33,11 @@ NativeButtonWin::~NativeButtonWin() { // NativeButtonWin, NativeButtonWrapper implementation: void NativeButtonWin::UpdateLabel() { - SetWindowText(GetHWND(), native_button_->label().c_str()); + SetWindowText(native_view(), native_button_->label().c_str()); } void NativeButtonWin::UpdateFont() { - SendMessage(GetHWND(), WM_SETFONT, + SendMessage(native_view(), WM_SETFONT, reinterpret_cast<WPARAM>(native_button_->font().hfont()), FALSE); } @@ -48,7 +48,7 @@ void NativeButtonWin::UpdateEnabled() { void NativeButtonWin::UpdateDefault() { if (!IsCheckbox()) { - SendMessage(GetHWND(), BM_SETSTYLE, + SendMessage(native_view(), BM_SETSTYLE, native_button_->is_default() ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON, true); } @@ -68,7 +68,7 @@ void NativeButtonWin::SetFocus() { gfx::Size NativeButtonWin::GetPreferredSize() { SIZE sz = {0}; - SendMessage(GetHWND(), BCM_GETIDEALSIZE, 0, reinterpret_cast<LPARAM>(&sz)); + SendMessage(native_view(), BCM_GETIDEALSIZE, 0, reinterpret_cast<LPARAM>(&sz)); return gfx::Size(sz.cx, sz.cy); } @@ -142,12 +142,12 @@ gfx::Size NativeCheckboxWin::GetPreferredSize() { // NativeCheckboxWin, NativeButtonWrapper implementation: void NativeCheckboxWin::UpdateChecked() { - SendMessage(GetHWND(), BM_SETCHECK, + SendMessage(native_view(), BM_SETCHECK, checkbox_->checked() ? BST_CHECKED : BST_UNCHECKED, 0); } void NativeCheckboxWin::SetPushed(bool pushed) { - SendMessage(GetHWND(), BM_SETSTATE, pushed, 0); + SendMessage(native_view(), BM_SETSTATE, pushed, 0); } bool NativeCheckboxWin::OnKeyDown(int vkey) { |