summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthestig@google.com <thestig@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-02 00:59:06 +0000
committerthestig@google.com <thestig@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-02 00:59:06 +0000
commit1bd60b967f1188197efff7011c332d46e2e5163c (patch)
tree4d00846dcafb08a62b273096671163038fe7354d
parentfdd2ad0f1bf295cba2f4f984e85d3ab1bd534b9b (diff)
downloadchromium_src-1bd60b967f1188197efff7011c332d46e2e5163c.zip
chromium_src-1bd60b967f1188197efff7011c332d46e2e5163c.tar.gz
chromium_src-1bd60b967f1188197efff7011c332d46e2e5163c.tar.bz2
Reverting 17368.
TBR=beng Review URL: http://codereview.chromium.org/119019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17375 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--views/controls/separator.cc93
-rw-r--r--views/controls/separator.h28
2 files changed, 22 insertions, 99 deletions
diff --git a/views/controls/separator.cc b/views/controls/separator.cc
index 0e468d9..af0962f 100644
--- a/views/controls/separator.cc
+++ b/views/controls/separator.cc
@@ -1,61 +1,14 @@
-// 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() {}
-
- // 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;
+static const int kSeparatorSize = 2;
Separator::Separator() {
SetFocusable(false);
@@ -64,41 +17,21 @@ Separator::Separator() {
Separator::~Separator() {
}
-////////////////////////////////////////////////////////////////////////////////
-// Separator, View overrides:
+HWND Separator::CreateNativeControl(HWND parent_container) {
+ SetFixedHeight(kSeparatorSize, CENTER);
-gfx::Size Separator::GetPreferredSize() {
- return gfx::Size(width(), kSeparatorSize);
-}
-
-void Separator::Layout() {
- if (native_wrapper_) {
- native_wrapper_->SetBounds(0, 0, width(), height());
- native_wrapper_->Layout();
- }
+ return ::CreateWindowEx(GetAdditionalExStyle(), L"STATIC", L"",
+ WS_CHILD | SS_ETCHEDHORZ | SS_SUNKEN,
+ 0, 0, width(), height(),
+ parent_container, NULL, NULL, NULL);
}
-void Separator::ViewHierarchyChanged(bool is_add, View* parent,
- View* child) {
- if (is_add && !native_wrapper_ && GetWidget()) {
- CreateNativeWrapper();
- AddChildView(native_wrapper_);
- }
+LRESULT Separator::OnNotify(int w_param, LPNMHDR l_param) {
+ return 0;
}
-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
+gfx::Size Separator::GetPreferredSize() {
+ return gfx::Size(width(), fixed_height_);
}
} // namespace views
diff --git a/views/controls/separator.h b/views/controls/separator.h
index 0988d62..866beda 100644
--- a/views/controls/separator.h
+++ b/views/controls/separator.h
@@ -5,40 +5,30 @@
#ifndef VIEWS_CONTROLS_SEPARATOR_H_
#define VIEWS_CONTROLS_SEPARATOR_H_
-#include <string>
-
-#include "views/view.h"
+#include "views/controls/native_control.h"
namespace views {
// The Separator class is a view that shows a line used to visually separate
// other views. The current implementation is only horizontal.
-class Separator : public View {
+class Separator : public NativeControl {
public:
- // The separator's class name.
- static const char kViewClassName[];
-
Separator();
virtual ~Separator();
- // Overridden from View:
- virtual void Layout();
+ // NativeControl overrides:
+ virtual HWND CreateNativeControl(HWND parent_container);
+ virtual LRESULT OnNotify(int w_param, LPNMHDR l_param);
+
+ // View overrides:
virtual gfx::Size GetPreferredSize();
- protected:
- virtual void ViewHierarchyChanged(bool is_add, View* parent,
- View* child);
- virtual std::string GetClassName() const;
private:
- void CreateNativeWrapper();
-
- // The native view.
- View* native_wrapper_;
- DISALLOW_COPY_AND_ASSIGN(Separator);
+ DISALLOW_EVIL_CONSTRUCTORS(Separator);
};
} // namespace views
-#endif // VIEWS_CONTROLS_SEPARATOR_H_
+#endif // #define VIEWS_CONTROLS_SEPARATOR_H_