summaryrefslogtreecommitdiff
path: root/chromium/ash/system/tray/fixed_sized_scroll_view.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ash/system/tray/fixed_sized_scroll_view.h')
-rw-r--r--chromium/ash/system/tray/fixed_sized_scroll_view.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/chromium/ash/system/tray/fixed_sized_scroll_view.h b/chromium/ash/system/tray/fixed_sized_scroll_view.h
new file mode 100644
index 00000000000..c5d9bc0a099
--- /dev/null
+++ b/chromium/ash/system/tray/fixed_sized_scroll_view.h
@@ -0,0 +1,47 @@
+// Copyright 2013 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 ASH_SYSTEM_TRAY_FIXED_SIZED_SCROLL_VIEW_H_
+#define ASH_SYSTEM_TRAY_FIXED_SIZED_SCROLL_VIEW_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ui/views/controls/scroll_view.h"
+
+namespace ash {
+namespace internal {
+
+// A custom scroll-view that has a specified dimension.
+class FixedSizedScrollView : public views::ScrollView {
+ public:
+ FixedSizedScrollView();
+ virtual ~FixedSizedScrollView();
+
+ void SetContentsView(views::View* view);
+
+ // Change the fixed size of the view. Invalidates the layout (by calling
+ // PreferredSizeChanged()).
+ void SetFixedSize(const gfx::Size& size);
+
+ void set_fixed_size(const gfx::Size& size) { fixed_size_ = size; }
+
+ // Overridden from views::View:
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual void Layout() OVERRIDE;
+
+ protected:
+ // Overridden from views::View:
+ virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
+ virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE;
+
+ private:
+ gfx::Size fixed_size_;
+
+ DISALLOW_COPY_AND_ASSIGN(FixedSizedScrollView);
+};
+
+} // namespace internal
+} // namespace ash
+
+#endif // ASH_SYSTEM_TRAY_FIXED_SIZED_SCROLL_VIEW_H_