Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Unified Diff: views/controls/separator.cc

Issue 119019: Reverting 17368. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/controls/separator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/separator.cc
===================================================================
--- views/controls/separator.cc (revision 17374)
+++ views/controls/separator.cc (working copy)
@@ -1,62 +1,15 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "views/controls/separator.h"
-#if defined(OS_LINUX)
-#include "views/controls/native_control_gtk.h"
-#elif defined(OS_WIN)
-#include "views/controls/native_control_win.h"
-#endif
-#include "views/widget/widget.h"
+#include "views/controls/native/native_view_host.h"
namespace views {
-#if defined(OS_WIN)
-class NativeSeparatorWin : public NativeControlWin {
- public:
- explicit NativeSeparatorWin(Separator* separator) : separator_(separator) {}
- virtual ~NativeSeparatorWin() {}
+static const int kSeparatorSize = 2;
- // Overridden from NativeControlWin:
- virtual void CreateNativeControl() {
- HWND control_hwnd = CreateWindowEx(GetAdditionalExStyle(), L"STATIC", L"",
- WS_CHILD | SS_ETCHEDHORZ | SS_SUNKEN,
- 0, 0, width(), height(),
- separator_->GetWidget()->GetNativeView(),
- NULL, NULL, NULL);
- NativeControlCreated(control_hwnd);
- }
-
- private:
- Separator* separator_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeSeparatorWin);
-};
-#elif defined(OS_LINUX)
-class NativeSeparatorGtk : public NativeControlGtk {
- public:
- explicit NativeSeparatorGtk(Separator* separator) : separator_(separator) {}
- virtual ~NativeSeparatorGtk() {}
-
- // Overridden from NativeSeparatorGtk:
- virtual void CreateNativeControl() {
- // TODO(port): create a separator widget and pass to NativeControlCreated.
- }
-
- private:
- Separator* separator_;
-
- DISALLOW_COPY_AND_ASSIGN(NativeSeparatorGtk);
-};
-#endif
-
-// static
-const char Separator::kViewClassName[] = "views/Separator";
-
-const int kSeparatorSize = 2;
-
Separator::Separator() {
SetFocusable(false);
}
@@ -64,41 +17,21 @@
Separator::~Separator() {
}
-////////////////////////////////////////////////////////////////////////////////
-// Separator, View overrides:
+HWND Separator::CreateNativeControl(HWND parent_container) {
+ SetFixedHeight(kSeparatorSize, CENTER);
-gfx::Size Separator::GetPreferredSize() {
- return gfx::Size(width(), kSeparatorSize);
+ return ::CreateWindowEx(GetAdditionalExStyle(), L"STATIC", L"",
+ WS_CHILD | SS_ETCHEDHORZ | SS_SUNKEN,
+ 0, 0, width(), height(),
+ parent_container, NULL, NULL, NULL);
}
-void Separator::Layout() {
- if (native_wrapper_) {
- native_wrapper_->SetBounds(0, 0, width(), height());
- native_wrapper_->Layout();
- }
+LRESULT Separator::OnNotify(int w_param, LPNMHDR l_param) {
+ return 0;
}
-void Separator::ViewHierarchyChanged(bool is_add, View* parent,
- View* child) {
- if (is_add && !native_wrapper_ && GetWidget()) {
- CreateNativeWrapper();
- AddChildView(native_wrapper_);
- }
+gfx::Size Separator::GetPreferredSize() {
+ return gfx::Size(width(), fixed_height_);
}
-std::string Separator::GetClassName() const {
- return kViewClassName;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Separator, private:
-
-void Separator::CreateNativeWrapper() {
-#if defined(OS_WIN)
- native_wrapper_ = new NativeSeparatorWin(this);
-#elif defined(OS_LINUX)
- native_wrapper_ = new NativeSeparatorGtk(this);
-#endif
-}
-
} // namespace views
« no previous file with comments | « views/controls/separator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698