summaryrefslogtreecommitdiffstats
path: root/chrome/views/controls/button/image_button.h
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-08 00:34:05 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-08 00:34:05 +0000
commit2362e4fe2905ab75d3230ebc3e307ae53e2b8362 (patch)
treee6d88357a2021811e0e354f618247217be8bb3da /chrome/views/controls/button/image_button.h
parentdb23ac3e713dc17509b2b15d3ee634968da45715 (diff)
downloadchromium_src-2362e4fe2905ab75d3230ebc3e307ae53e2b8362.zip
chromium_src-2362e4fe2905ab75d3230ebc3e307ae53e2b8362.tar.gz
chromium_src-2362e4fe2905ab75d3230ebc3e307ae53e2b8362.tar.bz2
Move src/chrome/views to src/views. RS=darin http://crbug.com/11387
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15604 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/controls/button/image_button.h')
-rw-r--r--chrome/views/controls/button/image_button.h101
1 files changed, 0 insertions, 101 deletions
diff --git a/chrome/views/controls/button/image_button.h b/chrome/views/controls/button/image_button.h
deleted file mode 100644
index 6d304ba..0000000
--- a/chrome/views/controls/button/image_button.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// 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.
-
-#ifndef CHROME_VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_
-#define CHROME_VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_
-
-#include "chrome/views/controls/button/custom_button.h"
-#include "skia/include/SkBitmap.h"
-
-namespace views {
-
-// An image button.
-class ImageButton : public CustomButton {
- public:
- explicit ImageButton(ButtonListener* listener);
- virtual ~ImageButton();
-
- // Set the image the button should use for the provided state.
- virtual void SetImage(ButtonState aState, SkBitmap* anImage);
-
- enum HorizontalAlignment { ALIGN_LEFT = 0,
- ALIGN_CENTER,
- ALIGN_RIGHT, };
-
- enum VerticalAlignment { ALIGN_TOP = 0,
- ALIGN_MIDDLE,
- ALIGN_BOTTOM };
-
- // Sets how the image is laid out within the button's bounds.
- void SetImageAlignment(HorizontalAlignment h_align,
- VerticalAlignment v_align);
-
- // Overridden from View:
- virtual gfx::Size GetPreferredSize();
- virtual void Paint(ChromeCanvas* canvas);
-
- protected:
- // Returns the image to paint. This is invoked from paint and returns a value
- // from images.
- virtual SkBitmap GetImageToPaint();
-
- // The images used to render the different states of this button.
- SkBitmap images_[BS_COUNT];
-
- private:
- // Image alignment.
- HorizontalAlignment h_alignment_;
- VerticalAlignment v_alignment_;
-
- DISALLOW_COPY_AND_ASSIGN(ImageButton);
-};
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// ToggleImageButton
-//
-// A toggle-able ImageButton. It swaps out its graphics when toggled.
-//
-////////////////////////////////////////////////////////////////////////////////
-class ToggleImageButton : public ImageButton {
- public:
- ToggleImageButton(ButtonListener* listener);
- virtual ~ToggleImageButton();
-
- // Change the toggled state.
- void SetToggled(bool toggled);
-
- // Like Button::SetImage(), but to set the graphics used for the
- // "has been toggled" state. Must be called for each button state
- // before the button is toggled.
- void SetToggledImage(ButtonState state, SkBitmap* image);
-
- // Set the tooltip text displayed when the button is toggled.
- void SetToggledTooltipText(const std::wstring& tooltip);
-
- // Overridden from ImageButton:
- virtual void SetImage(ButtonState aState, SkBitmap* anImage);
-
- // Overridden from View:
- virtual bool GetTooltipText(int x, int y, std::wstring* tooltip);
-
- private:
- // The parent class's images_ member is used for the current images,
- // and this array is used to hold the alternative images.
- // We swap between the two when toggling.
- SkBitmap alternate_images_[BS_COUNT];
-
- // True if the button is currently toggled.
- bool toggled_;
-
- // The parent class's tooltip_text_ is displayed when not toggled, and
- // this one is shown when toggled.
- std::wstring toggled_tooltip_text_;
-
- DISALLOW_EVIL_CONSTRUCTORS(ToggleImageButton);
-};
-
-} // namespace views
-
-#endif // CHROME_VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_