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

Unified Diff: chrome/browser/views/star_toggle.h

Issue 543215: Added Star button to compact navigation mode.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 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 | « chrome/browser/chromeos/compact_location_bar_view.cc ('k') | chrome/browser/views/star_toggle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/star_toggle.h
===================================================================
--- chrome/browser/views/star_toggle.h (revision 38044)
+++ chrome/browser/views/star_toggle.h (working copy)
@@ -1,69 +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_BROWSER_VIEWS_STAR_TOGGLE_H_
-#define CHROME_BROWSER_VIEWS_STAR_TOGGLE_H_
-
-#include "views/view.h"
-#include "views/event.h"
-
-class SkBitmap;
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// A view subclass to implement the star button. The star button notifies its
-// Delegate when the state changes.
-//
-////////////////////////////////////////////////////////////////////////////////
-class StarToggle : public views::View {
- public:
- class Delegate {
- public:
- // Called when the star is toggled.
- virtual void StarStateChanged(bool state) = 0;
- };
-
- explicit StarToggle(Delegate* delegate);
- virtual ~StarToggle();
-
- // Set whether the star is checked.
- void SetState(bool s);
- bool GetState() const;
-
- // If true (the default) the state is immediately changed on a mouse release.
- // If false, on mouse release the delegate is notified, but the state is not
- // changed.
- void set_change_state_immediately(bool value) {
- change_state_immediately_ = value;
- }
-
- // Check/uncheck the star.
- void SwitchState();
-
- // Overriden from view.
- void Paint(gfx::Canvas* canvas);
- gfx::Size GetPreferredSize();
- virtual bool OnMousePressed(const views::MouseEvent& e);
- virtual bool OnMouseDragged(const views::MouseEvent& event);
- virtual void OnMouseReleased(const views::MouseEvent& e, bool canceled);
- bool OnKeyPressed(const views::KeyEvent& e);
-
- private:
- // The state.
- bool state_;
-
- // Our bitmap.
- SkBitmap* state_off_;
- SkBitmap* state_on_;
-
- // Parent to be notified.
- Delegate* delegate_;
-
- // See note in setter.
- bool change_state_immediately_;
-
- DISALLOW_EVIL_CONSTRUCTORS(StarToggle);
-};
-
-#endif // CHROME_BROWSER_VIEWS_STAR_TOGGLE_H_
« no previous file with comments | « chrome/browser/chromeos/compact_location_bar_view.cc ('k') | chrome/browser/views/star_toggle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698